Port or add a model to SD.Next using a phased integration flow: select the least-new-code path that follows SD.Next conventions, then implement loader and routing updates, then validate.
57
66%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.github/skills/port-model/SKILL.mdRead the task, identify the model architecture and artifact layout, choose the integration path that requires the least amount of new code while adhering to SD.Next patterns, implement the loader and pipeline wiring, and validate the result.
pipelines/<model> package and loader.github/instructions/core.instructions.md for relevant core runtime and model porting guidance before proceeding.Prefer the smallest correct integration path.
pipelines/<model>.Before collecting inputs: If the model repository is gated (HTTP 403, access agreement required, or waiting list):
secrets.json in the workspace root for a huggingface_token fieldBefore editing anything, determine these facts:
If any of these remain unclear after reading the repo and source artifacts, ask concise clarifying questions before implementing.
Before implementing model-reference updates, explicitly ask the user which category the model belongs to:
basecloudquantdistillednunchakucommunityDo not guess this category. Use the user answer to decide which reference JSON file(s) to update.
Before implementing a pipeline, explicitly ask the user if the model already has an upstream Diffusers pipeline that can be reused. If not, ask for URL or path to a reference implementation that can be structurally copied.
Start by reading the task description, then inspect the closest matching implementations.
.github/copilot-instructions.md.github/instructions/core.instructions.mdpipelines/generic.pypipelines/model_*.py files similar to the target modelmodules/sd_models.pymodules/sd_detect.pymodules/modeldata.pyUseful examples by pattern:
pipelines/model_chroma.py, pipelines/model_z_image.pypipelines/f_lite/pipelines/model_z_image.py, pipelines/model_flux2_klein.pyUse this quick order before diving into detailed path requirements:
Use this path when the model already has a usable Diffusers pipeline and component classes.
Implement:
pipelines/model_<name>.pymodules/sd_models.py dispatch branchmodules/sd_detect.py filename autodetect branch if appropriatemodules/modeldata.py model type detection branchReuse:
generic.load_transformer(...)generic.load_text_encoder(...)sd_hijack_te.init_hijack(pipe) and sd_hijack_vae.init_hijack(pipe) where relevantUse this path when the model architecture, sampler, or prompt encoding is not available upstream.
Implement:
pipelines/<model>/__init__.pypipelines/<model>/model.pypipelines/<model>/pipeline.pypipelines/model_<name>.pymodules/sd_models.py, modules/sd_detect.py, and modules/modeldata.pyModel module responsibilities:
Pipeline module responsibilities:
DiffusionPipeline subclass__init__from_pretrainedencode_prompt or equivalent prompt preparation__call__If custom pipeline is provided by user, check it for accuracy and completness but do not assume it is perfect. Make necessary adjustments to fit SD.Next patterns and validate the result.
Fix all relative imports to be absolute and compatible with SD.Next repo structure, make sure that all imports are resolvable and make sure it passes ruff checks.
Use this path when the model source is not a normal Diffusers repository.
Requirements:
Do not fake a from_pretrained implementation that silently assumes missing subfolders exist.
Most new model families need all of these:
pipelines/model_<name>.py
Purpose: SD.Next loader entry pointmodules/sd_models.py
Purpose: route detected model type to the correct loadermodules/sd_detect.py
Purpose: detect model family from filename or repo namemodules/modeldata.py
Purpose: classify loaded pipeline instance back into SD.Next model typeAdd only what the model actually needs.
Reference catalog touchpoints are also required for model ports intended to appear in SD.Next model references.
data/reference-base.json for basedata/reference-cloud.json for clouddata/reference-quantized.json for quantdata/reference-distilled.json for distilleddata/reference-nunchaku.json for nunchakudata/reference-community.json for communityIf the model belongs to multiple categories, update each corresponding data/reference*.json file.
Possible extra integration points:
diffusers.pipelines.auto_pipeline.AUTO_*_PIPELINES_MAPPING when task switching matterspipe.task_args when SD.Next needs default runtime kwargs such as output_typeIn pipelines/model_<name>.py:
sd_models.path_to_repo(checkpoint_info)sd_models.hf_auth_check(checkpoint_info)model_quant.get_dit_args(...) for load argsdevices.dtypegeneric.load_transformer(...) and generic.load_text_encoder(...) when possiblepipe.task_args = {'output_type': 'np'} when the pipeline should default to numpy output for SD.Nextdevices.torch_gc(...)Do not hardcode assumptions about CUDA-only execution, local paths, or one-off environment state.
When building a custom pipeline:
diffusers.DiffusionPipelineDiffusionPipeline.register_modules(...)prompt, negative_prompt, generator, output_type, and return_dict when the task is text-to-image-likeDo not add generic Stable Diffusion arguments that the model does not support.
After implementation, validate in this order:
Always report what was validated and what was not.
When the user asks to add or port a model for references, also perform these steps:
data/reference*.json file(s) based on the user-confirmed category.models/Reference for the new model.Notes:
models/Reference (capital R).When porting a new model or model family to SD.Next, also update CHANGELOG.md:
## Update for 2026-04-10)Example format:
- [BRIA FIBO](https://huggingface.co/briaai/FIBO) 8B parameter text-to-image model using Flow Matching
includes *Normal*, *Edit*, and *Lite* (distilled) variants
features lightweight SmolLM3-3B text encoder with efficient inferencesd_models.py but not sd_detect.pymodules/modeldata.py still classifies the pipeline incorrectlyChromatorch_dtype or other loader args are passed twiceWhen using this skill, the final implementation should usually include:
058a7f0
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.