model-integration

A guided process for adding a new machine-learning model or pipeline to Diffusers, an open-source library for diffusion models.

In plain words
What is it for?
Setting up model files, converting pipelines or weights, and adding support for new model versions.
Why use it?
It gives the work a defined order and checks that the new implementation matches the original model's results.

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/huggingface/diffusers/model-integration
Any agent
npx skills add huggingface/diffusers --skill model-integration
Clone the repo
git clone --depth 1 https://github.com/huggingface/diffusers

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,861 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.00045 $0.01861
Opus 5 $0.00023 $0.00931
Sonnet 5 $0.00009 $0.00372
Haiku 4.5 $0.00005 $0.00186

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

Security

Grade A, and why

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 2d 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.

.ai/skills/model-integration/SKILL.md · 124 lines

How it starts

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

Goal

Integrate a new model into diffusers end-to-end, to full numerical parity with the reference implementation — one workflow at a time.

Setup — gather before starting

Before writing any code, gather info in this order:

  1. 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.
  2. 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.
  3. Standard vs modulardefault to modular. Modular Diffusers is the preferred implementation for new pipelines; the standard DiffusionPipeline is still supported but no longer the default. We prefer modular especially for models that don't fit a fixed task-based structure (modality baked into the checkpoint) or that are actively evolving.

Ask step 3 as an AskUserQuestion, with modular marked as the recommended default.

Once you have everything, confirm the plan with the user before implementing — state exactly what you'll do, e.g. "I'll integrate model X with pipeline Y based on your script, and verify the model matches the reference before considering it done."

Then work through the Integration checklist below

Integration checklist

A pipeline in Diffusers (be it standard or modular) will have multiple components. These components can be models, schedulers, processors, etc.

  • Transformer model
    • Implement the model with from_pretrained support (conventions: models.md)
    • Convert weights (see Weight / Checkpoint Conversion)
    • Parity test against the reference (internal, not shipped — see Model parity test)
    • Register in the relevant __init__.py files (lazy imports)
    • Model-level tests (see Testing)
  • VAE (if applicable) — reuse an existing AutoencoderKL* if possible; if a new one is needed, follow the same sub-steps as the transformer
  • Scheduler — reuse an existing scheduler, or add a custom one
  • Pipeline
    • Implement the pipeline — see modular.md for modular pipeline, or pipelines.md for standard pipeline
    • Add a LoRA mixin if applicable
    • Register in the relevant __init__.py files (lazy imports)
    • Pipeline-level tests (see Testing)
  • Docs — see File structure
  • Stylemake style and make quality

Read the full file on GitHub · 124 lines

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. 2d ago First seen · 124 lines · 45 tokens per session scan A 16faeacecc0b

Subscribe to this mod's changes

model-integration is a skill published in the GitHub repository huggingface/diffusers (34,407 stars, last pushed 2d ago), licensed Apache-2.0. It adds 45 tokens to every session and 1,861 once invoked, about $0.0002 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