AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Gradio, generate button in img2img tab not responding #11022

Open AelecTi opened 1 year ago

AelecTi commented 1 year ago

Is there an existing issue for this?

What happened?

Using WebUI in kaggle.

Go to i2i, upload a picture, set up the parameters and click "generate". The UI will show "Waiting" but in the terminal nothing will show up. After a while (10~30s) the generate button will be back but won't responds to clicks anymore. Even worse, the interface will become unaccessable after these steps. Restarting the UI multiple times seems to have a chance to fix this problem for one or two i2i generations.

Steps to reproduce the problem

  1. Start an instance in kaggle gradio environment.
  2. Do the steps metioned above.

What should have happened?

Just like running in the local environment.

Commit where the problem happens

b6af0a3

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Linux

What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension-access

List of extensions

ultimate-upscale-for-automatic1111 sd-webui-controlnet

Console logs

/kaggle/working/content/stable-diffusion-webui
Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
Version: v1.3.1
Commit hash: b6af0a3809ea869fb180633f9affcae4b199ffcf
Installing requirements

Installing sd-webui-infinite-image-browsing requirement: python-dotenv
Installing sd-webui-infinite-image-browsing requirement: Pillow

Launching Web UI with arguments: --share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension-access
2023-06-04 18:34:14,814 - ControlNet - INFO - ControlNet v1.1.215
2023-06-04 18:34:15,072 - ControlNet - INFO - ControlNet v1.1.215
Loading weights [xxx] from /kaggle/working/content/stable-diffusion-webui/models/Stable-diffusion/xxx.safetensors
Creating model from config: /kaggle/working/content/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://xxxxx.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
Startup time: 19.4s (import torch: 6.3s, import gradio: 1.3s, import ldm: 1.3s, other imports: 0.8s, setup codeformer: 0.1s, load scripts: 3.9s, create ui: 1.3s, gradio launch: 4.2s).
Applying optimization: xformers... done.
Model loaded in 10.4s (load weights from disk: 1.6s, create model: 1.1s, apply weights to model: 3.0s, apply half(): 1.3s, load VAE: 2.7s, move model to device: 0.6s).

Additional information

No response

Enferlain commented 1 year ago

Same thing. I was on this version https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/22bcc7be428c94e9408f589966c2040187245d81

Then I updated to dev but it broke other stuff for me so I didn't have time to test if it was fully fixed. Then I tried master branch, same glitch with some other stuff so couldn't stay.

Now I'm back to this because it was my last confirmed setup (google drive with colab) but this issue makes it unusable. You have to refresh after every try, and even then 80% of the time it breaks on first click.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/15861396/b92a3ab8-068e-4daa-ba04-e4bdffdc2301

python: 3.10.11  •  torch: 2.0.1+cu118  •  xformers: 0.0.20  •  gradio: 3.23.0  •  commit: 22bcc7be

Is there a commit or update that has since addressed this? Maybe the latest gradio version?

Tried diff browser, didn't help. Gonna update gradio to 3.33.1.

Updating to 3.33.1 turns my entire ui into white and functionality becomes too weird, so that's not a proper solution for my setup sadly.

ultimaKV commented 1 year ago

@AelecTi really similar to my case here https://github.com/vladmandic/automatic/issues/833#issuecomment-1561204667

Vlad explained what caused the problem and a fix. It works for me on his SD fork. (but haven't try on A1111 sd yet)

AelecTi commented 1 year ago

@AelecTi really similar to my case here vladmandic#833 (comment)

Vlad explained what caused the problem and a fix. It works for me on his SD fork. (but haven't try on A1111 sd yet)

Thanks for your reply! I can't find the parameter --disable-queue. I will try --no-gradio-queue instead.

Enferlain commented 1 year ago

One thing to take note of is camenduru said that websocket is required for colab instances so it might not work out well (unless something changed since then)

image

not sure about kaggle tho

AelecTi commented 1 year ago

The situation gets better with parameter --no-gradio-queue. However, when playing around in i2i tabs, there is still a big chance the entire webui stop responding, the gradio interface will just loads forever. I can only restart the whole ui from the online terminal.

It seems when I upload some picture and immediately click something else, 9 in10 times the page will stop responding. img2img is basicly unusable as I have to pray before every generation attempt.

ultimaKV commented 1 year ago

@AelecTi I'm not really sure what's going on exactly but you can try Vlad's SD fork for now. (and try --disable-queue) or you can go back to the stable built of A1111 like a9eef1f by using git checkout command

For maximum speed in a9eef1f, install torch 2.0 and use SDP cross optimization >> https://www.youtube.com/watch?v=JluH7Wc-EyA (do not use -xformers, just enable only sdp by add --opt-sdp-attention ) (also edit accelerate version in 2 txt. look it at vdo description) and manually install ToMe (optional)

Even if this build was like 3 months ago, its' speed is still a beast by torch 2.0 + sdp