计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
vector-quantize-pytorch【效率与协作】Route vector-quantize-pytorch tasks across PyTorch vector, residual, scalar, lookup-free, latent, SimVQ, and hierarchical quantizer workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this repo skill when a task asks how to use, configure, debug, or validate the vector-quantize-pytorch package for neural discrete representations, VQ-VAE tokenizers, residual quantizers, finite scalar quantizers, lookup-free quantizers, latent quantizers, SimVQ, or hierarchical image feature-map quantization.
Do not use this skill for generic PyTorch training, unrelated LLM weight quantization, bitsandbytes/QLoRA quantization, vector databases, or nearest-neighbor search libraries unless the task explicitly involves vector-quantize-pytorch APIs.
pip install vector-quantize-pytorch
python - <<'PY'
import torch
from vector_quantize_pytorch import VectorQuantize
vq = VectorQuantize(dim=8, codebook_size=16)
x = torch.randn(1, 4, 8)
quantized, indices, loss = vq(x)
print(quantized.shape, indices.shape, loss.shape)
PY
The package imports as vector_quantize_pytorch. Base runtime dependencies are PyTorch, einops/einx utilities, and torch-einops-utils; the public package has no console entry point. Optional examples may need training-only packages such as torchvision, tqdm, fire, or x-transformers, but those are not needed for ordinary API use.
| Task signal | Read |
|---|---|
Single-stage learned codebooks, VectorQuantize, codebook size/dim, masks/lens, image or 3D feature maps, top-k/manual EMA, random projection quantizer, codebook health tricks | vector-quantization |
ResidualVQ, GroupedResidualVQ, stacked residual codebooks, shared/stochastic codebooks, quantize dropout, beam search, DiVeQ, reconstruction from residual indices | residual-quantizers |
FSQ, FSP, ResidualFSQ, GroupedResidualFSQ, finite scalar levels, scalar index encoding/decoding, projections, FSP perturbation/norm/activation choices | scalar-quantizers |
LFQ, ResidualLFQ, GroupedResidualLFQ, LatentQuantize, BinaryMapper, EvoLFQ, binary latents, entropy/diversity losses, latent levels | lookup-free-and-latent |
SimVQ, ResidualSimVQ, frozen/implicit codebooks, HierarchicalVQ, multi-scale image feature-map quantization | sim-and-hierarchical |
repo-skills-router if this skill is imported later.python scripts/check_vector_quantize_env.py --help
python scripts/check_vector_quantize_env.py
VectorQuantize/ResidualVQ are learned-codebook workflows; FSQ/FSP avoid learned embeddings; LFQ/LatentQuantize use binary or per-latent code values; SimVQ/HierarchicalVQ cover implicit/frozen and multi-scale image cases.(batch, sequence, dim); image/video APIs may require accept_image_fmap=True, accept_3d_fmap=True, channel_first=True, or a class-specific layout.(quantized, indices, loss): FSQ returns two values, FSP returns four, random projection returns indices only, and hierarchical APIs may return a list/tuple of indices.