-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
StableDiffusionPipeline.from_single_file() with CKPT fails: "UnpicklingError: Weights only load failed" #8874
Comments
It says you can change |
doesn't look like there is a way to set that from the pipeline class. |
it's so rare nowadays that someone wants to load a This is a safety feature in the code because a generative model shouldn't need to execute arbitrary code with diffusers:
If you still want to load it, you can change it to I did it as a test and now it's asking my to install torch lighting which is weird, never loaded a cc: @DN6 for awareness |
I think the bug is the fact that it's not able to load the weights using If The expected behavior for the |
If you consider that a bug then you probably should report it in the model repo, probably it was saved with some weird call to pytorch lighting because of the training.
The safetensors alternative works because it doesn't store any library requirement/implementation and it's a fact that you don't need to install pytorch lighting to load any stable diffusion checkpoints. But yeah, you're right. You can easily reproduce this error with this code: import torch
state_dict = torch.load("models/checkpoints/v1-5-pruned-emaonly.ckpt", weights_only=True) but this is not a |
It's a change they made. 0.27.2 this worked pipe.vae = AutoencoderKL.from_single_file(
path.join("./assets/vae/orangemix.vae.pt"),
local_files_only=True,
torch_dtype=torch.bfloat16
) But now in 0.28.0+ it is broken. Can we stop making changes that completely breaks functionality without noting it? @sayakpaul many of us still use pickle files. Also how can I make sure all weights are loaded? |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
So will there be any action on this? |
Yes, there will be more considerations once Dhruv is back from the leave. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Cc: @DN6 |
@DN6 Have you had a chance to take a look at this? |
@JemiloII the core issue is similar to what I was talking about here: #9154. There are non-weight serialised objects in the checkpoint file that we don't allow loading via |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Marking as closed due to:
To convert the weights, one can simply load the state dict with pytorch unsafe code (weights_only=False), and convert to safetensors following https://huggingface.co/docs/safetensors/en/index#save-tensors - this is highly recommended for safety reasons. If there's anything else we can help with, please let us know 🤗 |
Describe the bug
Trying to load local CKPT file using the "from_single_file()" method fails. Works fine with .safetensors file from same repo (Runway ML SD).
Reproduction
Logs
System Info
Who can help?
@yiyixuxu @asomoza @dn
The text was updated successfully, but these errors were encountered: