vector-quantize-pytorch
Vector Quantization - Pytorch
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT License, and offers low install friction. It is well-suited for anyone implementing vector quantization in PyTorch, particularly for generative modeling. The Beta status suggests research-grade rather than production-hardened, so verify compatibility with your specific PyTorch and Python versions before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a pure Python wheel and four runtime dependencies (einops, einx, torch-einops-utils, torch).
- Package is actively maintained with recent release and no known vulnerabilities.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution with only attribution required, suitable for both open-source and commercial projects.
last release 2026-08-02 (12 days) · last repo commit 2026-08-02 · 3,995 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,830,185 downloads/mo, #3,511 on PyPI
Alternatives
Verify before relying
pip install vector-quantize-pytorch
import torch
from vector_quantize_pytorch import VectorQuantize
vq = VectorQuantize(
dim = 256,
codebook_size = 512,
decay = 0.8,
commitment_weight = 1.
)
x = torch.randn(1, 1024, 256)
quantized, indices, commit_loss = vq(x)- Performance characteristics (speed, memory usage) compared to other quantization implementations
- Compatibility with specific PyTorch versions beyond the stated Python 3.9+ requirement
- Production-readiness status beyond the Beta development classifier
What it is and what it does
Vector-quantize-pytorch provides PyTorch implementations of vector quantization techniques originally from DeepMind's TensorFlow codebase. It includes the core VectorQuantize layer for single-stage quantization and ResidualVQ for multi-stage hierarchical quantization, both using exponential moving averages to update learned codebooks. The library also offers variants like GroupedResidualVQ and supports modern techniques such as DiVeQ gradient-based updates, kmeans initialization, rotation-trick gradient estimation, and strategies to combat dead codebook entries.
The package is designed for researchers and practitioners building generative models that require discrete latent representations—particularly image and audio generation systems. It handles the forward pass mapping continuous vectors to nearest codebook entries and provides configurable loss terms and gradient computation methods. Dependencies on einops, einx, and torch-einops-utils suggest heavy use of tensor reshaping and Einstein notation for flexible multi-dimensional operations.
Use it for
- Building VQ-VAE models for image compression and generation with discrete latent codes
- Implementing audio codecs that use residual quantization across multiple stages
- Constructing RQ-VAE architectures with shared codebooks and stochastic sampling for image synthesis
- Experimenting with grouped quantization to reduce codebook overhead while maintaining reconstruction quality
- Training models with kmeans-initialized codebooks to improve early convergence and codebook utilization
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, carries a permissive MIT License, and offers low install friction. It is well-suited for anyone implementing vector quantization in PyTorch, particularly for generative modeling. The Beta status suggests research-grade rather than production-hardened, so verify compatibility with your specific PyTorch and Python versions before relying on it in production.
Install
vector-quantize-pytorch on PyPI
Before you install
Low install friction with a pure Python wheel and four runtime dependencies (einops, einx, torch-einops-utils, torch). Package is actively maintained with recent release and no known vulnerabilities.
License in practice
MIT License permits unrestricted use, modification, and distribution with only attribution required, suitable for both open-source and commercial projects.
Quickstart
pip install vector-quantize-pytorch
import torch
from vector_quantize_pytorch import VectorQuantize
vq = VectorQuantize(
dim = 256,
codebook_size = 512,
decay = 0.8,
commitment_weight = 1.
)
x = torch.randn(1, 1024, 256)
quantized, indices, commit_loss = vq(x)
Verify before relying
- Performance characteristics (speed, memory usage) compared to other quantization implementations
- Compatibility with specific PyTorch versions beyond the stated Python 3.9+ requirement
- Production-readiness status beyond the Beta development classifier
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packageseinopseinxtorch-einops-utilstorch |
| Maintenance | Actively maintained 12 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,830,185 / month, #3,511 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.6Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: vector_quantize_pytorch-1.31.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “vector quantization pytorch”
- vector-quantize-pytorchImplements vector quantization layers for PyTorch, enabling discrete…
- optimum-quantoA PyTorch quantization backend that reduces model size and memory by…
- torchaoTorchAO applies quantization and sparsity techniques to PyTorch…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also vit-pytorch · rotary-embedding-torch · compressed-tensors · diffq · axial-positional-embedding · aqtp · CoLT5-attention · hyper-connections · optimum-quanto · ai-edge-quantizer