#124124th of 206 in ML frameworks and libraries
safetensors
Tensor file format and library that avoids pickle, with zero-copy lazy loading
- Stars
- 4k
- License
- Apache-2.0
- Last commit
- Nov 2026
- Last release
- Jun 2026
- Language
- Rust
3,686 on 22 Apr 20263,963 on 11 Nov 2026
From GitHub's daily star counts.
Checked on GitHub.
Overview
Safetensors defines a simple file layout for tensors: an 8-byte little-endian header size, a JSON header with dtype, shape and offsets, then a raw byte buffer. The Rust core ships with Python bindings (pip install safetensors) that save and load tensors via safe_open and save_file, including PyTorch. Loading never executes code, the header is capped at 100MB, and tensors can be read individually without scanning the whole file.
Who it is for: Engineers saving, sharing or loading model weights safely and quickly
Strengths
- Loading a file cannot run arbitrary code, unlike pickle-based PyTorch checkpoints
- Lazy loading of single tensors; README reports BLOOM on 8 GPUs dropping from 10 min to 45 s
- Native bfloat16 and fp8 dtypes, and no file size limit
- Format is small and documented; Rust crate plus Python bindings on PyPI and crates.io
Weaknesses
- Stores only tensors and string metadata, no custom code or arbitrary structures
- No strided tensors; everything must be packed before serialization
- Sub-byte dtypes error out on unaligned reads
- Not fully zero-copy: header is JSON and GPU loads still copy from disk
What it needs
- no GPU
- Docker
- Needs Rust toolchain (build from source only), setuptools_rust (build from source only)
- Models: PyTorch, TensorFlow, Flax, NumPy
What changed
- v0.8.0 ↗ (opens in a new tab)Breaking
“The serialize and serializefile functions now release the GIL during writes, enabling true multithreaded saves from Python. Their input contract has also changed: tensor metadata is now passed via a …”
From the release notes. No flag means the note does not say so, not that the upgrade is safe.
Also in ML frameworks and libraries
See all 206| Rank | Project | Score |
|---|---|---|
| 1 | transformersPython library defining open models for text, vision, audio and multimodal tasks | 94 out of 100 |
| 2 | ultralyticsPython library and CLI for training and running YOLO vision models | 94 out of 100 |
| 3 | pytorchPython tensor library with GPU support and tape-based autograd | 93 out of 100 |
| #4 | pytorch-image-modelsPyTorch library of image models, pretrained weights and training scripts | 93 out of 100 |
| #5 | supervisionPython toolkit for loading, annotating and counting computer vision detections | 92 out of 100 |