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.4.6.dev0.tar.gz (65.7 kB view details)

Uploaded Source

Built Distributions

safetensors-0.4.6.dev0-cp38-abi3-win_amd64.whl (297.3 kB view details)

Uploaded CPython 3.8+ Windows x86-64

safetensors-0.4.6.dev0-cp38-abi3-win32.whl (281.0 kB view details)

Uploaded CPython 3.8+ Windows x86

safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_x86_64.whl (614.3 kB view details)

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

safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_i686.whl (636.1 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ i686

safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_armv7l.whl (706.8 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARMv7l

safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_aarch64.whl (627.0 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARM64

safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (453.0 kB view details)

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

safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (521.5 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ s390x

safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (499.3 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64le

safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (448.9 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARMv7l

safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (442.2 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (477.2 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.5+ i686

safetensors-0.4.6.dev0-cp38-abi3-macosx_11_0_arm64.whl (396.2 kB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

safetensors-0.4.6.dev0-cp38-abi3-macosx_10_12_x86_64.whl (407.1 kB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for safetensors-0.4.6.dev0.tar.gz
Algorithm Hash digest
SHA256 19e12800440415cda9a2df9a9aec2b8404d8b6892ccb4c044fc70e8799928740
MD5 11eb9aee4ea676ea78b33db76de73430
BLAKE2b-256 06a3dc7639689cd44e56b942cf4a006dd617099b64bd4ea4b547c000837684fb

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e5a1fd9dc082f3d698f35de8d11b16752c04a944670a8c895714514134819d04
MD5 269b6f17a6208f746d71ca3c3afd3646
BLAKE2b-256 bd69f7ec9f9d60196d1a1a33a12ae1fac7d60d5ee450cbd1cb29a687f7f1b134

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-win32.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 56a9f6928bf7c9ee2e41babbc6264a46998bd01baa1b74a0e0acbc84cb83880c
MD5 ff0db2ce4029a7038cd85b9ec19dea32
BLAKE2b-256 3e3aa1abb8f57b69b1119e2ce484fdcd5f40147b734bf1decf5c0f2d059dc1b6

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 292e8507623c6815afa469b27bbaffa5f1fbdc8b7b208a5f738663814fbeb93c
MD5 27e2137f34f1d61e7b9a5bec660542a0
BLAKE2b-256 68b1afc3a4fba68512d09b0e097cadf19c2cebb59fc980ba06c14dd71461ce4f

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 a5f57fae2e0db4506be9922e0f139d1639273e5fcbf4e328702822c70336ebde
MD5 e43af6d18ae2c9fb31de95fbcd6011f2
BLAKE2b-256 c34e911d5bd7d107e1b730df82ea5d4cfe8c0e9704df82a6324ded29a07c7069

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 39a4b931640c4c39cb15a69f9a62af2e18b8537e3e8f5b76063546ce8c302c1e
MD5 e21b8fa0dfe7b3577e3a6933d3c3f3dd
BLAKE2b-256 9a3cb117ac6653ed5743ea190e4ac80490dd5e8177572a31414f3c3b8ada9049

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 35dfeaff83b4719970b4ef19d66e3857dac8944486443aecfab3bd447f6aaa74
MD5 7b72af2b7a7f5a30350ca6fc082206d3
BLAKE2b-256 e596b13fabb3a61f6ed5364b2e4a61bda26f2c7aab2363667843c110267b3803

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bdd51aeae4726cd6b301660f3013e1b1fe68670752933d2b4c4ef88595eb41f9
MD5 cc44eac7c37ba79c04207e4ebd5b55e4
BLAKE2b-256 1ca517ef92c368a622b3088ea3b3509b235d6f81673c868cac010edbde6afa35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 49a6aa7b8ca75a7c9b067a9a2454ecf8901588746959d308fc179faa5d955818
MD5 d0980928c7e58026ba5c081ea6b2de93
BLAKE2b-256 940ab5874a3d7b1e7a01f2569eaa999216df27d1d937a73140ab3b731724d76c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 cc4831901537e281ea4e7339b298019587152a8fe0c60e6368f4a52116359f3c
MD5 c45456b74759b88ef2ff4fd14c70d8e7
BLAKE2b-256 ebb9380045bae119bc5fca75eda4c7cdd553c037fae0c3367c0999d9155ccc3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 9d18ea7808ffd4821934937eaca134955cf2515e2755a3796a8d7f19f7bcd8c2
MD5 14f007aac396ca97494fa790c25d7e5a
BLAKE2b-256 f4ff954a1f689b3a356de78a5fe33ab3b1f1e40d3037d34db00b1ce57353a005

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6c41b1f9d191149c7cffe98f08fb6be41359c6d1ab556b74a540d09835e67c6b
MD5 26d29e83b1d1301ed9f5ef50161b84b4
BLAKE2b-256 7f33b25752c74c4856e513f36db020132eba40b266183fa72e1fc72fc7fc9ebb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 188f1b66e3ccbe830360489268817d3338ba44b5987dbf412ef6a89a96cba8f3
MD5 5f10f95e77b63eeea8000e5ae82c2497
BLAKE2b-256 0949d313b9bf8a42ab0b0e2c9df4a7597329bf85dae0191d251b0b39a5a7df33

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4851978dcf21d96b23f482a878e6d005422cf143d8c3d5452336aa8080a964c
MD5 1c34c50350ba8277a2ed4a372b5d51be
BLAKE2b-256 3c7bd69fbb7dd19ea06458b9e2de5ceb9082de851d6bea9d601567fb98fafb3c

See more details on using hashes here.

File details

Details for the file safetensors-0.4.6.dev0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for safetensors-0.4.6.dev0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d89a368c0932bea70fd587957acb3bfabf06834434cc7a2237235250ed6af700
MD5 cf67d437a24a0e570636284b6e6380e3
BLAKE2b-256 e6f89e53307aaae16b7885a9a19eeb830eedcd5a32ef91e99580b7a2208936d2

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