tensorizer
A tool for fast PyTorch module, model, and tensor serialization + deserialization.
What it is and what it does
tensorizer is a PyTorch serialization library designed to decouple large models from container images and enable fast streaming loads from remote storage. It writes torch.nn.Module instances to a binary format that can be read back via HTTP/HTTPS, S3, Redis, or local filesystem, with streaming deserialization that avoids downloading entire models to disk first.
The package is built for serverless and containerized inference workflows where model load time directly impacts latency. By storing serialized models separately from container images, you can update models without rebuilding containers and stream weights directly into GPU memory. It supports local filesystem access for development, S3 for cloud object storage, and HTTP/HTTPS endpoints for any compatible server. Redis support is available but marked preliminary and not recommended for production model deployment.
Use it for:
- Reduce KNative serverless function cold-start latency by streaming large models from S3 instead of embedding them in container images.
- Deploy and update multi-gigabyte language models without rebuilding or redeploying container images.
- Load models directly into GPU memory from HTTP/HTTPS endpoints at network wire-speed without intermediate disk storage.
- Share model state between inference pods via Redis for per-request data loading.
- Serialize and deserialize models locally for development and testing with the same fast streaming path used in production.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Serializes and deserializes PyTorch modules and tensors to/from HTTP, HTTPS, S3, Redis, and local filesystem endpoints with streaming support for fast model loading.
Yes, if you deploy large PyTorch models in containerized or serverless environments and need to minimize load latency. The permissive MIT license, active maintenance, and zero known vulnerabilities make it safe to adopt. Install friction is low. Not necessary for single-machine development or models small enough to embed in container images.
Install
tensorizer on PyPI
pip
pip install tensorizeruv
uv add tensorizerpoetry
poetry add tensorizerInstalling tensorizer
Before you install
Low friction install with a pure-Python wheel. Maintenance is active with recent commits and stable production status. Eight runtime dependencies include torch, numpy, and cloud/storage libraries (boto3, redis, hiredis); libnacl requires a system libsodium library.
License in practice
MIT License (permissive) allows commercial and private use with minimal restrictions; attribution required but no copyleft obligations.
Quickstart
pip install tensorizer
from tensorizer import TensorDeserializer
import torch
deserializer = TensorDeserializer("s3://bucket/model.tensors", device="cuda")
deserializer.load_into_module(model)
deserializer.close()
libnacl requires system libsodium library; boto3 credentials needed for S3 access; torch and CUDA/CPU device setup required for deserialization.
Verify before relying
- Whether the ~5GB/s wire-speed claim applies to typical network conditions outside 40GbE lab environments.
- Redis support maturity and whether preliminary status affects production reliability.
- Memory overhead during serialization/deserialization of very large models.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — torch, numpy, protobuf, psutil, boto3, redis, hiredis, libnacl |
| Maintenance | actively maintained — 115 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 160,437/month — #10,661 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tensorizer-2.12.1-py3-none-any.whl
Keywords: tensorizer, machine learning, serialization, tensor, pytorch
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
safetensorsSerializes and deserializes tensors to and from…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
instanttensorInstantTensor provides a high-throughput…
permissive · top 15,000 on PyPI
comfy-aimdoA PyTorch VRAM allocator that dynamically…
unclear · top 5,000 on PyPI
s3torchconnectorProvides PyTorch dataset primitives and…
permissive · top 5,000 on PyPI
s3torchconnectorclientInternal S3 client implementation providing…
permissive · top 5,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
tensorlyTensorLy performs tensor decomposition, tensor…
permissive · top 15,000 on PyPI
litdataLitData optimizes and streams large datasets…
permissive · top 15,000 on PyPI
fastsafetensorsLoads safetensors model files significantly…
permissive · top 5,000 on PyPI