model-integration
Skill35k starsChanged 3 months agoApache-2.0View on GitHub
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.
1 other project uses a version of this.
Trending
Quiet since September.about the whole repository
Most recently taken up by
- GenielabsOpenSource/style-consistency-aitheir own version, first seen Aug 1, 2026
Who's talking about huggingface/diffusers
- A Hacker News story“Diffusers: Modular Diffusion model library from HuggingFace”Hacker News · Jul 21, 2022 · 47 points
- XavierXiao/Dreambooth-Stable-Diffusion“DreamBooth Stable Diffusion training now possible in 10 GB VRAM, and it runs about 2 times faster.”GitHub · Sep 26, 2022 · 42 reactions
- Comfy-Org/ComfyUI“[Feature] Support for SD3 ControlNet”GitHub · Jun 15, 2024 · 28 reactions
- AUTOMATIC1111/stable-diffusion-webui“[Feature Request]: Add newest DPM-Solver++”GitHub · Nov 4, 2022 · 25 reactions
- microsoft/vscode-remote-release“Remote Extension host terminated unexpectedly 3 times within the last 5 minutes.”GitHub · Mar 22, 2025 · 17 reactions
The biggest 5 of 38 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 38
Talked about on GitHub, Hacker News and Bluesky (38 times).
On GitHub · 31
- Sep 26, 2022DreamBooth Stable Diffusion training now possible in 10 GB VRAM, and it runs about 2 times faster. — XavierXiao/Dreambooth-Stable-Diffusion42 reactions · 52 comments
- Jun 15, 2024[Feature] Support for SD3 ControlNet — Comfy-Org/ComfyUI28 reactions · 10 comments
- Nov 4, 2022[Feature Request]: Add newest DPM-Solver++ — AUTOMATIC1111/stable-diffusion-webui25 reactions · 3 comments
- Mar 22, 2025Remote Extension host terminated unexpectedly 3 times within the last 5 minutes. — microsoft/vscode-remote-release17 reactions · 33 comments
- Oct 23, 2022Suggestion: Stable Diffusion Model — ggml-org/ggml13 reactions · 6 comments
26 more on GitHub
- Feb 3, 2026[Feat]: Anima support — Nerogar/OneTrainer12 reactions · 11 comments
- Dec 19, 2025feat: add qwen image layered support — leejet/stable-diffusion.cpp12 reactions · 4 comments
- Sep 9, 2025[RFC] [1.0] 🚀 huggingface_hub 1.0 release checklist — huggingface/huggingface_hub12 reactions · 1 comment
- Sep 28, 2022Support loading models created with diffusers — AUTOMATIC1111/stable-diffusion-webui12 reactions · 6 comments
- Mar 21, 2025🎉Glad to announce SANA-Sprint is available! — NVlabs/Sana10 reactions · 9 comments
- Jan 4, 2026[GLM-Image] AR Model Support for GLM-Image — huggingface/transformers9 reactions · 5 comments
- Dec 21, 2025[WIP] z-image-omni-base support — leejet/stable-diffusion.cpp9 reactions · 2 comments
- Jun 2, 2026feat: Add Anima support — ostris/ai-toolkit7 reactions · 5 comments
- Sep 18, 2026feat: add Qwen Image 2.1 support — leejet/stable-diffusion.cpp6 reactions · 1 comment
- Jan 16, 2026Flux2 Dev+Klein support — Nerogar/OneTrainer6 reactions · 24 comments
- Dec 15, 2025feat: add support for qwen image edit 2511 — leejet/stable-diffusion.cpp6 reactions · 2 comments
- Jun 9, 2026feat(policies): add Cosmos3 drafts — huggingface/lerobot5 reactions
- Dec 31, 2025Increase text length from 256 to 1024 in Qwen-Image — sgl-project/sglang5 reactions · 2 comments
- May 12, 2023[Unity][FX] Add support for PT2.0 scaled_dot_product_attention — apache/tvm5 reactions · 9 comments
- Sep 18, 2026[New model] Qwen-image-2.1 support — vllm-project/vllm-omni4 reactions · 13 comments
- Jun 4, 2024Serialization: support saving torch state dict to disk — huggingface/huggingface_hub4 reactions · 2 comments
- Mar 28, 2024Create pipeline_stable_diffusion_xl_instantid_img2img.py — instantX-research/InstantID4 reactions · 2 comments
- Aug 3, 2026Add MiniMax-H3 BF16 training and inference support — kohya-ss/musubi-tuner3 reactions · 26 comments
- Jan 12, 2026Support Z-image-omni-base — kohya-ss/musubi-tuner3 reactions · 7 comments
- Sep 10, 2024Add `TextToImage`, `StableDiffusion3Backbone` and `StableDiffusion3TextToImage` — keras-team/keras-hub3 reactions · 2 comments
- Apr 25, 2024Added Reward Backpropogation Support — huggingface/trl3 reactions · 12 comments
- Mar 31, 2024Add option to use Scheduled Huber Loss in all training pipelines to improve resilience to data corruption — kohya-ss/sd-scripts3 reactions · 29 comments
- Dec 6, 2023Feature/EulerScheduler — finegrain-ai/refiners3 reactions · 6 comments
- Oct 26, 2023Enable Latent Consistency models OpenVINO export and inference — huggingface/optimum-intel3 reactions · 1 comment
- Aug 19, 2022[Safety Checker] Add Safety Checker Module — CompVis/stable-diffusion3 reactions · 7 comments
- May 20, 2026Bump diffusers from 0.6.0 to 0.38.0 in the pip group across 1 directory — LaloLalo1999/UnstableFusion2 reactions
On Hacker News · 6
- Jul 21, 2022Diffusers: Modular Diffusion model library from HuggingFace47 points · 5 comments
- Apr 12, 2023V0.15.0 Beyond Image Generation7 points · 1 comment
- Aug 22, 2022Stable Diffusion Public Release6 points · 2 comments
- Aug 16, 2022HuggingFace Diffusers 0.2 with Stable Diffusion pipeline2 points · 1 comment
- Dec 7, 2023StableDiffusionSafetyChecker1 point
1 more on Hacker News
- Nov 3, 2022Diffusers 0.7.0: Stable Diffusion up to 2x faster on any hardware (including M1)says it tested it1 point · 1 comment
On Bluesky · 1
- Oct 25, 2024📦 huggingface / diffusers ⭐ 25,737 (+39) 🗒 Python 🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in… — @github-trending.bsky.social7 likes and reposts
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- GenielabsOpenSource/style-consistency-ai★ 9same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .ai/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- custom-blocksSkill
- diffusers-cliSkill
- self-reviewSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Before writing any code, gather info in this order:
- Very specific: line 21
Ask step 3 as an AskUserQuestion, with modular marked as the recommended default.
- Very specific: line 79
All weights load through the standard paths — from_pretrained, or from_single_file (add FromSingleFileMixin + a weight-mapping) for an …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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:
- 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 — default to modular. Modular Diffusers is the preferred implementation for new pipelines; the standard
DiffusionPipelineis 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_pretrainedsupport (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__.pyfiles (lazy imports) - Model-level tests (see Testing)
- Implement the model with
- 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__.pyfiles (lazy imports) - Pipeline-level tests (see Testing)
- Docs — see File structure
- Style —
make styleandmake quality
File structure
A new model PR roughly lands these files (the contents of pipelines/<model>/ and modular_pipelines/<model>/ live in their guides):
src/diffusers/
models/transformers/transformer_<model>.py # the model (or models/autoencoders/, models/unets/)
schedulers/scheduling_<model>.py # only if a custom scheduler is needed
loaders/lora_pipeline.py # LoRA mixin — add to the existing file
pipelines/<model>/ # standard pipeline — see pipelines.md
modular_pipelines/<model>/ # modular pipeline — see modular.md
tests/
models/transformers/test_models_transformer_<model>.py
pipelines/<model>/test_<model>.py
docs/source/en/
_toctree.yml # register the new pages in the docs index
api/models/<model>.md
api/pipelines/<model>.mdModel integration specific rules
Match the reference's numerical logic. Restructuring code to fit diffusers APIs (ModelMixin, ConfigMixin, blocks for modular, etc.) is expected, and required diffusers conventions (e.g. the attention pattern in models.md) take precedence. Beyond those, keep the actual computation as close to the reference as possible — don't reorder operations, change the math, or rename internals for aesthetics, even if it looks unclean. Small deviations make output mismatches very hard to track down.
Weight / Checkpoint Conversion
Convert the original checkpoint into diffusers format with a standalone script under scripts/ (e.g. scripts/convert_<model>_to_diffusers.py). The flow:
- Map the original state-dict keys to the diffusers module names (renames + any tensor surgery — see patterns below).
- Instantiate the diffusers model from its config and load the converted state dict.
save_pretrained(...)to a local path, then load it back withfrom_pretrainedto confirm it round-trips.
All weights load through the standard paths — from_pretrained, or from_single_file (add FromSingleFileMixin + a weight-mapping) for an original-format single checkpoint. No custom from_pretrained, no manual runtime loading. See the loading rule in models.md.
Common conversion patterns to watch for model-level components:
- 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
Testing
Two test layers must be added for any new pipeline: pipeline-level tests, and (if a new model is introduced) model-level tests. Conventions for both layers — file locations, tester mixins, dummy-component rules — live in testing.md; follow it when writing the tests.
Model parity test
Confirm the diffusers implementation matches the reference. Test each component on CPU/float32 with a strict tolerance (max_diff < 1e-3), comparing the freshly converted weights against the reference in a single script — both sides side by side, nothing saved to disk in between. See pitfalls.md for the common sources of numerical discrepancy.
This is an internal verification tool for integration — it should not be shipped in the PR (it imports the reference repo). The tests that ship with the PR are the model-level and pipeline-level tests in testing.md.
The example below is schematic (placeholder names). ReferenceModel is the component imported from the original repo, and convert_my_component is the same conversion function you wrote for the conversion script for the component. You should make sure both load the same checkpoint weights and run the same input, so any difference is a conversion or implementation bug — not a difference in inputs.
@torch.inference_mode()
def test_my_component():
# deterministic input — use the same shape & dtype the real model receives at this stage
gen = torch.Generator().manual_seed(42)
x = torch.randn(1, 16, 32, 32, generator=gen, dtype=torch.float32) # adjust to the real input shape
original_state_dict = load_original_weights(...) # the original checkpoint — both sides load these same weights
# reference: the original repo's implementation (load one model at a time to fit in CPU RAM)
ref_model = ReferenceModel(config) # ReferenceModel: imported from the original repo
ref_model.load_state_dict(original_state_dict, strict=True)
ref_model = ref_model.float().eval()
ref_out = ref_model(x).clone() # clone before freeing the model
del ref_model
# diffusers: convert those same weights with your conversion-script function, then run
diff_model = convert_my_component(original_state_dict) # convert_my_component: the fn from convert_<model>_to_diffusers.py
diff_model = diff_model.float().eval()
diff_out = diff_model(x)
max_diff = (ref_out - diff_out).abs().max().item()
assert max_diff < 1e-3, f"FAIL: max_diff={max_diff:.2e}"Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

