Skip to main content

No project description provided

Project description

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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safetensors-0.5.1.tar.gz (66.5 kB view details)

Uploaded Source

Built Distributions

safetensors-0.5.1-cp38-abi3-win_amd64.whl (303.7 kB view details)

Uploaded CPython 3.8+ Windows x86-64

safetensors-0.5.1-cp38-abi3-win32.whl (291.2 kB view details)

Uploaded CPython 3.8+ Windows x86

safetensors-0.5.1-cp38-abi3-musllinux_1_2_x86_64.whl (632.7 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ x86-64

safetensors-0.5.1-cp38-abi3-musllinux_1_2_i686.whl (659.6 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ i686

safetensors-0.5.1-cp38-abi3-musllinux_1_2_armv7l.whl (721.7 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARMv7l

safetensors-0.5.1-cp38-abi3-musllinux_1_2_aarch64.whl (628.5 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARM64

safetensors-0.5.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (461.8 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

safetensors-0.5.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (525.8 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ s390x

safetensors-0.5.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (510.0 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64le

safetensors-0.5.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (458.7 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARMv7l

safetensors-0.5.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (450.1 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

safetensors-0.5.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (491.1 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.5+ i686

safetensors-0.5.1-cp38-abi3-macosx_11_0_arm64.whl (409.0 kB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

safetensors-0.5.1-cp38-abi3-macosx_10_12_x86_64.whl (427.0 kB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

Details for the file safetensors-0.5.1.tar.gz.

File metadata

  • Download URL: safetensors-0.5.1.tar.gz
  • Upload date:
  • Size: 66.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.1

File hashes

Hashes for safetensors-0.5.1.tar.gz
Algorithm Hash digest
SHA256 75927919a73b0f34d6943b531d757f724e65797a900d88d8081fe8b4448eadc3
MD5 14511742c857f4dceed8440075b676bc
BLAKE2b-256 cd4ba45aedf2375cd86314749ad4760545b6e4ec7b306cfa142776daaca6c980

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 895f33c8ee55310606a407f45de3468ec0ffe259ba53cc0d4024a64fb58a1fc9
MD5 99a4c58552c5e73ff15c38bd42ef6b6a
BLAKE2b-256 12cda3269a5c81896049a076842be67537ed269e1edcaf7276ade1962f2f39e9

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-win32.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 7290f8acdf1e5b5daf6101d6eed506d1f6ad66d08ca9f26235372befba7e2285
MD5 59e99bf5a7cb485774993b1de3fff5b2
BLAKE2b-256 34e9ca0e67864cf8e0a1875b97d73ae80beb2f99b8f2c3c51378ac48bc98465d

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b021cad4af26677e0d3fbc5c8e2dfc3087ac44a3e0450576cbe0aa165849578c
MD5 2b388f9cb8bacd4068fb4fae27a8f15d
BLAKE2b-256 11ee73883832c306051214a64045f5c0fe0cce8b814f70615f7e1853eed8cf81

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 97f548d6e9f86d3326ab8416303f9ae1ded15df126b87db42658c3d89a1040d7
MD5 b39b022e69633992dd91333683af0246
BLAKE2b-256 4e36849d65578369d7590fe1a5ad5a16b1c8054a177af2dc85f1e635a9273ae5

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 430b7eab6b4139bee8587522f264f7eebbac3e41614b52e35caf90affe7e7972
MD5 e58092dc6e71a981040863fcf375fbce
BLAKE2b-256 90406d9e3446fc7cee07f7054206056e74be194e93a595edee96be2bc175b181

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 168e7a032c944eb5aefaee0d4bf4e15e84dbbf0f2ef86fbe0dc778a68306fff8
MD5 f2f373f23f605898dbc8161ff9f1eca9
BLAKE2b-256 738072df9b057a4e957e2e6c99f5d84656291eb9cd6d34d85a8257b5e3de2d22

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83a384e49b38c3ae3c02a52437548351af83029dff85fe3d1acd5b2cf06867bb
MD5 949e8417e9126d3b27e72c44fbc62a58
BLAKE2b-256 6683041a0aabcd4f614460ed3f37e4c352160c7e52c8d5e5e9f250896a14adb8

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 4abb7bcf2faba63a0b58a2c6fafab0200726727ab6f579a1155239927a792709
MD5 7283073ad1327e913c120e570fae743e
BLAKE2b-256 8856a96651435025cb4335a6cdff2f9bdaedf1b1e124cf5c9986aa7f7bb18fa8

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3cb212b0cded22fa0e46bca248beecf2fd079f2dffd7cc04e116a8b0128ae601
MD5 406d2b81c670840e6fa27b7ad45fa9c9
BLAKE2b-256 236f02c6c68783f550d2610a268171dcfe4051e584e30f1c3bf5d51ea4e962a4

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c40ef845cca82e365b46e192b7b4952082952d5965c602e030a73155336de89c
MD5 ed1f93b84495e6352873096094cb89c0
BLAKE2b-256 07f9435a15f2fb5dba1debfcab87ab102933cce28454b6ce6e79be6b9784b5f5

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e98f5dbce744a87a8d2cb9147558e80af79cfe31aa4321554e1db0e49d9c957
MD5 25531fdeb68e6bcc927f58e24a3a1fea
BLAKE2b-256 1c5fa47d6901824b7d05afeadcf2069b2f60864ebb8f5c6186537fc576e81202

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 44946151b01083fe5863c20d626f6ed9f1544be80e3bb2177a7ec27f911fdbf8
MD5 7fb98ae5575d01545e2ebbce6ae5cc88
BLAKE2b-256 33d075ba8201855d9b50cfd02e337e82e2789b9a9c8be32202b34c95ec27b966

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 547e9fe8f3c9c50caf07cfcb6d2392f511853f7041821812ba73a05a915e91dd
MD5 1ce586bcd94c8fe21505e756defa2162
BLAKE2b-256 f97b51648d9db7fc94699e574398f7e7ca97a8d50e6af2d430e337c95414c8b2

See more details on using hashes here.

File details

Details for the file safetensors-0.5.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.5.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5480b078590dd37ee1c27f153e1ee9a274b62b30871ee16c412d11341215f305
MD5 61b3408f9765767085da183f167cbe2d
BLAKE2b-256 7b8b1e0ac27be12e44ed319fb7890ff5f2779bfbe7ce2f25209850ea8361f6d2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page