huggingface
loading_error
ai_generated
true
OSError: Error no file named model.safetensors found in directory or unable to load safetensors file
ID: huggingface/safetensors-load-error
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
| 4 | active | — | — | — |
Root Cause
Failed to load model weights in safetensors format. File missing, corrupted download, or format incompatibility.
genericWorkarounds
-
90% success Force re-download by clearing the cache
rm -rf ~/.cache/huggingface/hub/models--org--model/ # then re-download
-
85% success Fall back to PyTorch .bin format if safetensors unavailable
model = AutoModel.from_pretrained('model', use_safetensors=False) # loads pytorch_model.bin instead -
80% success Verify file integrity with sha256 checksum
sha256sum model.safetensors # compare with checksum on the model card or Hub API
Dead Ends
Common approaches that don't work:
-
Convert pickle checkpoint to safetensors manually
72% fail
Manual conversion can introduce errors with custom architectures. Use the official conversion tool or download the correct format.
-
Ignore safetensors and always use use_safetensors=False
78% fail
Pickle files have arbitrary code execution risk. Safetensors is the safe default; fix the load issue instead.