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.dev0.tar.gz (235.5 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.dev0-cp310-abi3-win_arm64.whl (330.9 kB view details)

Uploaded CPython 3.10+Windows ARM64

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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

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

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

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

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.10+manylinux: glibc 2.31+ riscv64

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

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

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

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

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

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

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

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

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

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.10+manylinux: glibc 2.5+ i686

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

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

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: safetensors-0.8.0.dev0.tar.gz
  • Upload date:
  • Size: 235.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.1

File hashes

Hashes for safetensors-0.8.0.dev0.tar.gz
Algorithm Hash digest
SHA256 2fef351165bf4c5444d03855aea19f189017bd82a8efd1e5f1d5b81be2e9edec
MD5 27aef8ac91df32b775f6b6aa32fc89a2
BLAKE2b-256 f9f7b45910a18dd0048a6b5b16c16abe2558a25d4866d368a44523b07cf1de17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 486caeeb713c024b9ac6fa19ba2f47bf2846a73908d15d593559c11327944e52
MD5 461ee5ce7c5ba4f572d3afbf0368ccf6
BLAKE2b-256 8f0414be55c3ba2cef81b39a23791b76fd4da22bd43a2c29961f01c69a28acbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1642dc36a5737163c73488e1095d9763bc9d81482a1dd18ab2f5e0cbee78ad60
MD5 7d63fc9a76f542f03e262b5f46bc1640
BLAKE2b-256 4ccee64cf50da10f12b2ce15c2683fe78aecbd9e4b985e9c6dce407732c923d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 157b8a4feef1449aedfb308d32e0ba6dab082855199dd152253de882f495abd5
MD5 0721b75c4bd086654219f6c356af51c8
BLAKE2b-256 cdecd15060467ea072d68df4bab828ab20c20561cbc66822ca86423d3db00709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 274d5c9f6ef2abd7f5a948dd5a2c86ab2bef3ce207ff642c7a1f91b38279bbd4
MD5 85f85af9d4eec4203d4ba59bf2fc17b7
BLAKE2b-256 ec178d99b1e8dec97cc1dff4b801ae4da9ed0bd69ead958cce8a4af916d61bf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 f389f67402e07ae410a76d5ff442a1716e5cd99701571e0d09f3f93d09f3197c
MD5 af13a9aa18ec44efa7c851b3acd22f88
BLAKE2b-256 8b5f5129ddc1d9d66386a1fa6047c5b5e5b7ec694f57db9c2d60262b18097bb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 00f0d3e57080b3546bf4ae37e92da378fb52b433960b38cdfaa3ad6561a8e0d8
MD5 6f0240858b0d54afd15f10e389260b7b
BLAKE2b-256 d234d4eeb700f97d07407505537c56b6c82d83cc86413ed4c8bc3644a8d43bd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fd4791a46f14e2c048001261cc608dc5dac4993011da25d77a37bdbdd432d2e4
MD5 a26e3f941700871c99a66ef9775c358c
BLAKE2b-256 43eb9efef0ef7a9def2b70d797319215190017b4722ec0af14472ebe4fde1d76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 32021e07ed75dcac25319f3bb01f5b557d0999350c9d354e6d4f48c182fea80d
MD5 94a7aacbce50c4609cb50656838e9482
BLAKE2b-256 6fd14c2da1a2aceb91a4bf0631110e9155505aa67a731368db44999c98c3bbec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ce5eeb475d58114786cfa80f012a0946327197d58ddd2ba1f8951a9eda0cc30
MD5 5effacdd81d91a9a91291a1d30b5195f
BLAKE2b-256 6ad85fb23a7e69055e29156cb5d5b45099b3bdc1eebb23040a76093f32382d32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 ebe1806b77a360484802722c967bb0ea49a2d0de1b550b016e3747097fb45b50
MD5 ad78360946de2a7c6e8f1ba55e4db940
BLAKE2b-256 57351f9d4ce5143da13191ab5231a0f8438a7751f75a172e0249687d2f3ea243

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 1f90dd41d019edf03f7f187d3f44ba79f1cdd46aeb3c912a58fb5084e9b9f554
MD5 f72a8478e4ced2df7da981c346af80c9
BLAKE2b-256 3be0a68348930abbed72ed98d6dd324b7e509e6825e35c0228af01e471edd1ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 1d9a46dc1ff863623ef552741c651ba759ae71ac08a342c7693d3f0b5047a8da
MD5 0ca716eba3f5426b68d2f8d5090e3a2a
BLAKE2b-256 5508c330b6d91a9f7f2c16f993786c54bba78f54f1baef6c7832c84f08d89371

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3ce090ab869ff735c7228a8578ef4218d1692a51910a1930521177cdbbc556ce
MD5 4a7a0f4c6a17855dcf4cfa3a6653a595
BLAKE2b-256 9a395d8856470493d5ec79e74836028e8f0e5cd08c24c5aea5239d8cdb77449e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 adbaab720952eb0425325ddcd3173187ffe0106be0d6a103051320a3dddf9820
MD5 97d6e95dc95f0e2f20b5978b7dee6f05
BLAKE2b-256 653f979a5ffcb43120a53fd108222a4eef73c1f672cccd83072862135b568483

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 084e94dd8c338c84d980c195a9f63738e9d026559c3a4fbbdfb957cc32ba4c06
MD5 7be3cf8a7e2c54f65e7c9a460b5e27f1
BLAKE2b-256 26f67626ba2d11f66e47205c00db914e3262e8d04f5bd18fafaea3b665a43c12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.8.0.dev0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b2079dc49d38d62ff97c277bd37664ca557a0401db0b95b4907c27ecfdbf302a
MD5 a4a623694bfcf9c80a2ecd0048021c34
BLAKE2b-256 a4295aebdeb802e323659fd5a2032da9f13f2ce9277e4467ae74eb111e435f5e

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