Safetensors
Fast and safe tensor serialization format by Hugging Face.
About
Loading a pickled PyTorch checkpoint can execute arbitrary code, which makes sharing model weights a genuine attack surface. Safetensors, from Hugging Face, replaces pickle with a purpose-built format that cannot run code on load: a file holds an 8-byte header length, a JSON block describing each tensor's dtype, shape, and byte offsets, and then a raw little-endian data buffer. The layout enables memory-mapped, zero-copy style reads and lazy loading of individual tensors without scanning the whole file; the README cites loading BLOOM across 8 GPUs dropping from 10 minutes to 45 seconds compared with standard PyTorch loading. The format also forbids overlapping tensor regions, closing off a class of denial-of-service tricks. Implementations exist in Python and Rust, and safetensors is now the default weight format across the Hugging Face Hub, used by practitioners anywhere untrusted models are downloaded or large models need fast startup. Apache 2.0 licensed.
Reviews (0)
Leave a Review
No reviews yet. Be the first to review!
Details
- Category
- AI Frameworks & Libraries
- Price
- Free
- Platform
- Local/Desktop
- Difficulty
- Beginner (1/5)
- License
- Apache-2.0
- Added
- Apr 3, 2026
Related Tools
Unified system for large-scale distributed training and inference.
Guidance language for controlling LLM generation with constraints, grammars, and JSON schemas.
Library for easily accessing and processing ML datasets.
JAX neural network library with PyTorch-like module system.
High-level deep learning API supporting JAX, TensorFlow, and PyTorch backends.
Gradient boosting library by Yandex with native categorical feature handling.