TingTingin / TikTokDiffusion

68 stars 10 forks source link

AttributeError: 'str' object has no attribute 'get' #20

Open ianbrophy opened 1 year ago

ianbrophy commented 1 year ago

Is this a common or known issue? I've tried a couple of restarts of my PC and a1111 webui. I thought I followed the install steps, but must have missed something, I guess.

Unhandled error processing page session : Traceback (most recent call last): File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\flet\flet.py", line 307, in on_session_created session_handler(page) File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\TikTokDiffusion\TikTokDiffusion.py", line 1010, in main sampler = option.get("name") AttributeError: 'str' object has no attribute 'get'

tooandrew commented 1 year ago

i am also having he same issue. in my case, the webui fails initially -

Installing collected packages: numpy Attempting uninstall: numpy Found existing installation: numpy 1.23.3 Uninstalling numpy-1.23.3: Successfully uninstalled numpy-1.23.3

stderr: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\ai\stable-diffusion-webui-1.1.0\venv\Lib\site-packages\~5mpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll' Check the permissions.

then if i open the webui manually, i get the following in the tiktok diffusion cmd window

Successfully connected to 127.0.0.1:7860 Unhandled error processing page session : Traceback (most recent call last): File "C:\ai\stable-diffusion-webui-1.1.0\venv\lib\site-packages\flet\flet.py", line 307, in on_session_created session_handler(page) File "C:\ai\stable-diffusion-webui-1.1.0\TikTokDiffusion\TikTokDiffusion.py", line 1010, in main sampler = option.get("name") AttributeError: 'str' object has no attribute 'get'

the release build works, but i'd like to try the new features.

thus far, i have tried changing the permissions for the entire stable diffusion webui to grant full control to users and authorized users. to fix the error in the webui (it didnt happen until i updated tiktokdiffusion, and doesnt happen when i run the webui without tiktok diffusion)

im not sure what else to look at.

EDIT: i changed line 1010 in C:\ai\stable-diffusion-webui-1.1.0\TikTokDiffusion\TikTokDiffusion.py to read

sampler = ("Eueler") instead of
sampler = option.get("name")
and it started successfully but all samplers are labelled as Eueler

Edit2: just firing up tiktokdiffusion web ui batch instead of the standard webui batch works

ianbrophy commented 1 year ago

I also made an edit on line 1010 to hardcode the sampler. Did you manage to get it working?

tooandrew commented 1 year ago

I also made an edit on line 1010 to hardcode the sampler. Did you manage to get it working?

I was getting the error when running the webui from the batch file that it came with. Running the webui with the webui batch file that came with tiktok diffusion it connects and works without any edits .

that being said trying to use controlnet causes a traceback error and nothing is generated, and the negative prompt is not even mentioned in the generation or added when you click add prompt (theres no add negative prompt button in the ui) so as far as i can tell the new features dont work anyways so just use the release version probably

ianbrophy commented 1 year ago

Interesting, I thought that I had tried that with no luck. I'll try it again!

ianbrophy commented 1 year ago

Ok, the app launches and I can add a prompt etc., I also confirmed a1111 is running, but now when I click Generate I see this:

`Exception in thread Thread-59 (this_func): Traceback (most recent call last): File "C:\Users\Ian\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "C:\Users\Ian\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\TikTokDiffusion\TikTokDiffusion.py", line 1025, in this_func

File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\TikTokDiffusion\track.py", line 977, in test_main run(source=Path(image_folder), *vars(opt), File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context return func(args, **kwargs) File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\TikTokDiffusion\track.py", line 898, in run image = api.img2img(images=[gen_image], File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\TikTokDiffusion\webuiapi.py", line 216, in img2img return self._to_api_result(response) File "D:\tools\A1111 Web UI Autoinstaller\stable-diffusion-webui\TikTokDiffusion\webuiapi.py", line 47, in _to_api_result raise RuntimeError(response.status_code, response.text) RuntimeError: (404, '{"detail":"Not Found"}')`

RealCalumPlays commented 1 year ago

@ianbrophy @tooandrew theres a simple fix. By default the SD API is DISABLED so when launching stable diffusion MAKE SURE that --api is passed and --cors-allow-origins=http://127.0.0.1:7860 is passed as cmd line arguments.

EDIT: To check if its working go to http://127.0.0.1:7860/sdapi/v1/samplers and it should spit out a load of data. If it says {detail:"Not Found"} then its not enabled.