Text-to-Image
Diffusers
stable-diffusion

Unable to load unet safetensor

#54
by YifangXu - opened

Dear developer,

When I run code:

unet = UNet2DConditionModel.from_config(sdxl_based_path, subfolder="unet").to(device, torch.float16)
unet_state_dict = load_file(unet_path, device=device)
unet.load_state_dict(unet_state_dict)

I get the error below:

Traceback (most recent call last):
  File "/data/xxx/ckpt/load_unet_ckpt.py", line 26, in <module>
    unet_state_dict = load_file(unet_path, device=device)
  File "/root/anaconda3/envs/xxx/lib/python3.10/site-packages/safetensors/torch.py", line 311, in load_file
    with safe_open(filename, framework="pt", device=device) as f:
OSError: No such device (os error 19)

What is your diffusers version?
How can I solve this problem?

YifangXu changed discussion status to closed

Sign up or log in to comment