cache-dit-model-integration

A guide for adding a new DiT model to cache-dit, a system for running diffusion transformer image or video models with caching and parallel processing. It covers model integration, command-line use, installation, and testing.

In plain words
What is it for?
Adding support for a new diffusion model, adapting its pipeline and transformer code, configuring parallel execution, updating the generate command, and testing the integration.
Why use it?
It provides a defined integration process for connecting a new model to cache-dit's caching, device-parallel, text-encoder, and VAE features.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/vipshop/cache-dit/cache-dit-model-integration
Any agent
npx skills add vipshop/cache-dit --skill cache-dit-model-integration
Clone the repo
git clone --depth 1 https://github.com/vipshop/cache-dit

Made for: Claude Code, Codex.

Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 10,619 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00082 $0.10619
Opus 5 $0.00041 $0.05310
Sonnet 5 $0.00016 $0.02124
Haiku 4.5 $0.00008 $0.01062

Measured 3d ago against content hash 79835fd69363, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cache-dit-model-integration 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 3d ago.

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.

.copilot/skills/cache-dit-model-integration/SKILL.md · 525 lines

How it starts

The opening of the file, as written. The whole thing — 525 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GATE CHECK

Before writing any code, confirm the following:

STOP — Has the user provided BOTH of the following?
  1. A local model path (e.g., /workspace/dev/vipdev/hf_models/Krea-2-Turbo)
  2. The model's pipeline/transformer code info:
     - Pipeline class name (e.g., Krea2Pipeline, or third-party like BooguImagePipeline)
     - Transformer class name (e.g., Krea2Transformer2DModel)
     - File paths to the pipeline and transformer source code (diffusers or third-party)
  NO  → **MUST ask the user to specify these before proceeding.**
         Do NOT guess, search blindly, or assume defaults.
  YES → Continue.

STOP — Have you identified the new model's transformer architecture?
  NO  → Read the model's diffusers source code. Identify:
         - The ModuleList name(s) containing transformer blocks (e.g., transformer_blocks)
         - The block forward() signature (inputs and outputs)
  YES → Proceed to Cache (`./references/cache.md`) and CLI (`./references/cli.md`) in parallel.

Hard rules:

  • ⚠️ MANDATORY: Local model path and code info. If the user has not explicitly provided (a) the local model path and (b) the pipeline/transformer class names with source file paths (diffusers or third-party), you MUST ask the user to specify them via vscode_askQuestions before any code changes. Do NOT search the codebase or assume default paths — the user knows their setup best.
  • ⚠️ MANDATORY: Plan before code. Before writing ANY implementation code, you MUST: (1) thoroughly analyze the model's pipeline and transformer source code, (2) create a detailed integration plan following this skill's workflow and read the relevant references (Cache → CP → TP → TE-P → VAE-P → CLI → Testing), (3) present the plan to the user for review and approval. Do NOT start implementing until the user explicitly approves the plan. This prevents wasted effort from incorrect assumptions about the model architecture.
  • ALWAYS set up local model paths via environment variables BEFORE testing — downloading from HuggingFace Hub is extremely slow.
  • ALWAYS compute BOTH PSNR and SSIM when verifying correctness — PSNR alone cannot detect image corruption (garbled output).
  • For Python-only changes, pip install -e "." --no-build-isolation is sufficient; SVDQuant C++ compilation is NOT required.
  • Do NOT alter core dependency versions (torch, torchvision, transformers, diffusers, cache-dit, triton) in the cdit conda environment. Other dependencies may be installed only if they do not conflict with these.
  • Do NOT modify any code in the diffusers library. If a model requires patches (e.g., monkey-patching forward(), attention processors, etc.), write all patch code inside the cache-dit repository. Diffusers is a third-party dependency and must not be altered.
  • All examples in this skill are references, not templates to copy. Every model has unique architecture details (block signatures, tensor layouts, shared vs per-block modulation, attention mask requirements, etc.). Before following any example, first analyze whether the referenced model's architecture is actually comparable to the target model. Blindly copying an example that was designed for a different architecture will produce incorrect or broken code.
  • ControlNet parallelism is a special case and is NOT covered in this guide.
  • ⚠️ GQA attention backend pitfall: When a model uses GQA (e.g., num_heads=48, num_kv_heads=12), the dispatch_attention_fn(..., enable_gqa=True) path may cause PyTorch SDPA to fall back to a slow backend (math or an inefficient mem_efficient kernel) because flash-attention / cuDNN SDPA backends have limited GQA support. Always benchmark enable_gqa=True vs. manually repeating K/V heads to match Q heads and passing enable_gqa=False (MHA path). On NVIDIA L20, the MHA repeat gave a ~2.2× single-GPU speedup for Krea-2-Turbo (48 Q / 12 KV heads, 128 head_dim, 4608 seq). This is not CP-specific — any model with GQA should evaluate whether the repeat→MHA path is faster. If confirmed, apply the repeat unconditionally in the attention processor patch, not just in the CP path. Document the finding in the planner's docstring as well (see krea2.py for an example).

Read the full file on GitHub · 525 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

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.

  1. 3d ago First seen · 525 lines · 82 tokens per session scan A 79835fd69363

Subscribe to this mod's changes

cache-dit-model-integration is a skill published in the GitHub repository vipshop/cache-dit (1,262 stars, last pushed 5d ago), licensed Apache-2.0. It adds 82 tokens to every session and 10,619 once invoked, about $0.0004 per session on Opus 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-08-30.

Related

Other skills, from other repositories

agent-platform-model-registry

Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.

google/skills · 60 tokens

bigquery-ai-ml

Leverages BigQuery's built-in machine learning and GenAI capabilities for advanced data analytics. Use when you need to write SQL queries that perform time-series forecasting, predict values, detect outliers or anomalies, find key drivers, perform semantic search or vector search, classify text, calculate similarity…

google/skills · 104 tokens

ondb

A logical analysis and reasoning tool for AI. Use when decomposing documents into structured knowledge, querying entities and relations, validating consistency, or indexing files. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", "analyze this document", entity CRUD, or cross-skill…

x-cmd/x-cmd · 71 tokens

neuron-evaluation-engineer

Create and run AI evaluations with datasets, assertions, and output drivers in Neuron AI. Use this skill whenever the user mentions evaluation, testing AI systems, creating evaluators, dataset-driven testing, assertion-based validation, or wants to measure AI system performance. Also trigger for tasks involving…

neuron-core/neuron-ai · 77 tokens

sparse-autoencoder-training

Provides guidance for training and analyzing Sparse Autoencoders (SAEs) using SAELens to decompose neural network activations into interpretable features. Use when discovering interpretable features, analyzing superposition, or studying monosemantic representations in language models.

Orchestra-Research/AI-Research-SKILLs · 58 tokens

model-compatibility

Model family compatibility matrix covering loaders, resolutions, samplers, CFG, VAE, ControlNet, and LoRA compatibility for SD 1.5, SDXL, Flux, SD3, and video models.

artokun/comfyui-mcp · 47 tokens