AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Vae not loaded at startup if selected, it is loaded after first generation. #10355

Open Dasor92 opened 1 year ago

Dasor92 commented 1 year ago

Is there an existing issue for this?

What happened?

When you start the application the VAE selected is not loaded. it says: Couldn't find VAE named vae-ft-mse-840000-ema-pruned.safetensors; using None instead It is loaded after the first image generation.

Steps to reproduce the problem

  1. Open Webui
  2. Select a VAE
  3. Restart Webui
  4. Observe that the VAE is not loaded
  5. Try generating an image
  6. The VAE is now loaded

What should have happened?

VAE should load at startup

Commit where the problem happens

b08500c

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--no-half-vae

List of extensions

No

Console logs

Creating model from config: D:\Programmi\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Couldn't find VAE named vae-ft-mse-840000-ema-pruned.safetensors; using None instead
Applying scaled dot product cross attention optimization.

Additional information

No response

AcidChristLab commented 1 year ago

Me too

Dasor92 commented 1 year ago

Addendum: Loras too have the same problem, loaded after first generation.

OedoSoldier commented 1 year ago

Same here, it appeared after git pull

ashleykleynhans commented 1 year ago

Happens with both the .ckpt and .safetensors versions of the VAE.

Alyndiar commented 1 year ago

For me, VAE never seems to load. During startup, I get this error:

Couldn't find VAE named AnythingV5.vae.pt; using None instead

Tried multiple VAEs, .vae.pt or .safetensors, no difference. The only way I get a functionnal VAE is by selecting None, then selecting the VAE I want. I must do this everytime I restart.

chouti commented 1 year ago

Same here.

Sniper199999 commented 1 year ago

I removed/deleted dreambooth extension from extensions folder and did pip uninstall Pillow, gitpython, transformers, google-auth-oauthlib, fastapi. This fixed my VAE loading issue. I did these 2 steps together, so do not really know which of these fixed the issue.

Edit: reinstalled dreambooth again and the Missing VAE issue came back. For now, dirty solution is by selecting None and selecting VAE again in the UI.

nyqui commented 1 year ago

This happens because VAE is attempted to load during modules.scripts.load_scripts() in initialize_rest in webui.py, (line 274)

but since modules.sd_vae.refresh_vae_list() hasn't run yet (line 284), vae_list is empty at this stage, leading to VAE not loading at startup but able to be loaded once the UI has come up.

Not sure why VAEs would be attempted to load during the script loading stage, but the simplest workaround is running modules.sd_vae.refresh_vae_list() before modules.scripts.load_scripts(). But I'm not sure if it will have any repercussions.

Another more tame workaround would be to modify the function resolve_vae in modules/sd_vae.py, so that it will first check whether vae_list is empty, then run refresh_vae_list() if true.

But more importantly... if this problem is caused by scripts/extensions outside of this repo, is it appropriate to apply the "fix" here?

nyqui commented 1 year ago

Confirmed problems when space-nuko/a1111-stable-diffusion-webui-vram-estimator AND/OR d8ahazard/sd_dreambooth_extension installed.

OldManSimmer62 commented 1 year ago

I have this too. My Version is up to date and I have neither Dreambooth or vraam-estminator installed. Couldn't find VAE named vae-ft-mse-840000-ema-pruned.ckpt; using None instead

OedoSoldier commented 1 year ago

Can confirm https://github.com/7eu7d7/DreamArtist-stable-diffusion is also causing the error (I installed it a long time ago and didn't delete it)

ParticleDog commented 1 year ago

me too

Losquit commented 1 year ago

Same here, without 2 extensions mentioned above. So how to fix this?

RaXorX commented 1 year ago

Having this issue in the recent build as well. Default VAE was loading just fine and then it just suddenly stopped loading. Even after generating first image doesn't do anything. I have to manually load it myself.