dr413677671 / PromptGallery-stable-diffusion-webui

A prompt cookbook worked as stable-diffusion-webui extenstions.
Apache License 2.0
153 stars 16 forks source link

Error when selecting generated images for prompt-sets #17

Closed Golgovskiy closed 1 year ago

Golgovskiy commented 1 year ago

Following the tutorial video with default files i get this when pressing "Select" after the generation:

Traceback (most recent call last):
  File "D:\Repositories\Python\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 321, in run_predict
    output = await app.blocks.process_api(
  File "D:\Repositories\Python\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
    result = await self.call_function(fn_index, inputs, iterator, request)
  File "D:\Repositories\Python\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 856, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "D:\Repositories\Python\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "D:\Repositories\Python\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "D:\Repositories\Python\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "D:\Repositories\Python\stable-diffusion-webui\scripts\prompt_gallery.py", line 634, in <lambda>
    fn=lambda x: image_url(x),
  File "D:\Repositories\Python\stable-diffusion-webui\scripts\prompt_gallery.py", line 571, in image_url
    if filedata.startswith("data:image/png;base64,"):
AttributeError: 'dict' object has no attribute 'startswith'

The window for selected preview displays error.

I found a comment on the tutorial video reporting the same problem.

offroadguy56 commented 1 year ago

I also have the same problem here. @Golgovskiy did you have to change your --cors-allow-origins http://localhost:5173 to --cors-allow-origins http://127.0.0.1:5173? I couldn't get the port to bind because of some SOCKS error. My webui is running on localhost instead of the default 127.0.0.1 so I can access it from another PC.

Golgovskiy commented 1 year ago

I also have the same problem here. @Golgovskiy did you have to change your --cors-allow-origins http://localhost:5173 to --cors-allow-origins http://127.0.0.1:5173? I couldn't get the port to bind because of some SOCKS error. My webui is running on localhost instead of the default 127.0.0.1 so I can access it from another PC.

I had the problem right away, but I also noticed an error in the console, saying that it can't use two addresses at once (by default mine uses different one from 5173 for webui). I changed it to match the mine and that error disappeared, but the bug is still there, so it's probably not related.

dr413677671 commented 1 year ago

Please upgrade the extension. I added more logging to RC the error. @offroadguy56 @Golgovskiy I added a detailed intructions how to use customized port and IP.

Golgovskiy commented 1 year ago

Please upgrade the extension. I added more logging to RC the error. @offroadguy56 @Golgovskiy I added a detailed intructions how to use customized port and IP.

I'm sorry, but i see no difference in output. 2023-01-15_17-58-17

This time i clean reinstalled everything and didn't change the IP.

offroadguy56 commented 1 year ago

So Ive tried some things. I had a 2nd instance of webui that I forgot about. I updated it and prompt gallery to the latest. And prompt gallery works as intended.

On the main instance I did something similar, I backed up everything and essentially started with a fresh install. Installed my usual extensions and prompt gallery, and prompt gallery does not want to work. I think there is some extension I have causing the issue. Please give me some time to make an attempt to locate the problem .

offroadguy56 commented 1 year ago

So Ive tried some things. I had a 2nd instance of webui that I forgot about. I updated it and prompt gallery to the latest. And prompt gallery works as intended.

On the main instance I did something similar, I backed up everything and essentially started with a fresh install. Installed my usual extensions and prompt gallery, and prompt gallery does not want to work. I think there is some extension I have causing the issue. Please give me some time to make an attempt to locate the problem .

More testing, I have no idea what is causing the problem. I have one instance where it was working, then I went to test my main instance. Couldn't figure it out. Went back to the working instance, and that is broken now. Weird.

I've tried a clean install of webui and prompt gallery. Tried with no extensions but itself and with my usual array extensions.

Restart of windows didn't fix it.

Let me know what you think and I'll be ready to assist however you need.

offroadguy56 commented 1 year ago

One more comment, I forgot above. I did fix the port conflict, by doing nothing. I changed it back to http:/localhost:5173 and did not see any errors regarding port binding. Its stayed fixed for both of my SD instances.

dr413677671 commented 1 year ago

@Golgovskiy I could see the log and added a fix accordingly. thx

dr413677671 commented 1 year ago

@offroadguy56 The second instance should failed init extension but it should still work because ui actually points to the first one. The best way to do it is use two webui seperately and use two ports seperatly following the readme.

offroadguy56 commented 1 year ago

@offroadguy56 The second instance should failed init extension but it should still work because ui actually points to the first one. The best way to do it is use two webui seperately and use two ports seperatly following the readme.

Yes I have 2 install folders. Neither webui runs at the same time. Wish I had the vram to run both.

I'm unfamiliar with the log files, where can I find you extension's log? My console looks exactly as OP's.

dr413677671 commented 1 year ago

Logs are same in webui main proc.

dr413677671 commented 1 year ago

Did you try need to set them as different port. PLZ checkout Readme.

offroadguy56 commented 1 year ago

No did not change port. Didn't think it was required as neither of my installs ran at the same time. Will check asap, will have to remote into PC.

offroadguy56 commented 1 year ago

@dr413677671 Here is the log before I make changes to ports described in the readme. pastebin for better formatting: https://pastebin.com/RY0BfHyv venv "C:\Git\Stable Diffusion\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Commit hash: 205991df7826429e6183fc4afbbda3d321c9fee4 Installing requirements for Web UI   Installing requirements for Prompt Gallery           Launching Web UI with arguments: --listen --enable-insecure-extension-access --api --cors-allow-origins http://localhost:5173 No module 'xformers'. Proceeding without it. LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Loading weights [8712e20a5d] from C:\Git\Stable Diffusion\stable-diffusion-webui\models\Stable-diffusion\Anime\[BETTER] Anything-V3.0.ckpt Couldn't find VAE named auto; using None instead Applying cross attention optimization (Doggettx). Textual inversion embeddings loaded(0): Model loaded in 7.8s (0.4s create model, 5.8s load weights). INFO: Started server process [20816] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:5173 (Press CTRL+C to quit) INFO: 127.0.0.1:65092 - "GET / HTTP/1.1" 200 OK Warning: Bad ui setting value: img2img/Mask mode/value: Draw mask; Default value "Inpaint masked" will be used instead. Running on local URL: http://0.0.0.0:7860   To create a public link, setshare=Trueinlaunch(). Skip General_celluloid_online_clean Skip 3dCG [{'name': 'C:\\Users\\paul\\AppData\\Local\\Temp\\00002-2450185931a26ba22ab50ef44ea5d75be8815f93ebffa8c36e.png', 'data': 'file=C:\\Users\\paul\\AppData\\Local\\Temp\\00002-2450185931a26ba22ab50ef44ea5d75be8815f93ebffa8c36e.png', 'is_file': True}] Traceback (most recent call last): File "C:\Git\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 321, in run_predict output = await app.blocks.process_api( File "C:\Git\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api result = await self.call_function(fn_index, inputs, iterator, request) File "C:\Git\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 856, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Git\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Git\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\Git\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run result = context.run(func, *args) File "C:\Git\Stable Diffusion\stable-diffusion-webui\scripts\prompt_gallery.py", line 643, in <lambda> fn=lambda x: image_url(x), File "C:\Git\Stable Diffusion\stable-diffusion-webui\scripts\prompt_gallery.py", line 569, in image_url if type(filedata) != dict and filedata.startswith("data:image/png;base64,"): AttributeError: 'list' object has no attribute 'startswith'

offroadguy56 commented 1 year ago

Good news, I think I have PG at a point where it's no longer broken.

But first, I cannot find """python pg_ip = "%your_extension_ip%" if shared.cmd_opts.listen else 'localhost' pg_port = %your_extension_port% """ in pompt_gallery.py So I'm not sure if I can properly change the extension port number.

So to fix my issue with the extension where clicking the Select button after clicking on an image to send it to the PG tab giving an error... I deleted the prompt_gallery.py file in the \stable-diffusion-webui\scripts folder. Then deleted the PG extension folder. I launched the webui and navigated to the extensions tab, found PG and clicked the Install button. Gave the UI a restart. Went through to normal procedures to generate and select images. And now I no longer get the error.

It seems to be persistent now. I can launch both of my webui's (one will give a fail to bind port error as expected). I can close and open the webui launcher like normal and PG continues to work. I can close one webui and open another and have it launch with no errors, on that 2nd webui PG works as intended. Not entirely sure what has happened, I didn't know there were extension scripts outside of the extension folder until I saw your instructions to change the port for the extension/webui.

dr413677671 commented 1 year ago

@offroadguy56 Glad that it helps!

808mbass commented 1 year ago

Having what looks like a similar issue in the same spot. I press show pics button and an error comes up instead of previews. The only thing that really stands out to me in the webui terminal log is that it's trying to save images to directories to paths with too many backslashes but I have no idea if that's the core issue.

raceback (most recent call last): | 46/360 [00:28<02:29, 2.10it/s] File "B:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict output = await app.get_blocks().process_api( File "B:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1018, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "B:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 956, in postprocess_data prediction_value = block.postprocess(prediction_value) File "B:\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 3742, in postprocess file_path = self.make_temp_copy_if_needed(img) File "B:\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 379, in make_temp_copy_if_needed temp_file_path = self.get_temp_file_path(file_path) File "B:\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 365, in get_temp_file_path file_hash = self.hash_file(file_path) File "B:\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 334, in hash_file with open(file_path, "rb") as f: PermissionError: [Errno 13] Permission denied: 'extensions\PromptGallery-stable-diffusion-webui\assets\preview\3dCG\3d petite 1girl solo pink hair very long'

Susanoo1337 commented 1 year ago

I have the exact same issue as 808mbass

Golgovskiy commented 1 year ago

Might wanna try changing permissions on the repository folder and everything inside?...

For me the issue is fixed. Please duplicate the issue in your name.