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.6.2.tar.gz (198.0 kB view details)

Uploaded Source

Built Distributions

safetensors-0.6.2-cp38-abi3-win_amd64.whl (320.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

safetensors-0.6.2-cp38-abi3-win32.whl (308.9 kB view details)

Uploaded CPython 3.8+Windows x86

safetensors-0.6.2-cp38-abi3-musllinux_1_2_x86_64.whl (656.0 kB view details)

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

safetensors-0.6.2-cp38-abi3-musllinux_1_2_i686.whl (692.3 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ i686

safetensors-0.6.2-cp38-abi3-musllinux_1_2_armv7l.whl (747.3 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARMv7l

safetensors-0.6.2-cp38-abi3-musllinux_1_2_aarch64.whl (652.3 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

safetensors-0.6.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (485.8 kB view details)

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

safetensors-0.6.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (520.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

safetensors-0.6.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (616.2 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64le

safetensors-0.6.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (485.1 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

safetensors-0.6.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (473.3 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

safetensors-0.6.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (521.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.5+ i686

safetensors-0.6.2-cp38-abi3-macosx_11_0_arm64.whl (432.2 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

safetensors-0.6.2-cp38-abi3-macosx_10_12_x86_64.whl (454.8 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for safetensors-0.6.2.tar.gz
Algorithm Hash digest
SHA256 43ff2aa0e6fa2dc3ea5524ac7ad93a9839256b8703761e76e2d0b2a3fa4f15d9
MD5 93863b3ae2a590ce7bacf1de80ad3862
BLAKE2b-256 accc738f3011628920e027a11754d9cae9abec1aed00f7ae860abbf843755233

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c7b214870df923cbc1593c3faee16bec59ea462758699bd3fee399d00aac072c
MD5 135b674a9f1894ac52f4e355ee69bb22
BLAKE2b-256 2cc3c0be1135726618dc1e28d181b8c442403d8dbb9e273fd791de2d4384bcdd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: safetensors-0.6.2-cp38-abi3-win32.whl
  • Upload date:
  • Size: 308.9 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.3

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 cab75ca7c064d3911411461151cb69380c9225798a20e712b102edda2542ddb1
MD5 114ad30fe02755c3bf870b82ad124cef
BLAKE2b-256 59a7e2158e17bbe57d104f0abbd95dff60dda916cf277c9f9663b4bf9bad8b6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d944cea65fad0ead848b6ec2c37cc0b197194bec228f8020054742190e9312ac
MD5 b7751f83fb81bf9ab9a65dec736f9ae9
BLAKE2b-256 adfecad1d9762868c7c5dc70c8620074df28ebb1a8e4c17d4c0cb031889c457e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 d83c20c12c2d2f465997c51b7ecb00e407e5f94d7dec3ea0cc11d86f60d3fde5
MD5 12b546a8a6d3397cac3a22e6e8657653
BLAKE2b-256 6852f7324aad7f2df99e05525c84d352dc217e0fa637a4f603e9f2eedfbe2c67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 fa48268185c52bfe8771e46325a1e21d317207bcabcb72e65c6e28e9ffeb29c7
MD5 23ff5bcb9fb8e54eeee54aca287c67b2
BLAKE2b-256 e929473f789e4ac242593ac1656fbece6e1ecd860bb289e635e963667807afe3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b0e4d029ab0a0e0e4fdf142b194514695b1d7d3735503ba700cf36d0fc7136ce
MD5 89dfe3fa30562cdee16ee2a758e82875
BLAKE2b-256 5a500057e11fe1f3cead9254315a6c106a16dd4b1a19cd247f7cc6414f6b7866

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8045db2c872db8f4cbe3faa0495932d89c38c899c603f21e9b6486951a5ecb8f
MD5 b0e2f498fa343f43a0920ea3499e76c6
BLAKE2b-256 fe5d5a514d7b88e310c8b146e2404e0dc161282e78634d9358975fd56dfd14be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 fc4d0d0b937e04bdf2ae6f70cd3ad51328635fe0e6214aa1fc811f3b576b3bda
MD5 2838366abe6ef77233480626d143f5bd
BLAKE2b-256 98c6affb0bd9ce02aa46e7acddbe087912a04d953d7a4d74b708c91b5806ef3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 89a89b505f335640f9120fac65ddeb83e40f1fd081cb8ed88b505bdccec8d0a1
MD5 0ecd1bdb98c18f8b9e2db116b3c61ef9
BLAKE2b-256 c95523f2d0a2c96ed8665bf17a30ab4ce5270413f4d74b6d87dd663258b9af31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 93de35a18f46b0f5a6a1f9e26d91b442094f2df02e9fd7acf224cfec4238821a
MD5 500c03303f240ee58819856afc3cc5ad
BLAKE2b-256 2af5be9c6a7c7ef773e1996dc214e73485286df1836dbd063e8085ee1976f9cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1d2d2b3ce1e2509c68932ca03ab8f20570920cd9754b05063d4368ee52833ecd
MD5 faf94f5f31a3ed0547b5c9e921934272
BLAKE2b-256 d38ef70c34e47df3110e8e0bb268d90db8d4be8958a54ab0336c9be4fe86dac8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 81e67e8bab9878bb568cffbc5f5e655adb38d2418351dc0859ccac158f753e19
MD5 46942d02c53306d32a5ffd3c5f96a94b
BLAKE2b-256 7a7b4fc3b2ba62c352b2071bea9cfbad330fadda70579f617506ae1a2f129cab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d6675cf4b39c98dbd7d940598028f3742e0375a6b4d4277e76beb0c35f4b843b
MD5 f6fac034a220fe00e57327fb0f305fa5
BLAKE2b-256 8cc9bb114c158540ee17907ec470d01980957fdaf87b4aa07914c24eba87b9c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.6.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9c85ede8ec58f120bad982ec47746981e210492a6db876882aa021446af8ffba
MD5 3badbfb0db5583e34aef09664dfce920
BLAKE2b-256 4db13f5fd73c039fc87dba3ff8b5d528bfc5a32b597fea8e7a6a4800343a17c7

See more details on using hashes here.

Supported by

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