Skip to main content

Fast and Safe Tensor serialization

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.3.1rc1.tar.gz (34.1 kB view details)

Uploaded Source

Built Distributions

safetensors-0.3.1rc1-cp311-cp311-win_amd64.whl (263.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

safetensors-0.3.1rc1-cp311-cp311-win32.whl (258.4 kB view details)

Uploaded CPython 3.11 Windows x86

safetensors-0.3.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

safetensors-0.3.1rc1-cp311-cp311-macosx_12_0_arm64.whl (401.4 kB view details)

Uploaded CPython 3.11 macOS 12.0+ ARM64

safetensors-0.3.1rc1-cp311-cp311-macosx_10_11_universal2.whl (400.2 kB view details)

Uploaded CPython 3.11 macOS 10.11+ universal2 (ARM64, x86-64)

safetensors-0.3.1rc1-cp310-cp310-win_amd64.whl (263.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

safetensors-0.3.1rc1-cp310-cp310-win32.whl (258.4 kB view details)

Uploaded CPython 3.10 Windows x86

safetensors-0.3.1rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

safetensors-0.3.1rc1-cp310-cp310-macosx_12_0_arm64.whl (401.4 kB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

safetensors-0.3.1rc1-cp310-cp310-macosx_10_11_x86_64.whl (400.2 kB view details)

Uploaded CPython 3.10 macOS 10.11+ x86-64

safetensors-0.3.1rc1-cp39-cp39-win_amd64.whl (263.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

safetensors-0.3.1rc1-cp39-cp39-win32.whl (258.6 kB view details)

Uploaded CPython 3.9 Windows x86

safetensors-0.3.1rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

safetensors-0.3.1rc1-cp39-cp39-macosx_12_0_arm64.whl (401.9 kB view details)

Uploaded CPython 3.9 macOS 12.0+ ARM64

safetensors-0.3.1rc1-cp39-cp39-macosx_10_11_x86_64.whl (400.8 kB view details)

Uploaded CPython 3.9 macOS 10.11+ x86-64

safetensors-0.3.1rc1-cp38-cp38-win_amd64.whl (263.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

safetensors-0.3.1rc1-cp38-cp38-win32.whl (258.8 kB view details)

Uploaded CPython 3.8 Windows x86

safetensors-0.3.1rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

safetensors-0.3.1rc1-cp38-cp38-macosx_12_0_arm64.whl (401.7 kB view details)

Uploaded CPython 3.8 macOS 12.0+ ARM64

safetensors-0.3.1rc1-cp38-cp38-macosx_10_11_x86_64.whl (400.9 kB view details)

Uploaded CPython 3.8 macOS 10.11+ x86-64

safetensors-0.3.1rc1-cp37-cp37m-win_amd64.whl (264.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

safetensors-0.3.1rc1-cp37-cp37m-win32.whl (258.8 kB view details)

Uploaded CPython 3.7m Windows x86

safetensors-0.3.1rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

safetensors-0.3.1rc1-cp37-cp37m-macosx_10_11_x86_64.whl (400.9 kB view details)

Uploaded CPython 3.7m macOS 10.11+ x86-64

File details

Details for the file safetensors-0.3.1rc1.tar.gz.

File metadata

  • Download URL: safetensors-0.3.1rc1.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for safetensors-0.3.1rc1.tar.gz
Algorithm Hash digest
SHA256 15cfc4e19a1aeb501f73f7168b100122496b6c5aecda5f1fd5915506934890d4
MD5 ac780bf30d965acbc631c4b40c522e4e
BLAKE2b-256 32d9994601f562e29e4bc885997ce5283e7e0ea735dd1df68ebfc02ccdeaaed3

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 307e9c304fc62532ee4271a86110961e4f7f10e98fcde8b7ff81138c1a7c266a
MD5 eb1d102125aa5378e11739831f95d03f
BLAKE2b-256 571342698403fc3abcb57130cc568e0d3cdb38c97fb9fe45676841cc3f889b81

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 3d927bcee87a7b960087dcba08fed9a65290c6712e5b23561d64288183f12d6f
MD5 7d9ea7d3d565f93e23e746213b5d3d11
BLAKE2b-256 52a035d8e3f410bdf0e1007ed3a0815dc23cea9e820f257ecf59786399c33148

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b734dc2a4a45dedc433aa41ee9caedd3e75818ea4da10f42f957b0b571a076a
MD5 d8f720fd3358b15866400b2bda19b499
BLAKE2b-256 cb283ff3e61ebe23d1685c10c8d6cbd10ba6a061e679b9d971a794f599acfb00

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 3a4e2639404be6e1814cade8b58dac4b348f4206219389fd40180822b7fa806b
MD5 08148f8b530e21453a045eed79d22248
BLAKE2b-256 49b0b4b2c1daf97b8cd2e7d75656a18167cce21822318344d972080d0545bf2c

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp311-cp311-macosx_10_11_universal2.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp311-cp311-macosx_10_11_universal2.whl
Algorithm Hash digest
SHA256 0b66a600ef092fb6765a33b83088941c02e0d77ef0cc08ccb745ac1489f55157
MD5 375285224b1e4c78e00954fccb13f922
BLAKE2b-256 7179d0a1e84c6ee2792ef5ca314b499df93baacf9e6ab1776816f2d4d333cbea

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f9f412bc7b64428a9bb04a004723f88466d6b9acf02bf1d90251cd6a1c8d3773
MD5 b38225a1ef63c64a4b2cb5ddcd7a414c
BLAKE2b-256 76f86871e2c57574ad35f5d3af60b4433bb13edf27dc7a551ef54b290d4e7739

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 a95da0cab6c9e5fb209f0da9514832f185ec33f737dd20c9b469a5de3c0d2372
MD5 ecb9944cb5e3c77ea10726ce3b514b2b
BLAKE2b-256 8b4b0101e47cde07130403ebfcd6220ae0db92ba46505dda758267bb8684b809

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 35fecfcb96344d8080d11076cb788d9f71db43813d30b10c1b91f69a178e8cd1
MD5 378dd44ccf72314f044377525047d971
BLAKE2b-256 282139bd1764ec4a60931f03902a380433ad7f5d683cf222b0e93d4f6acc4c92

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 c4e3a705c73f25d9d8c0fa7508dd23091eceff58e5bc2afbe8a0743a1014c472
MD5 63bdc9a3a9c9f555e63059a327d612bc
BLAKE2b-256 519775cf824a7af5c9fbfbd6ab5707c722a4d6caef2ae06805966bcf96919dac

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp310-cp310-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp310-cp310-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 463f84a8273b5f96a17834e3824ae81803dc20a59954e49b7ab877df73caf809
MD5 1b355621c37ae15bfdfbb26ec74aeb84
BLAKE2b-256 75b4e03f60e7870bbba44bbc40182c990bb8a3bdf3bdd7eae89d19ef9f7a589d

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ede9847e2cb9cda0b6cd8ee53145c6f43be19c1746f7093f9e019982a10f8dd6
MD5 ae74466a2127d7fd7afd5a4aac500773
BLAKE2b-256 519216f483e5b07be950fc8ecf5240d90efeaf8dbb3340266db6631f37f137b7

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp39-cp39-win32.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 83e9830e7956a62427f4ee1d397634b85bbc59b871801e0d8cfb7e051fb13c25
MD5 85c63dd78c148a3ffed5c020faf7c730
BLAKE2b-256 35dafb0c7f68f26d279fe59d3c6482c329936a22e996413acc1bf8f7dc381934

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 66ad5ec1a83af977790d6317ecbe56916376f70afc1cd0d5b74a73eed5861874
MD5 8191ae27bcb76db6cd2c05fabb9593f9
BLAKE2b-256 8b66f5027158fc1165a50834d8d6e9acecd53b8b84f02718eb55fc126c331119

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp39-cp39-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 fa2ba48292e4b7f63e4a3b591052d629b7b217cef3806353e0c2121ea30cef1b
MD5 4db4d9eba33570fd374f674cf6fb7e2b
BLAKE2b-256 c5b277820e9d4dd5a832c740a75be843cc81ba6851351de2e7ddab5b4eda7bbb

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp39-cp39-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp39-cp39-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 896e4e80eb4f495079a0e1f2d7a675c214195b3f929c9e20a70f3c0a3070c610
MD5 1160c8212df0c77db13c54616c3fa9b2
BLAKE2b-256 953f48f4e28851041154cae6a932e06f649676f6544d7bd250a29bc9d262a391

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9455bef6bb341f8863d601bd2917aef66d9fc9c8f19b37061c42f025bc8e42c2
MD5 85045c0575452ed2ab6e8bc46b88c9b8
BLAKE2b-256 1229571a7df624a532962df2d9e725f2a67154b2a5188786c1d17409bf126861

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp38-cp38-win32.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 31e45b8052617932782a4855ed49e6fe1667027c25110d1b2b2bca9b23cb5d16
MD5 9b1328ad0c227e250c6d69e6f3dcd6ac
BLAKE2b-256 0229abbf86bac8da5501414e18eb849375ef4b7205dc36a7f0cf3a7276d4eb23

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc5194b75634478186d135e3fa22e3423f70ecd478c2d376ad41b3747db3a01f
MD5 da1490b6ff2a4cd0c9966a9405d3b02d
BLAKE2b-256 3ce505d76fff06065550bcc84e8270b1299ddef54e6c1f740138a28ebcb2b1e6

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp38-cp38-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp38-cp38-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 9de35f5dc9a9a64f4915129fccbeed130364f165403878ef482a32780761c0c8
MD5 7cd6e646315b92e5bb803800c9f3e2b5
BLAKE2b-256 7b25bf7431fb0f249e29b6a4ec648c7ad0f4094d69519f4d42fe033d65491a9d

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp38-cp38-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp38-cp38-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 bb2389200e4a2346274f0c290eb81ed070a4de15235dd9d56a933fe287b3988e
MD5 1744b59bf1f5bdb6599613ad54a7a6ff
BLAKE2b-256 7b9e02caa6784d6d14df203b942df5780fbe9c2963b0bc1eef3d6cc572be1871

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ab4841451ead70563668891aef61da179dab41d0e34eb41def9de2cc513c14ae
MD5 0153fb3aaf276144e06041007d562300
BLAKE2b-256 7050a9dd8e4c1bd18f882a9b541a11eaa02963b188621dcfe03f2a84d537ba4b

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp37-cp37m-win32.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 6d457503cfb84b58225612c199bdae018d494621b123a5c78689f2231acdda09
MD5 10f832e45a04b3870b6ce9c6cb7e1b32
BLAKE2b-256 3981427edcd36c782293b63aa555598950d72e284d0ff0b63ecb8423943065a6

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 baadea8399d9d09998476347e08fca35d4a60bf8a23593a0fffaac7a0c4c4c29
MD5 eac24b6568e47eacb1d64cf908feed4e
BLAKE2b-256 2f995f659a293cd80b08a06feb890501a2778df23eae7f25ee4d534137614d59

See more details on using hashes here.

File details

Details for the file safetensors-0.3.1rc1-cp37-cp37m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.1rc1-cp37-cp37m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 8d7e52f7f1176589c3d309425c74a56865827b296882fd0dd37349dda4e6eed5
MD5 e962870095ac5a205d44b08903a0ac53
BLAKE2b-256 2bb017c8f913ec942a058b2f836c2def8c0f1bca1816b808d9c8924fbd7aa512

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page