-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When a model contains safetensors and bin weights diffusers will only download the bin weights. An error is raised when use_safetensors=True
:
OSError: Could not found the necessary `safetensors` weights in {'vae/diffusion_pytorch_model.fp16.bin', 'text_encoder/pytorch_model.fp16.bin', 'unet/diffusion_pytorch_model.fp16.safetensors', 'text_encoder/model.fp16.safetensors', 'vae/diffusion_pytorch_model.fp16.safetensors', 'unet/diffusion_pytorch_model.fp16.bin', 'safety_checker/pytorch_model.fp16.bin', 'safety_checker/model.fp16.safetensors'} (variant=fp16)
With a warning before it like:
vae\diffusion_pytorch_model.fp16.safetensors not found
This is happening due to a windows separator being inserted where a unix separator is expected.
expected_sf_filename = os.path.join(path, filename) |
Reproduction
from diffusers import DiffusionPipeline
import torch
pipe = DiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
)
A model like SDXL 1.0 doesn't have this issue due to not having bin weights to compare against.
from diffusers import DiffusionPipeline
import torch
pipe = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
)
Logs
No response
System Info
platform: Windows 11
python: 3.10.7
diffusers: 0.19.3
Who can help?
hwjfordev and michaelriedl
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working