No summary available
Project Links
Meta
Author: Nicolas Patry
Requires Python: >=3.9
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
- Education
- Science/Research
License
- OSI Approved :: Apache Software License
Operating System
- OS Independent
Programming Language
- Python :: 3
- Python :: 3.7
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
Topic
- Scientific/Engineering :: Artificial Intelligence
Typing
- Typed
Installation
pip install safetensors
Usage
Numpy
from safetensors.numpy import save_file, load_file
import numpy as np
tensors = {
"a": np.zeros((2, 2)),
"b": np.zeros((2, 3), dtype=np.uint8)
}
save_file(tensors, "./model.safetensors")
# Now loading
loaded = load_file("./model.safetensors")
Torch
from safetensors.torch import save_file, load_file
import torch
tensors = {
"a": torch.zeros((2, 2)),
"b": torch.zeros((2, 3), dtype=torch.uint8)
}
save_file(tensors, "./model.safetensors")
# Now loading
loaded = load_file("./model.safetensors")
Developing
# inside ./safetensors/bindings/python
pip install .[dev]
Should be enough to install this library locally.
Testing
# inside ./safetensors/bindings/python
pip install .[dev]
pytest -sv tests/
0.7.0
Nov 19, 2025
0.7.0rc1
Nov 17, 2025
0.7.0rc0
Oct 30, 2025
0.7.0.dev0
Nov 17, 2025
0.6.2
Aug 08, 2025
0.6.1
Aug 06, 2025
0.6.1rc0
Aug 06, 2025
0.6.0rc0
Jun 16, 2025
0.6.0.dev0
Jun 16, 2025
0.5.3
Feb 26, 2025
0.5.2
Jan 08, 2025
0.5.1
Jan 07, 2025
0.5.0
Jan 02, 2025
0.5.0rc0
Jan 02, 2025
0.4.6.dev0
Nov 07, 2024
0.4.5
Sep 05, 2024
0.4.4
Aug 05, 2024
0.4.4rc0
Aug 05, 2024
0.4.3
Apr 15, 2024
0.4.3rc0
Apr 15, 2024
0.4.2
Jan 23, 2024
0.4.2rc0
Jan 22, 2024
0.4.1
Nov 27, 2023
0.4.1rc1
Nov 17, 2023
0.4.0
Oct 06, 2023
0.4.0rc1
Oct 05, 2023
0.3.3.post1
Aug 25, 2023
0.3.3
Aug 23, 2023
0.3.3rc1
Aug 23, 2023
0.3.2
Aug 08, 2023
0.3.2rc1
Aug 07, 2023
0.3.1
Apr 25, 2023
0.3.1rc1
Apr 24, 2023
0.3.0
Mar 03, 2023
0.3.0rc1
Mar 02, 2023
0.2.8
Jan 16, 2023
0.2.7
Dec 27, 2022
0.2.6
Dec 13, 2022
0.2.5
Nov 23, 2022
0.2.4
Nov 07, 2022
0.2.3
Oct 27, 2022
0.2.2
Oct 26, 2022
0.2.1
Sep 30, 2022
0.2.1.dev0
Oct 26, 2022
0.2.0
Sep 29, 2022
0.0.1
Sep 22, 2022
Wheel compatibility matrix
Files in release
safetensors-0.7.0-cp38-abi3-macosx_10_12_x86_64.whl (456.8KiB)
safetensors-0.7.0-cp38-abi3-macosx_11_0_arm64.whl (436.6KiB)
safetensors-0.7.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (480.2KiB)
safetensors-0.7.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (492.1KiB)
safetensors-0.7.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (608.9KiB)
safetensors-0.7.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (520.4KiB)
safetensors-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (495.3KiB)
safetensors-0.7.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (529.2KiB)
safetensors-0.7.0-cp38-abi3-musllinux_1_2_aarch64.whl (658.3KiB)
safetensors-0.7.0-cp38-abi3-musllinux_1_2_armv7l.whl (753.6KiB)
safetensors-0.7.0-cp38-abi3-musllinux_1_2_i686.whl (697.6KiB)
safetensors-0.7.0-cp38-abi3-musllinux_1_2_x86_64.whl (661.5KiB)
safetensors-0.7.0-cp38-abi3-win32.whl (318.8KiB)
safetensors-0.7.0-cp38-abi3-win_amd64.whl (333.4KiB)
safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (480.9KiB)
safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (492.2KiB)
safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (609.3KiB)
safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl (519.4KiB)
safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (481.1KiB)
safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (492.1KiB)
safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (609.0KiB)
safetensors-0.7.0-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl (520.0KiB)
safetensors-0.7.0.tar.gz (196.2KiB)