awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
lucidrains avatar

lucidrains/vector-quantize-pytorch

0
View on GitHub↗
3,968 stars·330 forks·Python·MIT·20 views

Vector Quantize Pytorch

This is a PyTorch library for implementing vector and scalar quantization to create discrete latent representations in neural networks. It provides a suite of modules and utilities for converting continuous vectors into discrete codes, supporting architectures such as vector quantized variational autoencoders.

The library features specialized mechanisms to maintain codebook health and efficiency, including random vector re-initialization to prevent codebook collapse and k-means centroid initialization to accelerate convergence. It supports diverse quantization strategies such as recursive residual quantization for higher resolution, multi-head parallel quantization for feature subspace division, and finite scalar quantization for creating hypercube codes.

The toolkit includes a differentiable quantization module that uses straight-through estimators and rotation tricks to enable backpropagation through non-differentiable quantization steps. Additional capabilities cover angular distance matching via cosine similarity, orthogonal regularization for feature translation, and latent space disentanglement through learnable scalar codebooks.

Features

  • Differentiable Quantization - A set of tools for estimating gradients through non-differentiable quantization steps using straight-through estimators and rotation tricks.
  • Vector Quantization - Implements core vector quantization mechanisms for mapping continuous latent vectors to discrete codebook entries.
  • Discrete Latent Representations - Converts continuous vectors into discrete codes to create categorical representations for machine learning.
  • Finite Scalar Quantization - Rounds each scalar into discrete levels to create a hypercube of codes and eliminate commitment losses.
  • Vector-Quantized VAEs - Supports building VQ-VAE architectures by mapping continuous latent spaces to a learnable codebook.
  • Representational Collapse Prevention - Prevents codebook collapse by ensuring inactive vectors are re-initialized to maintain high utilization.
  • Stochastic Gradient Estimators - Estimates gradients through non-differentiable quantization steps using straight-through estimators to enable backpropagation.
  • Quantization Gradient Estimators - Uses advanced estimators like the rotation trick to calculate gradients through non-differentiable quantization steps.
  • Straight-Through Estimators - Provides straight-through gradient estimation to enable backpropagation through non-differentiable quantization steps.
  • Residual Vector Quantizers - Implements residual vector quantizers that use multiple additive codebooks to refine representation precision.
  • Vector Quantization - Converts continuous latent vectors into discrete codebook entries using distance-based matching.
  • Scalar Quantization - Provides finite scalar quantization by rounding dimensions to discrete levels, creating hypercube codes.
  • Codebook Collapse Prevention - Prevents codebook collapse by replacing unused vectors with random samples from the current training batch.
  • Codebook Management - Provides tools for maintaining high utilization of embedding vectors and pruning inactive entries during training.
  • Multi-Head Quantization - Supports multi-head parallel quantization to divide input dimensions across independent codebooks.
  • Codebook Toolkits - Ships a toolkit for initializing codebooks with K-Means and preventing collapse via random vector replacement.
  • Disentanglement - Uses scalar quantization and binary latents to separate distinct data features within the latent space.
  • Latent Space Disentanglement - Assigns discrete code vectors using learnable scalar codebooks for each dimension to capture independent data features.
  • Implicit Quantization Code Generation - Produces discrete codes through linear projections using frozen codebooks to improve convergence and prevent collapse.
  • Codebook Initialization - Implements k-means centroid initialization to accelerate convergence by starting codebooks at data centroids.
  • Codebook Initializations - Sets initial codebook vectors using k-means centroids calculated from the first data batch to accelerate convergence.
  • Latent Scalar Quantization - Assigns discrete code vectors using a learnable scalar codebook for each dimension to improve feature separation.
  • Lookup-Free Quantization - Discretizes inputs using independent binary latents to remove the requirement for an embedding lookup table.
  • Multi-Head Quantization - Quantizes input dimensions across multiple heads using either shared or separate codebooks for each head.
  • Angular Distance Matching - Implements angular distance matching using L2 normalization and cosine similarity for codebook lookups.
  • Finite Scalar Quantization - Implements a finite scalar quantizer that rounds scalars into discrete levels to create hypercube codes.

Star history

Star history chart for lucidrains/vector-quantize-pytorchStar history chart for lucidrains/vector-quantize-pytorch

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Projects sharing features with Vector Quantize Pytorch

These projects share indexed features with Vector Quantize Pytorch. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • facebookresearch/encodecfacebookresearch avatar

    facebookresearch/encodec

    3,893View on GitHub↗

    EnCodec is a neural audio codec and compression tool designed to transform raw audio waveforms into discrete codes and reconstruct them back into sound. It functions as a system for neural audio representation, converting continuous audio signals into sequences of integer indices for use in generative AI tasks. The project utilizes a residual vector quantizer, which employs multiple layers of codebooks to represent audio signals with high precision at low bitrates. This approach allows the system to compress audio to discrete codes and perform low bitrate audio coding for efficient transmissi

    Python
    View on GitHub↗3,893
  • blei-lab/edwardblei-lab avatar

    blei-lab/edward

    4,841View on GitHub↗

    Edward is a probabilistic programming language and inference engine designed for building deep generative models and Bayesian neural networks. It utilizes the TensorFlow framework to represent probabilistic models as differentiable computational graphs. The library enables the construction of complex data distributions through Bayesian neural networks, mixture models, and Gaussian processes. It differentiates itself by providing an integrated toolkit for both supervised and unsupervised probabilistic modeling, including the implementation of generative adversarial networks and mixture density

    Jupyter Notebookbayesian-methodsdata-sciencedeep-learning
    View on GitHub↗4,841
  • borisdayma/dalle-miniborisdayma avatar

    borisdayma/dalle-mini

    14,756View on GitHub↗

    dalle-mini is a text-to-image model and generative AI system designed to transform natural language descriptions into synthetic images. It functions as an image generation training toolkit and a generative model capable of creating visual representations from text prompts. The project provides a containerized deployment for consistent execution across different computing environments. It includes the necessary scripts and configuration files to train custom generative models from datasets. The system utilizes an autoregressive transformer architecture that treats visual data as discrete toke

    Python
    View on GitHub↗14,756
  • asg017/sqlite-vecasg017 avatar

    asg017/sqlite-vec

    6,961View on GitHub↗

    sqlite-vec is a C-based vector library and SQLite extension that adds virtual tables for storing and querying high-dimensional embeddings. It functions as a database plugin for performing nearest neighbor searches using distance metrics such as L2, cosine, and Hamming distance. The project provides a portable embedding store that supports deployment across Android, iOS, desktop environments, and web browsers via WebAssembly. It distinguishes itself by converting numerical arrays into compact binary formats and utilizing quantization to reduce the memory footprint and storage size of vector in

    Csqlitesqlite-extension
    View on GitHub↗6,961
Compare all 30 related projects→

Frequently asked questions

What does lucidrains/vector-quantize-pytorch do?

This is a PyTorch library for implementing vector and scalar quantization to create discrete latent representations in neural networks. It provides a suite of modules and utilities for converting continuous vectors into discrete codes, supporting architectures such as vector quantized variational autoencoders.

What are the main features of lucidrains/vector-quantize-pytorch?

The main features of lucidrains/vector-quantize-pytorch are: Differentiable Quantization, Vector Quantization, Discrete Latent Representations, Finite Scalar Quantization, Vector-Quantized VAEs, Representational Collapse Prevention, Stochastic Gradient Estimators, Quantization Gradient Estimators.

Which projects share features with lucidrains/vector-quantize-pytorch?

Projects with overlapping indexed features include: facebookresearch/encodec — EnCodec is a neural audio codec and compression tool designed to transform raw audio waveforms into discrete codes and… blei-lab/edward — Edward is a probabilistic programming language and inference engine designed for building deep generative models and… borisdayma/dalle-mini — dalle-mini is a text-to-image model and generative AI system designed to transform natural language descriptions into… bytedance-seed/bagel. asg017/sqlite-vec — sqlite-vec is a C-based vector library and SQLite extension that adds virtual tables for storing and querying… facebookresearch/multimodal — Multimodal is a machine learning library built on PyTorch for training large-scale models that combine text, image,…