ziptensors
Lossless, compressed containers for tensor files (safetensors, GGUF, ONNX, PyTorch zip and opaque files) with random access at tensor speed. Every restored file is bit-exact and proven by its BLAKE3 hash. This is the Python module of ziptensors; the command line tool and the Rust library live in the same repository.
Install
pip install ziptensors # the module
pip install "ziptensors[torch]" # with the PyTorch loader's dependency
Wheels are abi3 for CPython 3.11 and later on Linux (x86_64, aarch64), Windows (x64) and macOS. Other platforms build from the source distribution, which needs a Rust toolchain and a C compiler.
Write
import ziptensors
report = ziptensors.encode_file("model.safetensors", "model.ziptensors") # one file
print(report.output_len, report.total.stored)
# Several files; a (path, member name) pair names the member, a bare path uses the file name.
inputs = ["unet.safetensors", ("downloads/vae.safetensors", "vae/model.safetensors")]
ziptensors.pack(inputs, "pipeline.ziptensors")
mode is fast, balanced (the default of encode_file) or max (the default of pack). A new file
is decoded and compared with its source before it replaces anything at the output path.
Read
import ziptensors
container = ziptensors.Container("model.ziptensors", max_total_decoded=64 << 30)
member = container.member() # the only member; or container.member("name")
head = member.read(0, 4096)
for tensor in member.tensors:
print(tensor.name, tensor.dtype, tensor.shape)
member.restore_file("model.safetensors") # bit-exact copy of the original
Member.read_at(offset, buffer) and Member.decode_tensor_into(name, buffer) fill any writable buffer
(a bytearray, a numpy array) with the GIL released. Member.open() returns a seekable read-only file,
for example for torch.load.
Untrusted input: max_total_decoded has no default limit. Set it whenever a container comes from
somewhere else. The hashes detect damage; they do not authenticate a file.
PyTorch
import torch
from ziptensors.torch import load_state_dict
state = load_state_dict(container.member(), device="cuda", dtype=torch.float16)
Tensors are decoded in place into new torch tensors; on a CUDA or ROCm device the copy overlaps with
decoding through pinned staging buffers. ziptensors.torch.load_into(module, member) fills a module
built on the meta device. GGUF block-quantized tensors are refused by default; quantized="raw" or
quantized="diffusers" hands them over undecoded.
safetensors API
from ziptensors.safetensors import safe_open
with safe_open("model.ziptensors", framework="pt", device="cpu") as f:
for key in f.keys():
tensor = f.get_tensor(key)
rows = f.get_slice("embed.weight")[0:16]
safe_open reads a safetensors member the way safetensors.safe_open reads a file, with the
frameworks pt and np.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Metadata
Release files for ziptensors 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ziptensors-0.1.0.tar.gz | 422.0 kB | With provenance | Details for ziptensors-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| ziptensors-0.1.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for ziptensors-0.1.0-cp311-abi3-win_amd64.whl |
| ziptensors-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ x86-64 | Details for ziptensors-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl |
| ziptensors-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ ARM64 | Details for ziptensors-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl |
| ziptensors-0.1.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for ziptensors-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
| ziptensors-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for ziptensors-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 4.6 MB
Release files / ziptensors-0.1.0.tar.gz
| Download URL | ziptensors-0.1.0.tar.gz |
|---|---|
| Size | 422.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
295ddded701962677ef7513b12a8dedc293f078443fa699f0346f4554cdb0cfc
|
|
BLAKE2b-256 checksum How to use checksums |
9c907b41c938c2636a212b1bf93395f02ccbc854dd514aaf9fc0f4526ef77094
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / ziptensors-0.1.0-cp311-abi3-win_amd64.whl
| Download URL | ziptensors-0.1.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 680.1 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b0fa56e82b98bcd757cd6548057e39df76b894d02212670e5093e52ba98f818f
|
|
BLAKE2b-256 checksum How to use checksums |
c34dce004bedcb0e6d3eff88b032ad84c7ad66ef330cc6cba53d369732c7ae1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / ziptensors-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
| Download URL | ziptensors-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 941.0 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
27804e833b275072da5eb850bebeddd7eb2a77d2bea65c9e67d4530085484f2a
|
|
BLAKE2b-256 checksum How to use checksums |
268647dfd4a3c3f6a7bcedb575a87b04f3177e11961f1405f7ca568578e4bdcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / ziptensors-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl
| Download URL | ziptensors-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 899.7 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8818822c2d8fd4d701a7a443ac114e424a2ba4ef6f53775993926e9261342fe6
|
|
BLAKE2b-256 checksum How to use checksums |
ebf38bf126ac263eed8ce0055d74aead175f40a8a99088ddf0bbeacd16e8a6a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / ziptensors-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | ziptensors-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 777.0 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
623c098a4db3e3d2fac5e86297119eb345d8e664d5de65cb951f9d658f510f46
|
|
BLAKE2b-256 checksum How to use checksums |
c733fdac6af5be5d4c11bc95a43cb821909f1913d7b63ea8162019e2357c94d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / ziptensors-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | ziptensors-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 867.8 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a927f5a8719ff430190726d4f713bce716da73b72f718e5d209a6090b8b9abc3
|
|
BLAKE2b-256 checksum How to use checksums |
c3028c72009fdfbec39ae5e152c1c60e8c78f3ad7975a5008c767a8137ffa320
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logSecurity for ziptensors 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for ziptensors-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.