compressed-tensors
Library for utilization of compressed safetensors of neural network models
What it is and what it does
compressed-tensors extends the safetensors format to create a single, standardized way to store compressed neural network models. Rather than each quantization technique (GPTQ, AWQ, SmoothQuant, INT8, FP8, etc.) having its own checkpoint format, this library provides a unified representation that can handle weight-only quantization, activation quantization, KV cache quantization, and both unstructured and semi-structured sparsity patterns.
You use it to save quantized models to disk and load them back, eliminating the friction of supporting multiple compression formats. The library integrates with Hugging Face models and PyTorch, so you can apply post-training quantization, calibrate on data, compress weights, and save the result in a single consistent format that downstream inference engines can understand.
Use it for:
- Save a quantized LLM checkpoint after post-training quantization (PTQ) in a format that multiple inference engines can load
- Experiment with different quantization schemes (W4A16, W8A8, etc.) on the same model without managing separate storage formats
- Build a model deployment pipeline that accepts compressed-tensors checkpoints and applies them uniformly across different quantization methods
- Store both weight and activation quantization metadata alongside compressed weights for reproducible model optimization
- Handle semi-structured sparsity patterns (e.g., 2:4 sparsity) alongside quantization in a single unified checkpoint
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a unified format for storing and loading compressed neural network tensors, supporting multiple quantization and sparsity schemes like GPTQ, AWQ, SmoothQuant, INT8, and FP8.
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem in the LLM deployment pipeline—unifying the fragmented landscape of quantization formats. If you work with quantized models or need to support multiple compression schemes, it's a practical choice.
Install
compressed-tensors on PyPI
pip
pip install compressed-tensorsuv
uv add compressed-tensorspoetry
poetry add compressed-tensorsInstalling compressed-tensors
Before you install
Low friction installation with a pure Python wheel. Active maintenance with a recent release and steady commit activity. Depends on torch, transformers, pydantic, loguru, and psutil—all standard packages in the ML ecosystem.
License in practice
Licensed under Apache 2.0 (permissive), allowing commercial use, modification, and distribution with minimal restrictions.
Quickstart
pip install compressed-tensors
from compressed_tensors.quantization import QuantizationConfig, apply_quantization_config
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("model_name", device_map="cuda:0")
config = QuantizationConfig.parse_file("config.json")
apply_quantization_config(model, config)
Requires torch and transformers to be installed; GPU recommended for typical use cases.
Verify before relying
- Whether the package requires specific versions of torch or transformers, or works across a range of versions
- Whether there are system-level dependencies needed beyond the listed Python packages
Package facts
| License | Apache 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — torch, transformers, pydantic, loguru, psutil |
| Maintenance | actively maintained — 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,323,086/month — #1,753 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: compressed_tensors-0.18.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
model-compression-toolkitCompresses and optimizes neural networks…
permissive · top 15,000 on PyPI
nvidia-modeloptApplies state-of-the-art model optimization…
permissive · top 15,000 on PyPI
llmcompressorllmcompressor optimizes large language models…
permissive · top 15,000 on PyPI
nncfNNCF provides post-training and training-time…
permissive · top 5,000 on PyPI
vector-quantize-pytorchImplements vector quantization layers for…
permissive · top 5,000 on PyPI
safetensorsSerializes and deserializes tensors to and from…
permissive · top 1,000 on PyPI
torchaoTorchAO applies quantization and sparsity…
unclear · top 5,000 on PyPI
optimum-quantoA PyTorch quantization backend that reduces…
permissive · top 15,000 on PyPI
comfy-kitchenComfy Kitchen provides optimized GPU kernels…
permissive · top 5,000 on PyPI
fastsafetensorsLoads safetensors model files significantly…
permissive · top 5,000 on PyPI