You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Safetensors checkpoint loading fails with a torch.device map_location #15459
I get an OSError when I pass torch.device("cpu") to load_state_dict for a valid safetensors checkpoint. The helper accepts torch.device in its type annotation, and the same argument works for .bin checkpoints. I have a small fix for the safetensors call and would like to submit it.
Hi @mertkayacs, are you still planning to open a PR for this? The torch.device → safe_open(device=...) mismatch in load_state_dict is easy to reproduce with your snippet. If you'd rather not, I'm happy to pick it up with a regression test for the safetensors path. No rush either way.
Activity
LEKKALAGANESH commentedon Dec 4, 2026
Hi @mertkayacs, are you still planning to open a PR for this? The torch.device → safe_open(device=...) mismatch in load_state_dict is easy to reproduce with your snippet. If you'd rather not, I'm happy to pick it up with a regression test for the safetensors path. No rush either way.
mertkayacs commentedon Dec 4, 2026
Thanks for checking, @LEKKALAGANESH. I've opened #15489 with a regression test for the safetensors path.