@@ -12,12 +12,11 @@ though the runtime is split into separate folders.
1212The files are split by runtime responsibility. For a new model, read the
1313request path first:
1414
15- 1 . ` registry.py ` chooses the model family, sampling params, and pipeline config.
16- 2 . ` configs/pipeline_configs/{model}.py ` defines model-specific denoising and
15+ 1 . ` configs/pipeline_configs/{model}.py ` defines model-specific denoising and
1716 decoding behavior.
18- 3 . ` runtime/pipelines/{model}.py ` wires modules into stages.
19- 4 . ` runtime/pipelines_core/stages/ ` runs the shared stage logic.
20- 5 . ` runtime/models/ ` contains native model components only when the architecture
17+ 2 . ` runtime/pipelines/{model}.py ` wires modules into stages.
18+ 3 . ` runtime/pipelines_core/stages/ ` runs the shared stage logic.
19+ 4 . ` runtime/models/ ` contains native model components only when the architecture
2120 cannot be reused.
2221
2322That is the dependency direction. Avoid making a model PR that requires readers
@@ -124,7 +123,6 @@ behavior.
124123
125124| Area | Add or edit when | Typical file |
126125| --- | --- | --- |
127- | Registry | Always, unless extending an already registered family | ` python/sglang/multimodal_gen/registry.py ` |
128126| Runtime parameters | The request schema differs from existing models | ` configs/sample/{model}.py ` |
129127| Pipeline config | Denoising, decoding, precision, position encoding, or CFG hooks differ | ` configs/pipeline_configs/{model}.py ` |
130128| Pipeline wiring | The model needs a new stage layout or module list | ` runtime/pipelines/{model}.py ` |
@@ -137,11 +135,10 @@ behavior.
137135
138136For a new native architecture, the common minimum is:
139137
140- 1 . ` registry.py `
141- 2 . ` configs/sample/{model}.py `
142- 3 . ` configs/pipeline_configs/{model}.py `
143- 4 . ` runtime/pipelines/{model}.py `
144- 5 . ` runtime/models/dits/{model}.py `
138+ 1 . ` configs/sample/{model}.py `
139+ 2 . ` configs/pipeline_configs/{model}.py `
140+ 3 . ` runtime/pipelines/{model}.py `
141+ 4 . ` runtime/models/dits/{model}.py `
145142
146143Every extra file should map to model behavior that existing code cannot express
147144clearly.
@@ -499,19 +496,27 @@ native integration contract.
499496
500497### 6. Registry
501498
502- Register the family once the sampling params and pipeline config exist.
499+ Define a ` register() ` function in ` configs/pipeline_configs/{model}.py ` . The
500+ runtime auto-discovers it on startup and calls it to register the sampling
501+ params and pipeline config.
503502
504503``` python
505- register_configs(
506- model_family = " my_model" ,
507- sampling_param_cls = MyModelSamplingParams,
508- pipeline_config_cls = MyModelPipelineConfig,
509- hf_model_paths = [" org/my-model" ],
510- )
504+ # python/sglang/multimodal_gen/configs/pipeline_configs/my_model.py
505+ def register ():
506+ from sglang.multimodal_gen.registry import register_configs
507+
508+ register_configs(
509+ sampling_param_cls = MyModelSamplingParams,
510+ pipeline_config_cls = MyModelPipelineConfig,
511+ hf_model_paths = [" org/my-model" ],
512+ model_detectors = [lambda hf_id : " my-model" in hf_id.lower()],
513+ )
511514```
512515
513- The pipeline file is discovered through its ` EntryClass ` ; do not add a second
514- pipeline registry unless the existing registry requires it.
516+ ` model_detectors ` matches a model path or ` model_index.json ` ` _class_name ` when
517+ the Hugging Face path varies; see ` wan.py ` or ` qwen_image21.py ` for real
518+ examples. The pipeline file is discovered through its ` EntryClass ` ; do not add
519+ a second pipeline registry unless the existing registry requires it.
515520
516521## Verify the Port
517522
0 commit comments