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

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

safetensors-0.8.0-cp310-abi3-win_arm64.whl (340.5 kB view details)

Uploaded CPython 3.10+Windows ARM64

safetensors-0.8.0-cp310-abi3-win_amd64.whl (355.5 kB view details)

Uploaded CPython 3.10+Windows x86-64

safetensors-0.8.0-cp310-abi3-win32.whl (342.4 kB view details)

Uploaded CPython 3.10+Windows x86

safetensors-0.8.0-cp310-abi3-musllinux_1_2_x86_64.whl (722.4 kB view details)

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

safetensors-0.8.0-cp310-abi3-musllinux_1_2_i686.whl (765.7 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

safetensors-0.8.0-cp310-abi3-musllinux_1_2_armv7l.whl (786.7 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

safetensors-0.8.0-cp310-abi3-musllinux_1_2_aarch64.whl (678.7 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

safetensors-0.8.0-cp310-abi3-manylinux_2_31_riscv64.whl (513.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.31+ riscv64

safetensors-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (516.0 kB view details)

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

safetensors-0.8.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (545.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

safetensors-0.8.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (633.5 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

safetensors-0.8.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (511.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

safetensors-0.8.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (502.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

safetensors-0.8.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl (559.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.5+ i686

safetensors-0.8.0-cp310-abi3-macosx_11_0_arm64.whl (484.6 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

safetensors-0.8.0-cp310-abi3-macosx_10_12_x86_64.whl (473.6 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: safetensors-0.8.0.tar.gz
  • Upload date:
  • Size: 325.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for safetensors-0.8.0.tar.gz
Algorithm Hash digest
SHA256 fabaf3e0f18a6618d9b36560682562157f77c2b71fcffc7b432be2baed9d753d
MD5 cc3153ba68ab58ecaeed111b22e772c4
BLAKE2b-256 4506f955dbbb1859e3bd23c8ac6141af5106e7ad5fedec4a3a6e3d60f94b7001

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 f7838e5135a406ad3e02efdcb8cf2e5397d368b0154537c4fec682dbc544d452
MD5 35a2ceb9e4bf5831edb94439fa47b567
BLAKE2b-256 8dfc7eedc3510d97878876e32774eebbeb61c43f148a96e915c84229a3e967aa

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 096ec1a98435df7beb08853bb5aa9081a84f23d0adc67ed1a0a10550f608373f
MD5 a9238f5429310b7f93b8c4294c485d13
BLAKE2b-256 1b6d3fba214c1e5e0f69991677ec3bc17023f0421776975e1de0c682dca475e2

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-win32.whl.

File metadata

  • Download URL: safetensors-0.8.0-cp310-abi3-win32.whl
  • Upload date:
  • Size: 342.4 kB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 2ddf52eac562eda224f99acfa7889d02968c1fd59a5b011ae7d8137c37e9c02d
MD5 dfaaa71e091f6d2be02c1273ada155e9
BLAKE2b-256 8e3f73ccf82579412b4a71c4ca673f10b5f1f888d7cf5af7fe24f27d30307be4

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8e080062fcde23be189565e1c3305d16751a218ecf9412c8601e64204eb6f846
MD5 e6efc6d2b2361122e3281081ea46de41
BLAKE2b-256 274341c1621732edd934d868a00d1b891584c892a7b62a9aab82ea5a0a5623ee

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 3ae091f16662658bdc019a4ff6cb4c085bb7d725eb5978b183ffd265863b6d2d
MD5 a755bb39c3854c212624e094b4e5ae7a
BLAKE2b-256 294b1c19c509d56e01f4fbb3d0a2e597450f6cc04d1d56cf52defb0a62dfd715

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 4a95ae2b05d7726d751da4ebf626a2ca782b706e101bd894c95bc2450b1cffcc
MD5 c949e87758ce7e6ed7ff01f7751565e8
BLAKE2b-256 72e368cd3fa5b48488e84add63e04cb12f3bc28ae4638c06d4508c6e88823d0e

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 87eec7ffed2b809f05a398a8becb7d013f19f7837cd15d9748580d6cf30dbaf4
MD5 6d39bebce5b7dcf45112c0e29dfed070
BLAKE2b-256 2a43bf38443278eab4b1be1fce2931e2b012ad9cb7df52ada751d0aab8f7659a

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-manylinux_2_31_riscv64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 fcdd41ec4628fee5799f807c73c353629130fbd942aa23d83c623dd6c9d52d78
MD5 e572a7ecc52bf2d0b5e6c6d187e5af59
BLAKE2b-256 46fbcdaed17ceb2948784fd9c36b6fd3e951b608547cea81a48e8ee6f8cfdfcb

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd6f3f93c9a0a7cc2788ee63fb763353d4bd2e89b0751bc78fcf7dda00bea774
MD5 1fb94956b4ea5c0a2c5f79543471f946
BLAKE2b-256 2850f203ff3a3ddfe19308efc83c5a3a29ed02bf786732ec35e68bf9162f3365

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 040070828e36dc8e122178bbbd5830ff9e97920affb84cbe0f46442497bed358
MD5 eca3a68921cd5c0a3c1563eb1d55ec1d
BLAKE2b-256 76228d64d9df2c45d5ded401df889d0ad90882804ca172d79ec4f0df8f727fe0

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 7bc0a787ba8a35be368ee3574edfa2b1ad389eebd0a72e482ae275490e3f6c98
MD5 47a4402e977c93ecdb97559637e1bd6d
BLAKE2b-256 2087846c289e7aa2299eff406335717cf43ce8777194ece8aad75772e0411615

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 4124502b78f03534117c848f87a39b8f31e577b15eff423bf8bfb95f2a8c30d0
MD5 a2e3cdc651772ca34658a8c39d7678da
BLAKE2b-256 914f3175c9d75634e0e0dda0082794193521035edd7c70a6f212bf33ca06ddf4

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7a46e5ff292c356d6991e60942ba7f79817682d3a2cef0702136448cb9c4d235
MD5 303490b122979f9dae0ec1d368ccdf90
BLAKE2b-256 097d65a7de0af421317bb36a067241e4235fff194eed60b961ed6d3f59a3fc60

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 8e9f537aa183a38ace122d27303dcd986b26bd2a7591f9181d7f0c396f4677ca
MD5 b2fffa71ab2826320ba23c28de8da0c6
BLAKE2b-256 0d491e15de264dcc3b77943d2d0c56a95809956883b1c2d6d585c792523f180b

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c80201d22cbf405b80647a60ada77bba06c8fba2da2743ba1e89cdcc39a81f25
MD5 d95f9865349c5bdf68f869bc86db1ecf
BLAKE2b-256 f5b1fa7c600e7dceae12e9606c7578cbc9ff1e1ed55844883ee5c92205e86226

See more details on using hashes here.

File details

Details for the file safetensors-0.8.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.8.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c554f85858e05226d3c2828e32395e677434685d6d94594a41643361c5e837f0
MD5 55e0560f15eb6acd1faf140a01314895
BLAKE2b-256 39a0f718cda65b05407d228f97602cf60dca269c979867aa5beb25410de26cd3

See more details on using hashes here.

Supported by

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