Glossary / Models and files
safetensors – explained simply
safetensors is a safe and fast file format for model weights that cannot execute hidden code when loaded.
Also: .safetensors, Safetensors format
Older model formats like .ckpt, .pt, or .bin often rely on Python's pickle mechanism. Pickle can execute arbitrary code when loaded, so a tampered model file could launch malware. safetensors, on the other hand, stores only numbers and metadata.
Hugging Face describes the format as simple, secure, and still fast. It is used by many projects, including transformers, diffusers, ComfyUI, and llama.cpp.
What does that mean for you? If a model is offered both as .safetensors and as .ckpt or .bin, always choose the safetensors file.
Related terms
Errors where that matters
- ControlNet: Error(s) in loading state_dict … size mismatch (ControlNet does not match the base model)
- Error while deserializing header (corrupted model file)
- ERROR: Could not detect model type of: … (Model is in the wrong folder or the wrong loader)
- Hugging Face download stops or hangs (.incomplete)
- IPAdapter model not found / ClipVision model not found (IPAdapter files are missing or named incorrectly)
- No checkpoints found (No model found in the model folder)
- Prompt outputs failed validation / Value not in list (Model missing)
- SafetensorError: incomplete metadata / MetadataIncompleteBuffer
- Stable diffusion model failed to load (model can’t be loaded — the real cause is above)