Cache-DiT is a PyTorch inference engine for DiT models, with caching, parallel processing, quantization, and CPU offloading. It is for running diffusion-model pipelines with support for systems and hardware such as Diffusers, SGLang Diffusion, vLLM-Omni, ComfyUI, NVIDIA GPUs, Ascend NPUs, and AMD GPUs.
Borrowing it
Nothing to install: this file belongs to vipshop/cache-dit. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/vipshop/cache-dit/main/.agents/skills/cache-dit-quantization/SKILL.mdgit clone --depth 1 https://github.com/vipshop/cache-ditWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/vipshop/cache-dit/cache-dit-quantization)<a href="https://agentmods.dev/skills/vipshop/cache-dit/cache-dit-quantization"><img src="https://agentmods.dev/badge/skills/vipshop/cache-dit/cache-dit-quantization/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/vipshop/cache-dit/cache-dit-quantization"><img src="https://agentmods.dev/badge/skills/vipshop/cache-dit/cache-dit-quantization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00106 | $0.04781 |
| Opus 5.5 | $0.00042 | $0.01912 |
| Sonnet 5.5 | $0.00021 | $0.00956 |
| Haiku 4.5 | $0.00011 | $0.00478 |
Grade A, and why
cache-dit-quantization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 221 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Cache-DiT 量化与后端接入
0. 任务路由
| 任务 | 判断依据 | 读哪里 |
|---|---|---|
| 选一种量化 / 跑通量化 | 只是调用 enable_cache / quantize |
§2、§3;用户文档以 docs/user_guide/QUANTIZATION.md 为唯一权威 |
| 调精度与显存 | 要动 regional / exclude / precision plan / fallback / observer | §4–§6 |
| 接入新量化后端或新 PTQ 工作流 | 要新增 src/cache_dit/quantization/<backend>/ 或改共享 config/dispatch |
§7–§11 |
| 改 SVDQ 算子或 GEMM 本身 | 动 csrc/kernels/svdq/ |
走 cache-dit-custom-kernel,本 skill 只管工作流与配置 |
代码、文档、CLI 三处描述同一个量化能力时,先改 docs/user_guide/QUANTIZATION.md,再同步本 skill;本 skill 只做索引与判据,不复制整段用户文档。
1. 代码地图
| 位置 | 职责 |
|---|---|
src/cache_dit/quantization/config.py |
QuantizeConfig 全部字段 + svdq_kwargs 的集中校验(_resolve_svdq_*)、DEFAULT_EXCLUDE_LAYERS |
src/cache_dit/quantization/backend.py |
QuantizeBackend 枚举(AUTO/TORCHAO/CACHE_DIT/NONE)与字符串别名解析 |
src/cache_dit/quantization/dispatch.py |
公共 quantize() / load() / remove_quantization_stats(),按 backend 分派 |
src/cache_dit/quantization/torchao/ |
TorchAO online 路径:quantize_ao.py(quant_type → AO config、过滤与 fallback)、_scaled_mm.py |
src/cache_dit/quantization/svdquant/ |
SVDQuant:ptq.py(校准 + 序列化 + load)、quantizer.py(DQ/PTQ 量化数学)、linear.py/fused.py(运行模块)、packing.py/lowrank.py/passes.py/dtensor.py |
src/cache_dit/quantization/observers.py |
逐层精度观察器(默认关闭) |
src/cache_dit/quantization/converter.py |
独立转换 CLI(cache-dit-convert,只支持 SVDQ _dq) |
src/cache_dit/_utils/utils.py |
CLI 参数与 maybe_quantize_transformer(--quantize-* → QuantizeConfig) |
docs/user_guide/QUANTIZATION.md |
用户文档:类型总表、各路径示例、observer 与 converter |
tests/quantization/ |
配置、observer、torchao、SVDQ(ptq/dq/quantizer/compile/padding/imports/offload)测试 |
2. 支持面(quant_type)
两条互不相干的路径,不要混用:
- TorchAO online quantization(
quant_type直接是 torchao 类型):float8_per_row(推荐)、float8_per_tensor、float8_per_block、float8_weight_only、int8_per_row、int8_per_tensor、int8_weight_only、int4_weight_only、nvfp4、nvfp4_weight_only。 - SVDQuant W4A4(
quant_type形如svdq_{int4,nvfp4}_r{rank}[_dq]):有_dq后缀是 DQ(无校准),无后缀是 PTQ(需要校准 + 可序列化)。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 221 lines · 106 tokens per session scan A de9db434da66
cache-dit-quantization is a skill published in the GitHub repository vipshop/cache-dit (1,300 stars, last pushed today), licensed Apache-2.0. It adds 106 tokens to every session and 4,781 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-06.
cache-dit-quantization compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| cache-dit-quantizationvipshop/cache-dit | Skill | 1.3k | today | Apache-2.0 | A | 106 | Claude Code |
| agent-platform-model-registrygoogle/skills | Skill | 22k | yesterday | Apache-2.0 | A | 60 | Claude Code, Codex |
| foundry-config-setupmicrosoft/agent-framework | Skill | 15k | yesterday | MIT | A | 65 | Claude Code, Codex |
| google-cloud-solution-agentic-analytics-spark-knowledge-cataloggoogle/skills | Skill | 22k | yesterday | Apache-2.0 | A | 132 | Claude Code, Codex |
| training-checkwanshuiyin/Auto-claude-code-research-in-sleep | Skill | 19k | 3d ago | MIT | A | 35 | Claude Code |
| nemo-automodel-launcher-configNVIDIA/skills | Skill | 3.9k | yesterday | Apache-2.0 | A | 30 | Claude Code |
| finetuningmicrosoft/skills | Skill | 3.2k | yesterday | MIT | A | 132 | Claude Code |