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

Uploaded Source

Built Distributions

safetensors-0.3.2rc1-cp311-cp311-win_amd64.whl (266.3 kB view details)

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 Windows x86

safetensors-0.3.2rc1-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.2rc1-cp311-cp311-macosx_12_0_arm64.whl (407.5 kB view details)

Uploaded CPython 3.11 macOS 12.0+ ARM64

safetensors-0.3.2rc1-cp311-cp311-macosx_10_11_universal2.whl (403.4 kB view details)

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

safetensors-0.3.2rc1-cp310-cp310-win_amd64.whl (266.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 Windows x86

safetensors-0.3.2rc1-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.2rc1-cp310-cp310-macosx_12_0_arm64.whl (407.5 kB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

safetensors-0.3.2rc1-cp310-cp310-macosx_11_0_x86_64.whl (403.4 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

safetensors-0.3.2rc1-cp39-cp39-win_amd64.whl (266.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 Windows x86

safetensors-0.3.2rc1-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.2rc1-cp39-cp39-macosx_12_0_arm64.whl (407.9 kB view details)

Uploaded CPython 3.9 macOS 12.0+ ARM64

safetensors-0.3.2rc1-cp39-cp39-macosx_11_0_x86_64.whl (403.7 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

safetensors-0.3.2rc1-cp38-cp38-win_amd64.whl (266.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

safetensors-0.3.2rc1-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.2rc1-cp38-cp38-macosx_11_0_x86_64.whl (403.9 kB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

safetensors-0.3.2rc1-cp37-cp37m-win_amd64.whl (266.4 kB view details)

Uploaded CPython 3.7m Windows x86-64

safetensors-0.3.2rc1-cp37-cp37m-win32.whl (258.7 kB view details)

Uploaded CPython 3.7m Windows x86

safetensors-0.3.2rc1-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.2rc1-cp37-cp37m-macosx_11_0_x86_64.whl (403.9 kB view details)

Uploaded CPython 3.7m macOS 11.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for safetensors-0.3.2rc1.tar.gz
Algorithm Hash digest
SHA256 2749d186c885dedcf0e733537b181e03c4f9000d6bc95084196e39a037040292
MD5 c3dd5a975b5f3eb83663f429f4a21995
BLAKE2b-256 2517ea1f3b77e019b37b21f2f2a59623e84d880db052c4cd2c78d709d4b794c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cf25ffb5b3bc739d88fb481c57066db87eccadddd949881787a1d17ce42f6484
MD5 a469f20f88d7b0a00198c51758fb32d7
BLAKE2b-256 b8f735b80f7bd2ff3b3cea6e797c6833fc4e340f3a267f786559db05ba8f08ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 17ff06ff697872160bc9dad7b69238c7ba2f86a86209fcdf28198727ad5995ce
MD5 7b3984748523c54912ee4ef4ffdd3645
BLAKE2b-256 a9e1614d44dfc0491754e838eae1b6512ebd499a181cef0133b07478ee591173

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 18b3c29bfed1cd5c7355f146f5c88d9a3eda307f07cf93f7915d058e3556aead
MD5 a7d38efdbb1457f762a0c6753a587215
BLAKE2b-256 746439ee2166127900670405edada10568bbcbf27a637b5ca6ea0375e5a2fe71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 d30203b0e9240289bd5c74fafcb5c132a7e73dac45961ec2da7313a01d33a3df
MD5 3fe01746d8462455194743b13453da31
BLAKE2b-256 7afbc3cf88b4f512624040c04e672af90975dfc0f0a4f03474f770ca3a70fc62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp311-cp311-macosx_10_11_universal2.whl
Algorithm Hash digest
SHA256 42bcd801c596df6e05133d9a537944bce749114ba65e16952be4330541211e86
MD5 c76f1c1ac944000bbe254097a27e06fa
BLAKE2b-256 3f79e944bf79023921c8644fb7c71543c3c4c825fd78f2d9e9ac96d38477c780

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d9b8e6ff81a2ea2eb73e36a8fd2ff01e499cb9743a37eda75402e182276960c6
MD5 633bc6d9d2b52776a81674dd3727cb19
BLAKE2b-256 1ac176f43a266d04dafb702754ecd26127a46fe88601ac96e3b80ff4f1feabcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 41a2e9c075c12f7cf4f3fbccf044a9c084b744468a60a8bef8a2c87c3c661b89
MD5 5057307f249a055f482832d0dc5ccdab
BLAKE2b-256 733131ec7a779847ef13cb40498b26ed10b9841ffa858b0b1288736af8df9c18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7edf73fb7cd98ef4a6d9d38d661f0b861cd4dc4e70ec31a77609720c57e03d4d
MD5 8d940b46424faa24b7291e6827075dd4
BLAKE2b-256 06187a1910420dd76d02b413e23780453e06a21f3ba208c1075e1608ac6c66d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 c3aee8111b0db343155e55cefb9ea74f05de544ba6bba8944914b933cb3ac562
MD5 359bc4c09e7a73399747806fac615faa
BLAKE2b-256 c5d5e00468ed80f00e6de0878289ee035efc43e7243947c51f120c3c71292f04

See more details on using hashes here.

File details

Details for the file safetensors-0.3.2rc1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f8626841b2fa89b6a44a0463ce4fc09ceb2716426a8c6ae662e5924dc71693c3
MD5 22df422b7a660d488408989b20012f17
BLAKE2b-256 3282973c0d01c16887ec1de41ec9db025f5c0365952792bae394775e8457e424

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9f2ccba67928cf182cbe5f9e5cf026aec9984bff958f049ad055054f0376295d
MD5 e325c601276d873b5a1f1b510f2749ab
BLAKE2b-256 9ac1765b1b0233e11149f47dae36866c713ca7e774b82eb1a3183612e57ea56d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 9400d31d6195af69c622ebb231aa0e6f8df5acefd460a73ae28d0cad64f7477a
MD5 2577c511a1c7c54c1ff1bed69c5c70d0
BLAKE2b-256 5fabe877dad741ab66fe4b78ce8a3aa2889dfc09e3e6d653831a4b54849d6b35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5ac081a0db041599568c55e682d099a0fea61b4cc5e1dd0be6abeb82fad57bb
MD5 acc9f42d7e8e8c4e2c7bed29063b7739
BLAKE2b-256 5628be35d0dd27844cec1a3ff020f96b107a52cd9b58b7f641589df3f1df89bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 8aa9bff19db5244f09f20ffe2774ca92135c6e0ea4abded1441a429b2d67980b
MD5 e921c07cd989dcae5d88164e9552fa77
BLAKE2b-256 54ef85c93084f9311e4c10e549c242033a8b63c8e5f59d96e52ed93cee4a41e8

See more details on using hashes here.

File details

Details for the file safetensors-0.3.2rc1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 945df64fa8154a36d5b94cb6a15f41581491c1384740c65ccf87443306cce336
MD5 ec6911bea5450e01900128d84dace8c9
BLAKE2b-256 e0ad51dea31008d685b0c932a79268a0906e3e5335d36b6a6e46529d78b78c9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 6750738032a4b6bea96cd4f9c05a0740b4dee5c62b370db25c353692c6f888a4
MD5 b4fed92d44846639b77331d5ef5830fd
BLAKE2b-256 20f9f5888278d184e45d83a95aed90dd6803d428362f6fb118692fa9ff63e56c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 6b263e4fd048076d4d2cbcb8060069c364c2dea80c7537a486ff30638c25bd97
MD5 d991646de909be6dc58a3097847753f8
BLAKE2b-256 989de652a201f30f357d404f276694aa474e8389ce4187855bef6c9ec342a471

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af9e329909a33197694e95e89c966e563aae8a3ebc9878325cd1f69222dd3569
MD5 198b5274fbc0915f3f786968d85190aa
BLAKE2b-256 c9a86af32e07795eeab8998f98398408c1e11e3b1343ee1f8beff030dfe9ab86

See more details on using hashes here.

File details

Details for the file safetensors-0.3.2rc1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 423bca374fa4569bbad22b45dbfd899aa96a1e874ff9e85daed41a2dd1df2966
MD5 0b9b9d1f6a3cab4ef580e80c487117d5
BLAKE2b-256 3277d6daabd0e240ad8b74cd409d225cd30a7f136ab7b23c623e1bf35f7871ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c5d542eb648eae9a93b7b581499ce2b2d9530fdb1fdc4a5473d46e1a93eccfe0
MD5 fe5601084cbd203c54b359c29c14c443
BLAKE2b-256 721a15d1d213e26f29c51919105262008d78c0ebe34ba8f25d7c767234949493

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 994762398dce99755d09e1870448d11d716817da3836d6cfabd4cf9011c1bf9a
MD5 71cc216ff9ce87b584d4db1f71249eae
BLAKE2b-256 94caf462564628b403d29f702c9a2a1569379b3685c43528485f9c87050bbcad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83e08429ff1009f60f328ddd45949a0ba8bb4e0eb7d264964d36b5dbed1615bd
MD5 b7a4bbb6c3471b587e0dd8c01f0c0ade
BLAKE2b-256 2662acd8872552e366a3d9d2cd213a175da7d642ec1ac4f40721d7cafd58a52c

See more details on using hashes here.

File details

Details for the file safetensors-0.3.2rc1-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.3.2rc1-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 d7972e726363f379b28ee4509415f8f146e3011c3f70d7dd09355aa7052997f9
MD5 8460b2594dea87bdf591acce5df1276d
BLAKE2b-256 87d01788cba652e48458f5dac3952349a29784e9f376b7bb40ded7dcf486e025

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