com um clique
port-model
// Port or add a model to SD.Next using existing Diffusers and custom pipeline patterns. Use when implementing a new model loader, custom pipeline, checkpoint conversion path, or SD.Next model-type integration.
// Port or add a model to SD.Next using existing Diffusers and custom pipeline patterns. Use when implementing a new model loader, custom pipeline, checkpoint conversion path, or SD.Next model-type integration.
Port custom model pipeline implementations to Diffusers. Use when migrating custom or non-Diffusers pipeline code into SD.Next repo-local pipeline files such as pipelines/model_<name>.py or pipelines/<model>/pipeline.py while preserving behavior, avoiding new dependencies, and keeping device/attention handling configurable.
Update wiki markdown docs for syntax correctness, readability, link integrity, heading hierarchy normalization, and code block language tagging. Use when a user asks to clean up markdown formatting and improve clarity while preserving technical meaning.
Maintain and validate SD.Next model reference catalogs in data/reference*.json, including schema consistency, deduplication, link checks, and thumbnail alignment.
Create or edit code that is compliant with Hugging Face diffusers conventions, including models, pipelines, schedulers, tests, docs, and PR preparation targeting diffusers.
Analyze an external model URL (typically Hugging Face) to determine implementation style and estimate SD.Next porting difficulty using the port-model workflow.
Audit SD.Next model integrations end-to-end: loaders, detect/routing, reference catalogs, and pipeline API contracts.
| name | port-model |
| description | Port or add a model to SD.Next using existing Diffusers and custom pipeline patterns. Use when implementing a new model loader, custom pipeline, checkpoint conversion path, or SD.Next model-type integration. |
| argument-hint | Describe the source model, target task, checkpoint format, and whether the model already has a Diffusers pipeline |
Read the task, identify the model architecture and artifact layout, choose the narrowest integration path that matches existing SD.Next patterns, implement the loader and pipeline wiring, and validate the result.
pipelines/<model> package and loaderPrefer 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 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.json for basedata/reference-cloud.json for clouddata/reference-quant.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 inference
sd_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: