Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: RuntimeError("Cannot add middleware after an application has started") #10742

Closed
1 task done
ploffster opened this issue May 26, 2023 · 2 comments
Closed
1 task done
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@ploffster
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

Was trying to get LoRAs running, ended up messing up my entire webui. Tried a bunch of stuff I found on different forums, nothing helped.

Steps to reproduce the problem

  1. Go to the master SD folder
  2. Press "webui-user.bat"
  3. Get the error after waiting for everything to load

What should have happened?

Normally it should just end with a webui link, but instead it spits out this error.

Commit where the problem happens

(literally says so)

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

no

List of extensions

gif2gif
openpose-editor
sd_dreambooth_extension
sd-webui-controlnet

Console logs

venv "E:\Stable Diffusion\stable-diffusion-webui-master\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: <none>
Installing requirements for Web UI

If submitting an issue on github, please provide the full startup log for debugging purposes.

Initializing Dreambooth
Dreambooth revision: 926ae204ef5de17efca2059c334b6098492a0641
Successfully installed accelerate-0.18.0 gitpython-3.1.31 requests-2.31.0 transformers-4.26.1

Does your project take forever to startup?
Repetitive dependency installation may be the reason.
Automatic1111's base project sets strict requirements on outdated dependencies.
If an extension is using a newer version, the dependency is uninstalled and reinstalled twice every startup.

# Your version of xformers is 0.0.14.dev0.
# xformers >= 0.0.17.dev is required to be available on the Dreambooth tab.
# Torch 1 wheels of xformers >= 0.0.17.dev are no longer available on PyPI,
# but you can manually download them by going to:
https://github.com/facebookresearch/xformers/actions
# Click on the most recent action tagged with a release (middle column).
# Select a download based on your environment.
# Unzip your download
# Activate your venv and install the wheel: (from A1111 project root)
cd venv/Scripts
activate
pip install {REPLACE WITH PATH TO YOUR UNZIPPED .whl file}
# Then restart your project.
[!] xformers version 0.0.14.dev0 installed.
[!] torch version 1.12.1+cu113 installed.
[!] torchvision version 0.13.1+cu113 installed.
[+] accelerate version 0.18.0 installed.
[+] diffusers version 0.14.0 installed.
[+] transformers version 4.26.1 installed.
[+] bitsandbytes version 0.35.4 installed.

#######################################################################################################
#                                       LIBRARY ISSUE DETECTED                                        #
#######################################################################################################
#
# torch is below the required 1.13.1+cu116 version.
# torchvision is below the required 0.14.1+cu116 version.
#
# Dreambooth may not work properly.
#
# TROUBLESHOOTING
# 1. Fully restart your project (not just the webpage)
# 2. Update your A1111 project and extensions
# 3. Dreambooth requirements should have installed automatically, but you can manually install them
#    by running the following 4 commands from the A1111 project root:
cd venv/Scripts
activate
cd ../..
pip install -r ./extensions/sd_dreambooth_extension/requirements.txt
#######################################################################################################

Launching Web UI with arguments: --xformers
ControlNet v1.1.196
ControlNet v1.1.196
Error loading script: xyz_grid_support.py
Traceback (most recent call last):
  File "E:\Stable Diffusion\stable-diffusion-webui-master\modules\scripts.py", line 205, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "E:\Stable Diffusion\stable-diffusion-webui-master\modules\script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "E:\Stable Diffusion\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\xyz_grid_support.py", line 443, in <module>
    run()
  File "E:\Stable Diffusion\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\xyz_grid_support.py", line 439, in run
    add_axis_options(xyz_grid)
  File "E:\Stable Diffusion\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\xyz_grid_support.py", line 421, in add_axis_options
    xyz_grid.AxisOption("[ControlNet] Enabled", identity, apply_field("control_net_enabled"), confirm=confirm(bool_), choices=choices_bool),
TypeError: AxisOption.__new__() got an unexpected keyword argument 'choices'

LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading weights [c35782bad8] from E:\Stable Diffusion\stable-diffusion-webui-master\models\Stable-diffusion\realisticVisionV13_v13.safetensors
Applying xformers cross attention optimization.
Error loading embedding Toru8pWavenChibi_wavenchibiV10b.pt:
Traceback (most recent call last):
  File "E:\Stable Diffusion\stable-diffusion-webui-master\modules\textual_inversion\textual_inversion.py", line 203, in load_from_dir
    self.load_from_file(fullfn, fn)
  File "E:\Stable Diffusion\stable-diffusion-webui-master\modules\textual_inversion\textual_inversion.py", line 176, in load_from_file
    raise Exception(f"Couldn't identify {filename} as neither textual inversion embedding nor diffuser concept.")
Exception: Couldn't identify Toru8pWavenChibi_wavenchibiV10b.pt as neither textual inversion embedding nor diffuser concept.

Textual inversion embeddings loaded(3): AS-Young-neg, awaitingtongue, happy512
Textual inversion embeddings skipped(2): CarHelper, cartoonish_doll
Model loaded in 3.2s (0.4s create model, 1.5s load weights).
Create LRU cache (max_size=16) for preprocessor results.
Create LRU cache (max_size=16) for preprocessor results.
CUDA SETUP: Loading binary E:\Stable Diffusion\stable-diffusion-webui-master\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cudaall.dll...
Warning: Bad ui setting value: txt2img/Resize Mode/value: Scale to Fit (Inner Fit); Default value "Crop and Resize" will be used instead.
Warning: Bad ui setting value: img2img/Resize Mode/value: Scale to Fit (Inner Fit); Default value "Crop and Resize" will be used instead.
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 "E:\Stable Diffusion\stable-diffusion-webui-master\launch.py", line 308, in <module>
    start()
  File "E:\Stable Diffusion\stable-diffusion-webui-master\launch.py", line 303, in start
    webui.webui()
  File "E:\Stable Diffusion\stable-diffusion-webui-master\webui.py", line 182, in webui
    app.add_middleware(GZipMiddleware, minimum_size=1000)
  File "E:\Stable Diffusion\stable-diffusion-webui-master\venv\lib\site-packages\starlette\applications.py", line 139, 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

@ploffster ploffster added the bug-report Report of a bug, yet to be confirmed label May 26, 2023
@missionfloyd
Copy link
Collaborator

missionfloyd commented May 26, 2023

You seem to be using an old version (this was fixed months ago). Update with git pull or download a newer version here or here.

Was trying to get LoRAs running,

You don't need to do anything special, just put them in models\Lora.

@ploffster
Copy link
Author

yeah, i haven't run sd in a couple of months. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

2 participants