AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: cannot add middleware after an application has started #7939

Open ziilch opened 1 year ago

ziilch commented 1 year ago

Is there an existing issue for this?

What happened?

Hey there, I've had limited experience with python and installing stable diffusion locally in the early days by doing it all manually. Was interested in getting back into it and testing dreambooth with a1111 by trying the [v1.0.0-pre] automatic batch version because I had errors the first time doing it manually.

I ran the [v1.0.0-pre] run.bat file. At first I didn't have the right checkpoints in place. I then got the check points, labelled them model.chkpt as instructed and that seemed to have worked and got past the initial error I was encountering.

Just fyi I'm running windows 10 64bit on a custom built gaming pc with an amd cpu and nvidea 2070 Super.

Now I'm stuck at this point, heres the entire command line thread:

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Commit hash: 48a15821de768fea76e66f26df83df3fddf18f4b Installing requirements for Web UI Launching Web UI with arguments: No module 'xformers'. Proceeding without it. LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Loading weights [fe4efff1e1] from C:\Users\username\Downloads\sd.webui\webui\model.ckpt Applying cross attention optimization (Doggettx). Textual inversion embeddings loaded(0): Model loaded in 5.1s (0.5s create model, 2.8s load weights). Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Traceback (most recent call last): File "C:\Users\username\Downloads\sd.webui\webui\launch.py", line 325, in start() File "C:\Users\username\Downloads\sd.webui\webui\launch.py", line 320, in start webui.webui() File "C:\Users\username\Downloads\sd.webui\webui\webui.py", line 224, in webui app.add_middleware(GZipMiddleware, minimum_size=1000) File "C:\Users\username\Downloads\sd.webui\system\python\lib\site-packages\starlette\applications.py", line 135, in add_middleware raise RuntimeError("Cannot add middleware after an application has started") RuntimeError: Cannot add middleware after an application has started Press any key to continue . . .

Steps to reproduce the problem

  1. Install stable diffusion webui by running run.bat
  2. Install checkpoint files after the fact from the initial attempt
  3. engage run.bat again

What should have happened?

I should have been able to use stable diffusion web ui

Commit where the problem happens

I dunno

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

no

List of extensions

no

Console logs

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 48a15821de768fea76e66f26df83df3fddf18f4b
Installing requirements for Web UI
Launching Web UI with arguments:
No module 'xformers'. Proceeding without it.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading weights [fe4efff1e1] from C:\Users\username\Downloads\sd.webui\webui\model.ckpt
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(0):
Model loaded in 5.1s (0.5s create model, 2.8s load weights).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Traceback (most recent call last):
  File "C:\Users\username\Downloads\sd.webui\webui\launch.py", line 325, in <module>
    start()
  File "C:\Users\username\Downloads\sd.webui\webui\launch.py", line 320, in start
    webui.webui()
  File "C:\Users\username\Downloads\sd.webui\webui\webui.py", line 224, in webui
    app.add_middleware(GZipMiddleware, minimum_size=1000)
  File "C:\Users\username\Downloads\sd.webui\system\python\lib\site-packages\starlette\applications.py", line 135, in add_middleware
    raise RuntimeError("Cannot add middleware after an application has started")
RuntimeError: Cannot add middleware after an application has started
Press any key to continue . . .

Additional information

No response

ClashSAN commented 1 year ago

refer to this guide for a fix. https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/7749

if you see what version is uninstalled, you can edit the post to add the version of fastapi and starlite.

subcreation commented 1 year ago

I followed those instruction. I get the same error regardless