Skip to content
Back to skills

Vector Quantize Pytorch

ASecurity

"Route vector-quantize-pytorch tasks across PyTorch vector,

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
developmentpythongobashapidatabasebackend

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill vector-quantize-pytorch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vector Quantize Pytorch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vector Quantize Pytorch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-vector-quantize-pytorch/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-vector-quantize-pytorch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vector-quantize-pytorch
description: "Route vector-quantize-pytorch tasks across PyTorch vector,
  residual, scalar, lookup-free, latent, SimVQ, and hierarchical quantizer
  workflows."
disable-model-invocation: true
metadata:
  disco-role: operating
license: MIT
---

# vector-quantize-pytorch

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.

## Install and import baseline

```bash
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.

## Route by task

| 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](sub-skills/vector-quantization/SKILL.md) |
| `ResidualVQ`, `GroupedResidualVQ`, stacked residual codebooks, shared/stochastic codebooks, quantize dropout, beam search, DiVeQ, reconstruction from residual indices | [residual-quantizers](sub-skills/residual-quantizers/SKILL.md) |
| `FSQ`, `FSP`, `ResidualFSQ`, `GroupedResidualFSQ`, finite scalar levels, scalar index encoding/decoding, projections, FSP perturbation/norm/activation choices | [scalar-quantizers](sub-skills/scalar-quantizers/SKILL.md) |
| `LFQ`, `ResidualLFQ`, `GroupedResidualLFQ`, `LatentQuantize`, `BinaryMapper`, `EvoLFQ`, binary latents, entropy/diversity losses, latent levels | [lookup-free-and-latent](sub-skills/lookup-free-and-latent/SKILL.md) |
| `SimVQ`, `ResidualSimVQ`, frozen/implicit codebooks, `HierarchicalVQ`, multi-scale image feature-map quantization | [sim-and-hierarchical](sub-skills/sim-and-hierarchical/SKILL.md) |

## Shared references and checks

- [Package overview](references/package-overview.md) summarizes public API families, tensor layouts, return tuple conventions, and common selection rules.
- [Troubleshooting](references/troubleshooting.md) covers install/import failures, PyTorch backend choices, optional example dependencies, tensor shape/layout errors, reconstruction gotchas, and when to run sub-skill smoke helpers.
- [Repository provenance](references/repo-provenance.md) records the source snapshot used to create this skill; read it before deciding whether the skill is stale for another checkout.
- [Router metadata](references/repo-routing-metadata.json) is structured import metadata for the managed `repo-skills-router` if this skill is imported later.
- [Environment checker](scripts/check_vector_quantize_env.py) performs a safe CPU import and representative quantizer smoke check:

```bash
python scripts/check_vector_quantize_env.py --help
python scripts/check_vector_quantize_env.py
```

## Common operating rules

1. Choose the quantizer family first. `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.
2. Decide tensor layout before coding. Many APIs default to `(batch, sequence, dim)`; image/video APIs may require `accept_image_fmap=True`, `accept_3d_fmap=True`, `channel_first=True`, or a class-specific layout.
3. Treat return tuples as class-specific. Do not assume every quantizer returns `(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.
4. Use eval mode when generating indices for later reconstruction unless the workflow explicitly needs training-time stochastic sampling or dropout.
5. Do not run original tutorial training loops as quick checks. Use the bundled smoke scripts first; full examples can require dataset downloads, optional packages, and training time.
6. If a workflow spans families, read both sub-skills and keep ownership clear: for example, an audio tokenizer may combine residual routing with scalar or lookup-free details.

Files in this skill

  • SKILL.md4.8 KB
  • references/package-overview.md5.1 KB
  • references/repo-provenance.md1.6 KB
  • references/repo-routing-metadata.json361 B
  • references/troubleshooting.md4.4 KB
  • scripts/check_vector_quantize_env.py3.7 KB
  • sub-skills/lookup-free-and-latent/SKILL.md2.9 KB
  • sub-skills/lookup-free-and-latent/references/api-reference.md9.3 KB
  • sub-skills/lookup-free-and-latent/references/troubleshooting.md9.2 KB
  • sub-skills/lookup-free-and-latent/references/workflows.md7.7 KB
  • sub-skills/lookup-free-and-latent/scripts/smoke_lookup_free_latent.py8.1 KB
  • sub-skills/residual-quantizers/SKILL.md2.9 KB
  • sub-skills/residual-quantizers/references/api-reference.md9.5 KB
  • sub-skills/residual-quantizers/references/troubleshooting.md8.2 KB
  • sub-skills/residual-quantizers/references/workflows.md7.8 KB
  • sub-skills/residual-quantizers/scripts/smoke_residual_quantizers.py6 KB
  • sub-skills/scalar-quantizers/SKILL.md3.4 KB
  • sub-skills/scalar-quantizers/references/api-reference.md10.9 KB
  • sub-skills/scalar-quantizers/references/troubleshooting.md9 KB
  • sub-skills/scalar-quantizers/references/workflows.md7.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…