-
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
[Single File] Add single file loading for SANA Transformer #10947
Conversation
ohh thanks so much!!!!!! cc @DN6 here! can you do a review? |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Nice work @ishan-modi 👍🏽. Could we add a test similar to the one for Lumina
(We can skip the checkpoint loading test if no checkpoint exists with alternative key names) We can merge once that's done. |
Not working, I tried with/without weights_only=False import torch
from diffusers import SanaPipeline
from diffusers import SanaTransformer2DModel
model_path = "Efficient-Large-Model/Sana_1600M_1024px_diffusers"
dtype = torch.float16
transformer = SanaTransformer2DModel.from_single_file (
"https://huggingface.co/Swarmeta-AI/Twig-v0-alpha/blob/main/Twig-v0-alpha-1.6B-2048x-fp16.pth",
torch_dtype=dtype,
weights_only=False
)
pipe = SanaPipeline.from_pretrained(
pretrained_model_name_or_path=model_path,
transformer=transformer,
torch_dtype=dtype,
use_safetensors=True,
)
|
@nitinmukesh the problem that you are mentioning is a separate one, model should load with weights_only=False, but there is a weights_only=True override in @DN6, @yiyixuxu, do we want to address above in this PR and carry kwargs in these downstream functions ? |
So it looks like that particular checkpoint has extra serialized objects in the picke file. For these cases we recommend loading the file yourself with We would like to avoid providing the option to set |
@nitinmukesh are you able to load this checkpoint? |
@DN6, I have tested that and it loads correctly |
Yes the default loads fine. I also don't want to use unsafe way of loading. |
What does this PR do?
Fixes #10872
Who can review?
@yiyixuxu