-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Describe the bug
SD1.5 Unet from_single_file loading does not work (either from safetensor or GGUF)
Reproduction
`
import torch
from diffusers import UNet2DConditionModel
config = UNet2DConditionModel.load_config("SimianLuo/LCM_Dreamshaper_v7", subfolder="unet")
unet = UNet2DConditionModel.from_single_file(
"stable-diffusion.cpp/build/diffusion_pytorch_model.safetensors",
config="SimianLuo/LCM_Dreamshaper_v7", # Use the repo ID string
subfolder='unet',
torch_dtype=torch.bfloat16,
use_safetensors=True
)
`
and
`
import torch
from diffusers import UNet2DConditionModel
config = UNet2DConditionModel.load_config("SimianLuo/LCM_Dreamshaper_v7", subfolder="unet")
unet = UNet2DConditionModel.from_single_file(
"https://huggingface.co/abhinavgopal/firstfile.gguf/LCM_Dreamshaper_v7_4k.safetensors.q8_0.gguf",
config="SimianLuo/LCM_Dreamshaper_v7", # Use the repo ID string
subfolder='unet',
torch_dtype=torch.bfloat16,
use_safetensors=True
)
`
Logs
Traceback (most recent call last):
File "/home/ec2-user/temp.py", line 14, in <module>
unet = UNet2DConditionModel.from_single_file(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ec2-user/miniconda3/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/ec2-user/miniconda3/lib/python3.12/site-packages/diffusers/loaders/single_file_model.py", line 325, in from_single_file
raise SingleFileComponentError(
diffusers.loaders.single_file_utils.SingleFileComponentError: Failed to load UNet2DConditionModel. Weights for this component appear to be missing in the checkpoint.System Info
- π€ Diffusers version: 0.32.2
- Platform: Linux-6.1.128-136.201.amzn2023.x86_64-x86_64-with-glibc2.34
- Running on Google Colab?: No
- Python version: 3.12.9
- PyTorch version (GPU?): 2.6.0+cu124 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Huggingface_hub version: 0.29.2
- Transformers version: 4.49.0
- Accelerate version: 1.4.0
- PEFT version: not installed
- Bitsandbytes version: 0.45.3
- Safetensors version: 0.5.3
- xFormers version: not installed
- Accelerator: NVIDIA L40S, 46068 MiB
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No