stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Stable diffusion model failed to load, exiting

Open smsj19 opened this issue 2 years ago • 25 comments

Is there an existing issue for this?

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

What happened?

it was working fine few hours ago but now it wont lunch Desktop Screenshot 2023 05 01 - 21 30 03 27

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

it should lunch

Commit where the problem happens

You are running torch 1.13.1+cu117. The program is tested to work with torch 2.0.0. To reinstall the desired version, run with commandline flag --reinstall-torch. Beware that this will cause a lot of large files to be downloaded, as well as there are reports of issues with training tab on the latest version. Use --skip-version-check commandline argument to disable this check. ============================================================================== [AddNet] Updating model hashes... 0it [00:00, ?it/s] [AddNet] Updating model hashes... 0it [00:00, ?it/s] ControlNet v1.1.125 ControlNet v1.1.125 [text2prompt] Following databases are available: all-mpnet-base-v2 : danbooru_strict Loading weights [0fc198c490] from C:\Users\PCMasterRace\stable-diffusion-webui\models\Stable-diffusion\AbyssOrangeMix2_hard.safetensors Creating model from config: C:\Users\PCMasterRace\stable-diffusion-webui\configs\v1-inference.yaml LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Loading VAE weights specified in settings: C:\Users\PCMasterRace\stable-diffusion-webui\models\VAE\orangemix.vae.pt Error verifying pickled file from C:\Users\PCMasterRace\stable-diffusion-webui\models\VAE\orangemix.vae.pt: Traceback (most recent call last): File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 132, in load_with_extra check_pt(filename, extra_handler) File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 90, in check_pt unpickler.load() File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 27, in persistent_load return TypedStorage(_internal=True) TypeError: TypedStorage.new() got an unexpected keyword argument '_internal' The file may be malicious, so the program is not going to read it. You can skip this check with --disable-safe-unpickle commandline argument. loading stable diffusion model: AttributeError Traceback (most recent call last): File "C:\Users\PCMasterRace\stable-diffusion-webui\webui.py", line 195, in initialize modules.sd_models.load_model() File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 453, in load_model load_model_weights(sd_model, checkpoint_info, state_dict, timer) File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 338, in load_model_weights sd_vae.load_vae(model, vae_file, vae_source) File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_vae.py", line 145, in load_vae vae_dict_1 = load_vae_dict(vae_file, map_location=shared.weight_load_location) File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_vae.py", line 123, in load_vae_dict vae_ckpt = sd_models.read_state_dict(filename, map_location=map_location) File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 257, in read_state_dict sd = get_state_dict_from_checkpoint(pl_sd) File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 206, in get_state_dict_from_checkpoint pl_sd = pl_sd.pop("state_dict", pl_sd) AttributeError: 'NoneType' object has no attribute 'pop' Stable diffusion model failed to load, exiting Press any key to continue . . .

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

You are running torch 1.13.1+cu117.
The program is tested to work with torch 2.0.0.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
ControlNet v1.1.125
ControlNet v1.1.125
[text2prompt] Following databases are available:
    all-mpnet-base-v2 : danbooru_strict
Loading weights [0fc198c490] from C:\Users\PCMasterRace\stable-diffusion-webui\models\Stable-diffusion\AbyssOrangeMix2_hard.safetensors
Creating model from config: C:\Users\PCMasterRace\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: C:\Users\PCMasterRace\stable-diffusion-webui\models\VAE\orangemix.vae.pt
Error verifying pickled file from C:\Users\PCMasterRace\stable-diffusion-webui\models\VAE\orangemix.vae.pt:
Traceback (most recent call last):
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 132, in load_with_extra
    check_pt(filename, extra_handler)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 90, in check_pt
    unpickler.load()
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 27, in persistent_load
    return TypedStorage(_internal=True)
TypeError: TypedStorage.__new__() got an unexpected keyword argument '_internal'


The file may be malicious, so the program is not going to read it.
You can skip this check with --disable-safe-unpickle commandline argument.


loading stable diffusion model: AttributeError
Traceback (most recent call last):
  File "C:\Users\PCMasterRace\stable-diffusion-webui\webui.py", line 195, in initialize
    modules.sd_models.load_model()
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 453, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 338, in load_model_weights
    sd_vae.load_vae(model, vae_file, vae_source)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_vae.py", line 145, in load_vae
    vae_dict_1 = load_vae_dict(vae_file, map_location=shared.weight_load_location)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_vae.py", line 123, in load_vae_dict
    vae_ckpt = sd_models.read_state_dict(filename, map_location=map_location)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 257, in read_state_dict
    sd = get_state_dict_from_checkpoint(pl_sd)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 206, in get_state_dict_from_checkpoint
    pl_sd = pl_sd.pop("state_dict", pl_sd)
AttributeError: 'NoneType' object has no attribute 'pop'


Stable diffusion model failed to load, exiting
Press any key to continue . . .

List of extensions

controlnet

Console logs

You are running torch 1.13.1+cu117.
The program is tested to work with torch 2.0.0.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
ControlNet v1.1.125
ControlNet v1.1.125
[text2prompt] Following databases are available:
    all-mpnet-base-v2 : danbooru_strict
Loading weights [0fc198c490] from C:\Users\PCMasterRace\stable-diffusion-webui\models\Stable-diffusion\AbyssOrangeMix2_hard.safetensors
Creating model from config: C:\Users\PCMasterRace\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: C:\Users\PCMasterRace\stable-diffusion-webui\models\VAE\orangemix.vae.pt
Error verifying pickled file from C:\Users\PCMasterRace\stable-diffusion-webui\models\VAE\orangemix.vae.pt:
Traceback (most recent call last):
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 132, in load_with_extra
    check_pt(filename, extra_handler)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 90, in check_pt
    unpickler.load()
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\safe.py", line 27, in persistent_load
    return TypedStorage(_internal=True)
TypeError: TypedStorage.__new__() got an unexpected keyword argument '_internal'


The file may be malicious, so the program is not going to read it.
You can skip this check with --disable-safe-unpickle commandline argument.


loading stable diffusion model: AttributeError
Traceback (most recent call last):
  File "C:\Users\PCMasterRace\stable-diffusion-webui\webui.py", line 195, in initialize
    modules.sd_models.load_model()
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 453, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 338, in load_model_weights
    sd_vae.load_vae(model, vae_file, vae_source)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_vae.py", line 145, in load_vae
    vae_dict_1 = load_vae_dict(vae_file, map_location=shared.weight_load_location)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_vae.py", line 123, in load_vae_dict
    vae_ckpt = sd_models.read_state_dict(filename, map_location=map_location)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 257, in read_state_dict
    sd = get_state_dict_from_checkpoint(pl_sd)
  File "C:\Users\PCMasterRace\stable-diffusion-webui\modules\sd_models.py", line 206, in get_state_dict_from_checkpoint
    pl_sd = pl_sd.pop("state_dict", pl_sd)
AttributeError: 'NoneType' object has no attribute 'pop'


Stable diffusion model failed to load, exiting
Press any key to continue . . .

Additional information

No response

smsj19 avatar May 01 '23 18:05 smsj19

Would just like to add to this, I have almost the same issue. SD loads for me but doesn't do anything, when I try to generate anything I get this:

TypeError: Expected state_dict to be dict-like, got <class 'NoneType'>

None of my textual inversions load except for easynegative. The rest are declared as malicious:

The file may be malicious, so the program is not going to read it. You can skip this check with --disable-safe-unpickle commandline argument.

Would love to know how to fix this, it was all working fine an hour ago.

Edit: FIXED. See below (just reinstalled torch).

Nemeblubb avatar May 01 '23 19:05 Nemeblubb

I noticed that the log I get complains about an old version of torch, and an old version of xformers.

EdHerdman avatar May 01 '23 19:05 EdHerdman

I can generate images, but there's no progress bar. Plus, it's not loading my textual inversions. Controlnet openpose errors as well.

TheHiddenOne504 avatar May 01 '23 19:05 TheHiddenOne504

same, is it update problems and it will be fixed in next update or i have to repair it at my own?

Paribas12 avatar May 01 '23 19:05 Paribas12

I deleted the \venv\ folder and I'm redownloading, I'll comment back if that fixes it.

EdHerdman avatar May 01 '23 19:05 EdHerdman

Reinstalling torch did the trick for me. Edit web-ui user with:

set COMMANDLINE_ARGS="--reinstall-torch"

and let it do it's anything. Restart and everything seems back to normal for the time being.

Nemeblubb avatar May 01 '23 19:05 Nemeblubb

Same problem, I'm new to it and don't really know what happened. I wanted to install A1111 and it installed itself today (or I did it myself when visiting A1111 page on github?) then I installed controlnet and have the same error. Should I uninstall anything (and how to do it?)

Also, do someone know where are face models stored? The ones that the program uses when clicking "restore faces". I had my favourite one and don't wanna lose it when uninstalling :(

TruePilny avatar May 01 '23 20:05 TruePilny

Venv has finished re-downloading, I don't see any errors, and it's working again. Seems faster than before, actually!

Details from the System Info extension:

Torch: 2.0.0+cu118 autocast half

Libs: xformers: 0.0.17 accelerate: 0.18.0 transformers: 4.25.1

So re-downloading torch works, or just delete the whole venv folder and let it re-download if you're patient.

(edit: "down" to "finished" in first sentence.)

EdHerdman avatar May 01 '23 20:05 EdHerdman

Same problem, I'm new to it and don't really know what happened. I wanted to install A1111 and it installed itself today (or I did it myself when visiting A1111 page on github?) then I installed controlnet and have the same error. Should I uninstall anything (and how to do it?)

Also, do someone know where are face models stored? The ones that the program uses when clicking "restore faces". I had my favourite one and don't wanna lose it when uninstalling :(

Check out Easy WebUI installer. It should download the face GANs etc. automatically. Other normal checkpoint / safetensor files go in the folder stable-diffusion-webui\models\Stable-diffusion.

EdHerdman avatar May 01 '23 20:05 EdHerdman

Also, do someone know where are face models stored? The ones that the program uses when clicking "restore faces". I had my favourite one and don't wanna lose it when uninstalling :(

Check out Easy WebUI installer. It should download the face GANs etc. automatically. Other normal checkpoint / safetensor files go in the folder stable-diffusion-webui\models\Stable-diffusion.

I meant the face itself, sorry for not being clear. The model I used to generate it was realisticvision v1.3 Is it stored somewhere or how does it work that the program reuses the same person face etc when I click "restore face"? Or it takes the face from the last picture that saved there stable-diffusion-webui\outputs\txt2img-images with date folders?

Btw, I reinstalled the torch and the program works normally. Thanks!

TruePilny avatar May 01 '23 20:05 TruePilny

I resolved the same problem this afternoon adding --disable-safe-unpickle in webui-user.bat

Deckard9999 avatar May 01 '23 20:05 Deckard9999

YES! Everything is back to working based off the comments above.

TheHiddenOne504 avatar May 01 '23 20:05 TheHiddenOne504

Check out Easy WebUI installer. It should download the face GANs etc. automatically. Other normal checkpoint / safetensor files go in the folder stable-diffusion-webui\models\Stable-diffusion.

I meant the face itself, sorry for not being clear. The model I used to generate it was realisticvision v1.3 Is it stored somewhere or how does it work that the program reuses the same person face etc when I click "restore face"? Or it takes the face from the last picture that saved there stable-diffusion-webui\outputs\txt2img-images with date folders?

(Sorry for the OT posts...) Restore faces uses a special model (https://github.com/TencentARC/GFPGAN) to try and detect faces in your image, and then improve them. It's actually not as necessary as it used to be, since most of the modern checkpoints generate pretty good faces now. But it usually doesn't hurt.

Like I said, WebUI Easy Installer will install everything needed automatically for you. And the required models should download automatically the first time you try and use "face restoration" even in regular WebUI. https://github.com/EmpireMediaScience/A1111-Web-UI-Installer

The model should end up being stored in \models\GFPGAN, three files: detection_Resnet50_Final.pth, GFPGANv1.4.pth, parsing_parsenet.pth, and that's it.

EdHerdman avatar May 01 '23 20:05 EdHerdman

--disable-safe-unpickle

Yes same here work but error message for pix2pix : ValueError: too many values to unpack (expected 14)

YUMEORIGINS avatar May 01 '23 22:05 YUMEORIGINS

--disable-safe-unpickle

Yes same here work but error message for pix2pix : ValueError: too many values to unpack (expected 14)

as far as I know (and I know little), pix2pix tab is a deprecated extension, beeing included somewhere in UI, try to disable that extension (and take my words with caution... I am a noob).

Deckard9999 avatar May 01 '23 22:05 Deckard9999

--disable-safe-unpickle

Yes same here work but error message for pix2pix : ValueError: too many values to unpack (expected 14)

as far as I know (and I know little), pix2pix tab is a deprecated extension, beeing included somewhere in UI, try to disable that extension (and take my words with caution... I am a noob).

Ok i don't use it so much so i can remove it thanks !

YUMEORIGINS avatar May 02 '23 00:05 YUMEORIGINS

Venv has down re-downloading, I don't see any errors, and it's working again. Seems faster than before, actually!

Details from the System Info extension:

Torch: 2.0.0+cu118 autocast half

Libs: xformers: 0.0.17 accelerate: 0.18.0 transformers: 4.25.1

So re-downloading torch works, or just delete the whole venv folder and let it re-download if you're patient.

So i did a git pull tonight and it broke it for me aswell, with argument --disable-safe-unpickle it works. And since i have all my models in .safetensor format, the only problem it has its with embeddings and VAE's which it doesnt recognise/see because they are .pt or .ckpt because of the "Error verifying pickled file" error.

I deleted venv folder, redownloaded it and still same problem. I installed torch 2.0.0 +cu118 manually but when i open webui-user.bat it still says torch 1.13.1+cu117 tho i think this isnt the issue at hand (i remember trying to fix this but gave up on upgrading torch version)

Removing those .pt and .ckpt files from VAE and embedding fixes stuff. Any ideas?

KH1R0N avatar May 02 '23 00:05 KH1R0N

I'm not sure what's going on here since everybody got those "potentially unsafe file" warnings, but re-downloading the \venv\ folder fixed it for me and others. That first warning could be a false positive, but if you're getting "potentially unsafe file" warnings on just some of your models even afterwards, they might have a pickle and be unsafe, in which case I'd try running without them. Are you still getting that with just official Stable Diffusion models like 2.1 (768)?

EdHerdman avatar May 02 '23 00:05 EdHerdman

Most likely is a false positive because they are the only ones who are not .safetensors and the only things that i dont have with .safetensors are some VAE's and some Textual Embeddings like negatives, bad-artist, etc I have extension to change .ckpt models to .safetensors but im not aware of ways to change VAE's and Embeddings to .safetensors. Might be a good thing for the future aswell.

KH1R0N avatar May 02 '23 00:05 KH1R0N

I had a glance at that log and it's complaining about your Torch version. Deleting \venv\ may be overkill but it will fix that problem :)

EdHerdman avatar May 02 '23 00:05 EdHerdman

deleted venv and ran sd like normal, took longer than just reinstalling torch but it did the job

quadrexxx avatar May 02 '23 00:05 quadrexxx

For AMD GPU reverted to previous version.

KH1R0N avatar May 02 '23 04:05 KH1R0N

This should also be resolved by https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/5ab7f213bec2f816f9c5644becb32eb72c8ffb89

You should now be able to resolve the issue by either upgrading torch via --reinstall-torch or upgrading to https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/5ab7f213bec2f816f9c5644becb32eb72c8ffb89 The change was pushed to master, so you can just update as normal (e.g. git pull --ff-only)

evanjs avatar May 02 '23 14:05 evanjs

This should also be resolved by 5ab7f21

You should now be able to resolve the issue by either upgrading torch via --reinstall-torch or upgrading to 5ab7f21 The change was pushed to master, so you can just update as normal (e.g. git pull --ff-only)

I see there is a comment with "switch to torch 2.0.0 (except for AMD GPUs)". Last night i had this problem with torch and got 2.0.0...Should i reinstall the older version now? It doesnt seem to like the new 2.0.0 on my AMD GPU because the resolution i used to do before doesnt even compare to the errors i get now and i tried a lot of commands in webui-user.bat

FIXED on AMD GPU by uninstalling 2.0.0 and reinstalling older version.

KH1R0N avatar May 02 '23 21:05 KH1R0N

I'm using 5ab7f21, tried reinstalling torch 2.0.0, also tried deleting the venv folder and reinstall... Still have the problem. I'm running on NV GPU. Brain hurts...

codynhanpham avatar May 08 '23 07:05 codynhanpham

I'm using 5ab7f21, tried reinstalling torch 2.0.0, also tried deleting the venv folder and reinstall... Still have the problem. I'm running on NV GPU. Brain hurts...

same error

DKPlugins avatar May 10 '23 07:05 DKPlugins

Duplicate of https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/9986

catboxanon avatar Aug 26 '23 11:08 catboxanon