AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: (Solved) using "--gradio-debug" "breaks" the API (if intentional please print a message in the terminal or update the wiki) #9824

Closed Rayregula closed 1 year ago

Rayregula commented 1 year ago

Is there an existing issue for this?

What happened?

When using the --gradio-debug command line arg the api loses a few important endpoints. Still allows for image generation but the progress endpoint (used internally for the progress bar) does not work

Steps to reproduce the problem

  1. Start ui with flag --gradio-debug.
  2. Open webui in browser.
  3. Select "Generate"
  4. Observe 404 errors in chrome console and no progress bar

OR

  1. Start ui with flag --gradio-debug.
  2. Open /docs in browser.
  3. Observe endpoints such as /sdapi/v1/progress and /internal/progress missing from the docs

What should have happened?

This may be less of a bug and more of a lack of clarity in the docs:

API endpoints should still be present (unless it's a feature for debugging? But should specify so) Progress bar should still function (it seems to directly call the api)

In the docs the --gradio-debug option description just says it passes the option to debug flag to gradio, which I thought would enable some form of error messages that gradio may be suppressing normally.

After looking at some documentation for gradio it sounds like it blocks the main thread from running so could make sense that would limit some functions. But that is not gradio's job to warn against as the API is an implementation of this repo not gradio and I would not expect it cause issue especially when I use the flag in the hopes of solving a problem in the first place.

Commit where the problem happens

22bcc7be

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

`--listen` `--use-cpu all` `--no-half` `--skip-version-check` `--enable-insecure-extension-access` `--api` `--gradio-auth` `--ckpt-dir` `--hypernetwork-dir` `--lora-dir` `--embeddings-dir`

List of extensions

Extension URL Version Update
sd-dynamic-prompts https://github.com/adieyal/sd-dynamic-prompts.git a53adac9 (Sun Apr 23 13:28:49 2023) latest
sd-webui-controlnet https://github.com/Mikubill/sd-webui-controlnet.git 68e4acf7 (Sat Apr 22 06:52:32 2023) behind

Console logs

./start-sd-shared.sh 

/home/generator/.local/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
  warn(f"Failed to load image Python extension: {e}")
Warning: caught exception 'Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx', memory monitor disabled
No module 'xformers'. Proceeding without it.
Loading weights [d1406b31c0] from /illuminuttyDiffusion_v111.safetensors
Creating model from config: /illuminuttyDiffusion_v111.yaml
LatentDiffusion: Running in v-prediction mode
DiffusionWrapper has 865.91 M params.
Applying cross attention optimization (InvokeAI).
No Image data blocks found.
No Image data blocks found.
No Image data blocks found.
No Image data blocks found.
No Image data blocks found.
No Image data blocks found.
No Image data blocks found.
Textual inversion embeddings loaded(3): illuminutty_nartfixer, illuminutty_nrealfixer, illuminutty_nfixer
Textual inversion embeddings skipped(8): style_midjourney-style, style_concept-art, style_fractal-flame, style_dr-strange, style_nebula, style_kojima-ayami, style_gta5-artwork, CharTurner
Model loaded in 8.9s (create model: 0.5s, apply weights to model: 1.0s, load textual inversion embeddings: 7.2s).
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 18.0s (import torch: 1.6s, import gradio: 1.3s, import ldm: 0.5s, other imports: 1.0s, setup codeformer: 0.1s, load scripts: 1.3s, load SD checkpoint: 9.0s, create ui: 2.9s, gradio launch: 0.1s, scripts app_started_callback: 0.2s).


### Additional information

issue template askes which platform is used to access the ui but not what platform it is running on?
I feel like that would be important to know for certain issues

I am on Linux

Issue occurred without any extensions installed as well.

This is no longer an issue for me now that I know that attempting to debug the issue with the `--gradio-debug` flag was what caused it in the first place. Mainly just making this so I can refer back to it as I have been jumping in to issue threads similar to mine hoping that it was the cause.

I do not need the `--gradio-debug` flag to function differently then it does at the moment. Though if it is a bug then I will happily keep this issue open.
Rayregula commented 1 year ago

I'll keep this open for the day and see if anyone else can replicate this behavior.

I had removed and re-cloned this repo during troubleshooting but then had launched it with the --gradio-debug since I was debugging so the issue never went away for me.

Just making sure it's not a ghost in the machine in my situation.

ClashSAN commented 1 year ago

Thanks, yes it seems to do more functionally than print errors, The extension for stable horde would request users to launch with this flag, so you can run with no checkpoint. Also the token counter isn't in operation.

It is not in documention, do you know the PR adding this to link to it?

akx commented 1 year ago

There's no good reason I can think of to use --gradio-debug anyway.