AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
140.63k stars 26.61k forks source link

[Bug]: using hashtags in prompts appear to generate broken links for image previews #5470

Closed sleeplessinva closed 1 year ago

sleeplessinva commented 1 year ago

Is there an existing issue for this?

What happened?

In trying out different prompts, I used hashtags, i.e. "#freepalestine" as the single input for the prompt in the web gui interface. Along with this prompt I also included other configurations which is provided below:

prompt: #freepalestine neg prompt: cartoon, 3d, {{disfigured}},{{bad art}},{{deformed}},{{poorly drawn}},{{extra limbs}},{{extra eyes}},{{extra nose}},{{extra mouth}},{{extra eye brows}},{{extra chin},{{extra lips}},{{extra fingers}},{{extra hair}},{{hairy}},{{bald}},{{large forehead}}, {[big forehead}},{{gap teeth}},{{gap tooth}}, {{symmetrical face}},{{big lips}},{{big ears}},{{big hands}},{{big wrists}},{{big nostrils}},{{chicken feet}},{{chicken legs}},{{horse legs}},{{horse feet}},{{pig legs}},{{pig feet}},{{duck lips}},{{duck feet}},{{webbed foot}},{{webbed feet}},tree,leaves,{{green}},{{long neck}},{{belly button}},belly button, extra hand, dark skin, light skin, yellow skin, {{woman}}, ugly smile, sampling method: DDIM width: 768 height: 1024 restore faces: yes tiling: no highres fix: no cfg scale: 23.5 seed: 1246421984 extra: yes

I submitted the task to generate an image and when it finished it returned a broken link in the GUI. When I went to look at the console, it dumped out a lot of errors and one of the last lines said the following:

RuntimeError: File at path C:\env\stable-diffusion-webui\outputs\txt2img-grids\xy_grid-0548-1246421985- does not exist.

I went to that directory to see if there were any files that resembled that pattern and sure enough there was a file that matched the name, but it was actually "xy_grid-0548-1246421985-#freepalestine.png". I'm guessing that because the filename has the "#" character but and that is not being properly being handled.

Steps to reproduce the problem

prompt: #freepalestine neg prompt: cartoon, 3d, {{disfigured}},{{bad art}},{{deformed}},{{poorly drawn}},{{extra limbs}},{{extra eyes}},{{extra nose}},{{extra mouth}},{{extra eye brows}},{{extra chin},{{extra lips}},{{extra fingers}},{{extra hair}},{{hairy}},{{bald}},{{large forehead}}, {[big forehead}},{{gap teeth}},{{gap tooth}}, {{symmetrical face}},{{big lips}},{{big ears}},{{big hands}},{{big wrists}},{{big nostrils}},{{chicken feet}},{{chicken legs}},{{horse legs}},{{horse feet}},{{pig legs}},{{pig feet}},{{duck lips}},{{duck feet}},{{webbed foot}},{{webbed feet}},tree,leaves,{{green}},{{long neck}},{{belly button}},belly button, extra hand, dark skin, light skin, yellow skin, {{woman}}, ugly smile, sampling method: DDIM width: 768 height: 1024 restore faces: yes tiling: no highres fix: no cfg scale: 23.5 seed: 1246421984 extra: yes

What should have happened?

The webui should have displayed the image as normal. However, because the file being referenced had a "#" character, it wasn't being processed properly and the browser is treating it like a broken/invalid link because it was unable to reference the file.

Commit where the problem happens

8504db51704d238cc7616f6bf59eb049d3eb101d

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

I am manually launching the launch.py file from the command line in my virtual environment.

python launch.py

I am using python 3.10.8.

Additional information, context and logs

Running DDIM Sampling with 36 timesteps DDIM Sampler: 100%|████████████████████████████████████████████████████████████████████| 36/36 [00:09<00:00, 3.90it/s] Total progress: 36it [00:10, 3.55it/s] ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\responses.py", line 331, in call stat_result = await anyio.to_thread.run_sync(os.stat, self.path) File "C:\env\stable-diffusion-webui\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\env\stable-diffusion-webui\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\env\stable-diffusion-webui\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\env\stable-diffusion-webui\outputs\txt2img-grids\xy_grid-0548-1246421985-'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\env\stable-diffusion-webui\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi result = await app( # type: ignore[func-returns-value] File "C:\env\stable-diffusion-webui\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in call return await self.app(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\fastapi\applications.py", line 270, in call await super().call(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\applications.py", line 124, in call await self.middleware_stack(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\middleware\errors.py", line 184, in call raise exc File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\middleware\gzip.py", line 24, in call await responder(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\middleware\gzip.py", line 44, in call await self.app(scope, receive, self.send_with_gzip) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\middleware\exceptions.py", line 79, in call raise exc File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\middleware\exceptions.py", line 68, in call await self.app(scope, receive, sender) File "C:\env\stable-diffusion-webui\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call raise e File "C:\env\stable-diffusion-webui\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\routing.py", line 706, in call await route.handle(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\routing.py", line 276, in handle await self.app(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\routing.py", line 69, in app await response(scope, receive, send) File "C:\env\stable-diffusion-webui\lib\site-packages\starlette\responses.py", line 334, in call raise RuntimeError(f"File at path {self.path} does not exist.") RuntimeError: File at path C:\env\stable-diffusion-webui\outputs\txt2img-grids\xy_grid-0548-1246421985- does not exist. X/Y plot will create 1 images on a 1x1 grid. (Total steps to process: 35)

sleeplessinva commented 1 year ago

The overall process does seem to generate the file at the specified location but the part that is passing the filename is not handling the presence of the "#" character properly.

ClashSAN commented 1 year ago

it's reported here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5271

see if \# syntax will work, it works for actually adding brackets to your prompt, not as the weights.

also there seems to be an issue with the word "painting" https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5346 due to special inpainting file name trigger or some reason.

ClashSAN commented 1 year ago

@sleeplessinva the {{disfigured}},{{bad art}} syntax will not do anything here, you should use ((disfigured)),((bad art)) the {} syntax is from novelai users

sleeplessinva commented 1 year ago

Ahhh, thanks for the clarification on the negative prompts. Will try that out!

sleeplessinva commented 1 year ago

it's reported here: #5271

see if \# syntax will work, it works for actually adding brackets to your prompt, not as the weights.

also there seems to be an issue with the word "painting" #5346 due to special inpainting file name trigger or some reason.

@ClashSAN as an aside, are there some "key" or "reserved" words that we should not use or stay away from? thanks in advance. :)