AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: unsupported operand type(s) for |: 'type' and 'NoneType' On Launch #4272

Closed Ladypoly closed 1 year ago

Ladypoly commented 1 year ago

Is there an existing issue for this?

What happened?

When launching it returns an error when everything loaded. Everything is loading as usual but after Running on local URL: http://127.0.0.1:7860 To create a public link, setshare=Trueinlaunch(). It throws an error

Steps to reproduce the problem

  1. Start webui-user.bat

What should have happened?

Normal launching

Commit where the problem happens

81973091bc07c706d056809d89221bafcd01b38a

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

"--ckpt-dir=D:\StableDiffusion/SD_Models" "--vae-path=D:\StableDiffusion/SD_Models/ft-MSE/vae-ft-mse-840000-ema-pruned.vae.pt" --api --xformers --autolaunch

Additional information, context and logs

`venv "C:\Users\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] Commit hash: 81973091bc07c706d056809d89221bafcd01b38a Installing requirements for Web UI Launching Web UI with arguments: --ckpt-dir=D:\StableDiffusion/SD_Models --vae-path=D:\StableDiffusion/SD_Models/ft-MSE/vae-ft-mse-840000-ema-pruned.vae.pt --api --autolaunch LatentInpaintDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.54 M params. making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels Loading weights [3e16efc8] from D:\StableDiffusion\SD_Models\sd-v1-5-inpainting.ckpt Global Step: 440000 Loading VAE weights from: D:\StableDiffusion/SD_Models/ft-MSE/vae-ft-mse-840000-ema-pruned.vae.pt Applying cross attention optimization (Doggettx). Model loaded. Loaded a total of 0 textual inversion embeddings. Embeddings: 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\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\launch.py", line 252, in start() File "C:\Users\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\launch.py", line 247, in start webui.webui() File "C:\Users\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\webui.py", line 153, in webui create_api(app) File "C:\Users\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\webui.py", line 97, in create_api from modules.api.api import Api File "C:\Users\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\modules\api\api.py", line 9, in from modules.api.models import * File "C:\Users\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\modules\api\models.py", line 199, in class UpscalerItem(BaseModel): File "C:\Users\EH\Desktop\AUTOMATIC1111 _SD\stable-diffusion-webui\modules\api\models.py", line 201, in UpscalerItem model_name: str | None = Field(title="Model Name") TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'`

aliencaocao commented 1 year ago

| should only work on Python 3.10+ You can remove the | None, functionally everything will work just as fine. See https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/4311 on how to fix.

Ladypoly commented 1 year ago

Thats really strange since I have python 3.10.6 installed but only the console from the web ui shows 3.9.5. And it worked until today perfectly fine.

aliencaocao commented 1 year ago

The fact that the console shows 3,9.5 means you are using 3.9.5. You probably didn't activate venv or install it properly, or your PATH is wrongly set.

It works until today because prior to today this block of code does not exist. It was newly committed.

Ladypoly commented 1 year ago

Gosh this is why I hate python so much. I uninstalled every bit of it and restarted, then i installed 3.10.6 fresh and added the PATH correctly. But somehow it still uses 3.9.5 and I have absolutely no Idea where it gets it from.

aliencaocao commented 1 year ago

https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/4311 Made a PR to fix

karinehasan234 commented 1 month ago

You need to add a model(sd 1.5 models etc.) to the models section before running this.