Skip to main content

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

pip install setuptools_rust
python setup.py develop

Should be enough to install this library locally.

Testing

pip install pytest   # We don't require pytest, but it's a common library used across HF.
pytest -sv tests/

Metadata

Release files for safetensors 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for safetensors 0.2.3
File Size Uploaded Provenance Actions
safetensors-0.2.3.tar.gz 4.5 kB Without provenance Details for safetensors-0.2.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for safetensors 0.2.3
File Actions
safetensors-0.2.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for safetensors-0.2.3-cp310-cp310-win_amd64.whl
safetensors-0.2.3-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details for safetensors-0.2.3-cp310-cp310-win32.whl
safetensors-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for safetensors-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
safetensors-0.2.3-cp310-cp310-macosx_12_0_arm64.whl CPython 3.10 CPython 3.10 macOS 12.0+ ARM64 Details for safetensors-0.2.3-cp310-cp310-macosx_12_0_arm64.whl
safetensors-0.2.3-cp310-cp310-macosx_10_11_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.11+ x86-64 Details for safetensors-0.2.3-cp310-cp310-macosx_10_11_x86_64.whl
safetensors-0.2.3-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for safetensors-0.2.3-cp39-cp39-win_amd64.whl
safetensors-0.2.3-cp39-cp39-win32.whl CPython 3.9 CPython 3.9 Windows x86-32 Details for safetensors-0.2.3-cp39-cp39-win32.whl
safetensors-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details for safetensors-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
safetensors-0.2.3-cp39-cp39-macosx_12_0_arm64.whl CPython 3.9 CPython 3.9 macOS 12.0+ ARM64 Details for safetensors-0.2.3-cp39-cp39-macosx_12_0_arm64.whl
safetensors-0.2.3-cp39-cp39-macosx_10_11_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.11+ x86-64 Details for safetensors-0.2.3-cp39-cp39-macosx_10_11_x86_64.whl
safetensors-0.2.3-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for safetensors-0.2.3-cp38-cp38-win_amd64.whl
safetensors-0.2.3-cp38-cp38-win32.whl CPython 3.8 CPython 3.8 Windows x86-32 Details for safetensors-0.2.3-cp38-cp38-win32.whl
safetensors-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details for safetensors-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
safetensors-0.2.3-cp38-cp38-macosx_10_11_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.11+ x86-64 Details for safetensors-0.2.3-cp38-cp38-macosx_10_11_x86_64.whl
safetensors-0.2.3-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details for safetensors-0.2.3-cp37-cp37m-win_amd64.whl
safetensors-0.2.3-cp37-cp37m-win32.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-32 Details for safetensors-0.2.3-cp37-cp37m-win32.whl
safetensors-0.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details for safetensors-0.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
safetensors-0.2.3-cp37-cp37m-macosx_10_11_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.11+ x86-64 Details for safetensors-0.2.3-cp37-cp37m-macosx_10_11_x86_64.whl

Total release size: 8.6 MB

Release files / safetensors-0.2.3.tar.gz

Download URL safetensors-0.2.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bfa5b564ed20d8c9018853f679e66163f26c3329234ec7b95a566e35f38603cd
BLAKE2b-256 checksum
How to use checksums
bafd3f72a926fd8cceb9fe62eacc01cb43dde29eb380000d969c05dc8284a471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp310-cp310-win_amd64.whl

Download URL safetensors-0.2.3-cp310-cp310-win_amd64.whl
Size 235.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
fb6ec1460f721982f564c2ee31e4978943713e6fd9d02df6b750f4c3ec2057c7
BLAKE2b-256 checksum
How to use checksums
793ddc7f458c8d25df9f6b5f668c624950edcb9146d1406d67d65e2901d74c7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp310-cp310-win32.whl

Download URL safetensors-0.2.3-cp310-cp310-win32.whl
Size 227.6 kB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
a60272cb671517eaf0c57e0919cbf7734ef9ce38ea07f0a570c2bfa5581fe092
BLAKE2b-256 checksum
How to use checksums
a057ccd7f9aaf8c34754c1ecd83c7a3cbd54a91398a7c253c43d49f6413c7114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL safetensors-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0171b95dac2124b125cbd7c670627e8cda5f32d1f3fa71bab85b29d1d3c7d56d
BLAKE2b-256 checksum
How to use checksums
7b007111948dc484f8d648fc0cfcf516374954aea08eb60f62138b6188beb4ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp310-cp310-macosx_12_0_arm64.whl

Download URL safetensors-0.2.3-cp310-cp310-macosx_12_0_arm64.whl
Size 344.3 kB
Tags CPython 3.10 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
20a008857da3aaeadd257364a9cad064107df20f3a49a5a474261ccdcf7badd0
BLAKE2b-256 checksum
How to use checksums
e2582174963cb535a604e5d09fceb04a6edaf9bda816a67fb54c746c4565f9a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp310-cp310-macosx_10_11_x86_64.whl

Download URL safetensors-0.2.3-cp310-cp310-macosx_10_11_x86_64.whl
Size 359.4 kB
Tags CPython 3.10 macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
5361638f587bde9ba32575b6a802751c6afd35e7ffddb2d171a186cf6dfb08c5
BLAKE2b-256 checksum
How to use checksums
86c29e31c7f8d2def924c5a9d078c2401c5a673859ab90a543c7993e43d974b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp39-cp39-win_amd64.whl

Download URL safetensors-0.2.3-cp39-cp39-win_amd64.whl
Size 236.1 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
46cf25239ebcabbcda8ae8764b82d483878555e40eec0b0fa9574de4ed5b04a9
BLAKE2b-256 checksum
How to use checksums
d8e454fe3fa4540409af62ceb5826ea91cbce4de1fc0e486c2c8f0704424e745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp39-cp39-win32.whl

Download URL safetensors-0.2.3-cp39-cp39-win32.whl
Size 228.0 kB
Tags CPython 3.9 Windows x86-32
SHA-256 checksum
How to use checksums
e14f3c51fdeb34ec692555277cbf9a2b20eac6f449facec48fff03112044ccac
BLAKE2b-256 checksum
How to use checksums
6bca714d6d9d1e58fad65f68f6ee8ef453cd0d3068d8becf4115de2bf3f9b87b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL safetensors-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a7bcdcd2a2d05649fb5e87785dd129d0a0515a8c44c410589af72f2fead8602c
BLAKE2b-256 checksum
How to use checksums
dc89e0a2db720de2fca4bb3a11f55f20801d4f472a2775e76e012b1382031042
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp39-cp39-macosx_12_0_arm64.whl

Download URL safetensors-0.2.3-cp39-cp39-macosx_12_0_arm64.whl
Size 344.7 kB
Tags CPython 3.9 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
03204b5355b27966963995a0f4ad59f1cbd7c7519c99bc737e2f748ddaa05354
BLAKE2b-256 checksum
How to use checksums
e3bd6d33006d7b3eefeb1b9b784160019aa5c26cb3354fbb0ca79fd81f7c4a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp39-cp39-macosx_10_11_x86_64.whl

Download URL safetensors-0.2.3-cp39-cp39-macosx_10_11_x86_64.whl
Size 359.6 kB
Tags CPython 3.9 macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
edc44adddda94ad21b140528276369610ffb0d4d6bf4720bf4bfc851d3576f1d
BLAKE2b-256 checksum
How to use checksums
e9d982e73b1d0e6ed294f6784a255a8062f550b74a6deb180ee9a2a21bc91220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp38-cp38-win_amd64.whl

Download URL safetensors-0.2.3-cp38-cp38-win_amd64.whl
Size 236.1 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
1befdcc36bc6ea9e9ad5c443f7751cc08a03ca64d200ff1b73401c5308589a42
BLAKE2b-256 checksum
How to use checksums
7a2aeab44e450b5c9a50a78145d826294f843b6ac1f51eb7ec3f71e541857ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp38-cp38-win32.whl

Download URL safetensors-0.2.3-cp38-cp38-win32.whl
Size 227.8 kB
Tags CPython 3.8 Windows x86-32
SHA-256 checksum
How to use checksums
8038e576afe6fd525071f7405c151f959137035d34b35f8b67e7714e10adabc8
BLAKE2b-256 checksum
How to use checksums
2718800d0153fd5080a2fdb0f4bdc52c6ff8c0fbf48875fac1bde5f6f13c0266
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL safetensors-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8e1716ccafb2011295f55fdba70fee5c60b368d3b78d21f873b4fd5dd2d018f5
BLAKE2b-256 checksum
How to use checksums
ed6414ac5d498878e6d7cdb721b99ae8f7d57572053589b22c734af22e3d1f39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp38-cp38-macosx_10_11_x86_64.whl

Download URL safetensors-0.2.3-cp38-cp38-macosx_10_11_x86_64.whl
Size 359.9 kB
Tags CPython 3.8 macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
18f30c6d40324a3e062a3f86821b2f6ecc062f7d606637eddddd26b574b140e3
BLAKE2b-256 checksum
How to use checksums
b13168adf689186aa8ede479420412a9b4523207b7e898f6ff627334a0fe314d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp37-cp37m-win_amd64.whl

Download URL safetensors-0.2.3-cp37-cp37m-win_amd64.whl
Size 236.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
d1b03e07e7f91fcb5a227111d3e8947a4202efae071f68eb7c29e0db6d6ccfa2
BLAKE2b-256 checksum
How to use checksums
f8259ac58e582fd0855662cdd54ebf0345c647353fc95f8e11c2065e7c550cc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp37-cp37m-win32.whl

Download URL safetensors-0.2.3-cp37-cp37m-win32.whl
Size 227.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
c7d8ede6f389e76020a6ac1f81f910649901cc8170cf5108a93e37469046227d
BLAKE2b-256 checksum
How to use checksums
338221d148b086c1859d19cac9a4296b8b559a6987a954ebd9feaa000b273fdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL safetensors-0.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c26a7c304335c523cd7a4e1edc3bb66a4f49f615ab964ab0c594ba25426db9ce
BLAKE2b-256 checksum
How to use checksums
1854aea2c6e9d63036e32b8dce958f123b4ae9962904f2cc87c47e5cef5d59ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / safetensors-0.2.3-cp37-cp37m-macosx_10_11_x86_64.whl

Download URL safetensors-0.2.3-cp37-cp37m-macosx_10_11_x86_64.whl
Size 359.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
6eb71d4f17964c7438210c3d47491be6a8486b225176ee05fc03cd1345921a4f
BLAKE2b-256 checksum
How to use checksums
11596d40b6320556d1f90a2a28e33737742f7c8e4a12ae9e9449706f02a39906
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Security for safetensors 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.3 This release

19 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page