yfyang007/controllight/model-integration
Claude Code and agent skill by yfyang007/controllight
- community
Checking that the SKILL.md file is still in the repository.
Use when adding a new model or pipeline to diffusers, setting up file structure for a new model, converting a pipeline to modular format, or converting weights for a new version of an already-supported model.
Install
npx vskill@latest install yfyang007/controllight/model-integrationSKILL.md
Goal
Integrate a new model into diffusers end-to-end. The overall flow:
- Gather info — ask the user for the reference repo, setup guide, a runnable inference script, and other objectives such as standard vs modular.
- Confirm the plan — once you have everything, tell the user exactly what you'll do: e.g. "I'll integrate model X with pipeline Y into diffusers based on your script. I'll run parity tests (model-level and pipeline-level) using the
parity-testingskill to verify numerical correctness against the reference." - Implement — write the diffusers code (model, pipeline, scheduler if needed), convert weights, register in
__init__.py. - Parity test — use the
parity-testingskill to verify component and e2e parity against the reference implementation. - Deliver a unit test — provide a self-contained test script that runs the diffusers implementation, checks numerical output (np allclose), and saves an image/video for visual verification. This is what the user runs to confirm everything works.
Work one workflow at a time — get it to full parity before moving on.
Setup — gather before starting
Before writing any code, gather info in this order:
- Reference repo — ask for the github link. If they've already set it up locally, ask for the path. Otherwise, ask what setup steps are needed (install deps, download checkpoints, set env vars, etc.) and run through them before proceeding.
- Inference script — ask for a runnable end-to-end script for a basic workflow first (e.g. T2V). Then ask what other workflows they want to support (I2V, V2V, etc.) and agree on the full implementation order together.
- Standard vs modular — standard pipelines, modular, or both?
Use AskUserQuestion with structured choices for step 3 when the options are known.
Standard Pipeline Integration
File structure for a new model
Integration checklist
- [ ] Implement transformer model with
from_pretrainedsupport - [ ] Implement or reuse scheduler
- [ ] Implement pipeline(s) with
__call__method - [ ] Add LoRA support if applicable
- [ ] Register all classes in
__init__.pyfiles (lazy imports) - [ ] Write unit tests (model, pipeline, LoRA)
- [ ] Write docs
- [ ] Run
make styleandmake quality - [ ] Test parity with reference implementation (see
parity-testingskill)
Model conventions, attention pattern, and implementation rules
See ../../models.md for the attention pattern, implementation rules, common conventions, dependencies, and gotchas. These apply to all model work.
Model integration specific rules
Don't combine structural changes with behavioral changes. Restructuring code to fit diffusers APIs (ModelMixin, ConfigMixin, etc.) is unavoidable. But don't also "improve" the algorithm, refactor computation order, or rename internal variables for aesthetics. Keep numerical logic as close to the reference as possible, even if it looks unclean. For standard → modular, this is stricter: copy loop logic verbatim and only restructure into blocks. Clean up in a separate commit after parity is confirmed.
Test setup
- Slow tests gated with
@slowandRUN_SLOW=1 - All model-level tests must use the
BaseModelTesterConfig,ModelTesterMixin,MemoryTesterMixin,AttentionTesterMixin,LoraTesterMixin, andTrainingTesterMixinclasses initially to write the tests. Any additional tests should be added after discussions with the maintainers. Usetests/models/transformers/test_models_transformer_flux.pyas a reference.
Modular Pipeline Conversion
See modular-conversion.md for the full guide on converting standard pipelines to modular format, including block types, build order, guider abstraction, and conversion checklist.
Weight Conversion Tips
<!-- TODO: Add concrete examples as we encounter them. Common patterns to watch for:
- Fused QKV weights that need splitting into separate Q, K, V
- Scale/shift ordering differences (reference stores [shift, scale], diffusers expects [scale, shift])
- Weight transpositions (linear stored as transposed conv, or vice versa)
- Interleaved head dimensions that need reshaping
- Bias terms absorbed into different layers
Add each with a before/after code snippet showing the conversion. -->
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdiffusers/.ai/skills/model-integration/SKILL.md
Popularity
- Repository stars
- 108
- Repository forks
- 10
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/yfyang007/controllight/model-integration)