Skip to content

VAE load error #3043

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

Open
slap1996 opened this issue Apr 25, 2025 · 0 comments
Open

VAE load error #3043

slap1996 opened this issue Apr 25, 2025 · 0 comments

Comments

@slap1996
Copy link

I TRIED TO LOAD THIS VAE "kl-f8-anime2.ckpt" AND SHOW THIS ERROR:

Loading VAE weights specified in settings: /content/gdrive/MyDrive/sd/stable-diffusion-webui/models/VAE/kl-f8-anime2.ckpt
changing setting sd_vae to kl-f8-anime2.ckpt: UnpicklingError
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/options.py", line 165, in set
option.onchange()
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 14, in f
res = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/initialize_util.py", line 182, in
shared.opts.onchange("sd_vae", wrap_queued_call(lambda: sd_vae.reload_vae_weights()), call=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_vae.py", line 273, in reload_vae_weights
load_vae(sd_model, vae_file, vae_source)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_vae.py", line 211, in load_vae
vae_dict_1 = load_vae_dict(vae_file, map_location=shared.weight_load_location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_vae.py", line 189, in load_vae_dict
vae_ckpt = sd_models.read_state_dict(filename, map_location=map_location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_models.py", line 323, in read_state_dict
pl_sd = torch.load(checkpoint_file, map_location=map_location or shared.weight_load_location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/safe.py", line 108, in load
return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/safe.py", line 156, in load_with_extra
return unsafe_torch_load(filename, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/torch/serialization.py", line 1470, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) In PyTorch 2.6, we changed the default value of the weights_only argument in torch.load from False to True. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with weights_only=True please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL pytorch_lightning.callbacks.model_checkpoint.ModelCheckpoint was not an allowed global by default. Please use torch.serialization.add_safe_globals([ModelCheckpoint]) or the torch.serialization.safe_globals([ModelCheckpoint]) context manager to allowlist this global if you trust this class/function.

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant