11# SPDX-License-Identifier: Apache-2.0
22# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33"""
4- Two-Tier Stage Configuration System for vLLM-Omni.
4+ Model Pipeline Configuration System for vLLM-Omni.
55
66Design Principles:
7- - Tier-1 (Pipeline Topology): INTERNAL ONLY - set by model developers at integration time
8- - Tier-2 (Runtime Config): User-configurable via CLI args (VllmConfig/OmniDiffusionConfig params)
7+ - Model Pipeline Config: INTERNAL ONLY - set by model developers at integration time.
8+ Defines pipeline structure (stages, types, data-flow).
9+ - Runtime Config: User-configurable via CLI args (VllmConfig/OmniDiffusionConfig params).
910
10- Users interact only with Tier-2 ( CLI). Tier-1 topology is bundled with models.
11+ Users interact only with CLI args. Pipeline config is bundled with models.
1112"""
1213
1314from __future__ import annotations
1920
2021from vllm .logger import init_logger
2122
22- from vllm_omni .config .yaml_util import create_config , load_yaml_raw , to_dict
23+ from vllm_omni .config .yaml_util import create_config , load_yaml_to_config , to_dict
2324from vllm_omni .model_executor .stage_topologies import get_topology_path
2425
2526logger = init_logger (__name__ )
@@ -39,10 +40,10 @@ class StageConfig:
3940 Note: Engine params (gpu_memory_utilization, tp_size, etc.) come from
4041 VllmConfig or OmniDiffusionConfig via CLI, NOT from this class.
4142
42- This class represents Tier-1 (Internal) configuration that is:
43+ This class represents pipeline configuration that is:
4344 - Set by model developers at integration time
4445 - NOT user-editable
45- - Defines pipeline topology , worker types, and processing hooks
46+ - Defines pipeline structure , worker types, and processing hooks
4647
4748 Attributes:
4849 stage_id: Unique identifier for this stage in the pipeline.
@@ -69,28 +70,28 @@ class StageConfig:
6970 # Stage type
7071 stage_type : StageType = StageType .LLM
7172
72- # Pipeline topology (Tier-1 - Internal , set by developer).
73+ # Pipeline topology (internal , set by developer).
7374 # Lists upstream stage IDs this stage receives data from.
7475 # Future: may be derived from StageTopology.edges for richer
7576 # edge metadata (e.g., data format, buffering policy).
7677 input_sources : list [int ] = field (default_factory = list )
7778
78- # Processing hooks (Tier-1 - Internal )
79+ # Processing hooks (internal )
7980 custom_process_input_func : str | None = None
8081
81- # Output configuration (Tier-1 - Internal )
82+ # Output configuration (internal )
8283 final_output : bool = False
8384 final_output_type : str | None = None # "text", "audio", "image"
8485
85- # Worker configuration (Tier-1 - Internal )
86+ # Worker configuration (internal )
8687 worker_type : str | None = None # "ar" or "generation"
8788 scheduler_cls : str | None = None
8889 hf_config_name : str | None = None
8990
9091 # Comprehension flag
9192 is_comprehension : bool = False
9293
93- # Runtime overrides (Tier-2 - populated from CLI, not from topology file )
94+ # Runtime overrides (populated from CLI, not from pipeline config )
9495 runtime_overrides : dict [str , Any ] = field (default_factory = dict )
9596
9697 def to_omegaconf (self ) -> Any :
@@ -111,7 +112,7 @@ def to_omegaconf(self) -> Any:
111112 if self .hf_config_name :
112113 engine_args ["hf_config_name" ] = self .hf_config_name
113114
114- # Apply runtime overrides from Tier-2 ( CLI args)
115+ # Apply runtime overrides from CLI args
115116 for key , value in self .runtime_overrides .items ():
116117 if key not in ("devices" , "max_batch_size" ):
117118 engine_args [key ] = value
@@ -144,7 +145,7 @@ def to_omegaconf(self) -> Any:
144145
145146@dataclass
146147class StageTopology :
147- """Internal Tier-1 topology - bundled with model, not user-editable.
148+ """Model pipeline topology - bundled with model, not user-editable.
148149
149150 This class represents the complete pipeline topology for a multi-stage model.
150151 It is defined by model developers and validated at integration time (not runtime).
@@ -218,12 +219,12 @@ def validate_topology(self) -> list[str]:
218219
219220
220221class StageConfigFactory :
221- """Factory merges Tier-1 pipeline topology with Tier-2 CLI overrides.
222+ """Factory merges model pipeline config with CLI overrides.
222223
223224 This factory is the main entry point for creating stage configurations.
224225 It handles:
225- - Loading internal Tier-1 pipeline topology files
226- - Merging CLI overrides (Tier-2) into stage configs
226+ - Loading model pipeline config files
227+ - Merging CLI overrides into stage configs
227228 - Supporting both single-stage and multi-stage models
228229 """
229230
@@ -247,7 +248,7 @@ def create_from_model(
247248
248249 Args:
249250 model: Model name or path.
250- cli_overrides: Tier-2 CLI overrides from VllmConfig/OmniDiffusionConfig.
251+ cli_overrides: CLI overrides from VllmConfig/OmniDiffusionConfig.
251252
252253 Returns:
253254 List of StageConfig objects with CLI overrides applied.
@@ -328,7 +329,7 @@ def create_default_diffusion(cls, kwargs: dict[str, Any]) -> list[dict[str, Any]
328329
329330 @classmethod
330331 def _load_topology (cls , model : str ) -> StageTopology | None :
331- """Load internal Tier-1 pipeline topology YAML for the model.
332+ """Load model pipeline config YAML for the model.
332333
333334 Args:
334335 model: Model name or path.
@@ -355,7 +356,7 @@ def _load_topology(cls, model: str) -> StageTopology | None:
355356
356357 @classmethod
357358 def _parse_topology_yaml (cls , path : Path , model_type : str ) -> StageTopology :
358- """Parse a Tier-1 pipeline topology YAML file.
359+ """Parse a model pipeline config YAML file.
359360
360361 Args:
361362 path: Path to the YAML file.
@@ -364,7 +365,7 @@ def _parse_topology_yaml(cls, path: Path, model_type: str) -> StageTopology:
364365 Returns:
365366 StageTopology object.
366367 """
367- config_data = load_yaml_raw (path )
368+ config_data = load_yaml_to_config (path )
368369
369370 stages : list [StageConfig ] = []
370371 for stage_data in config_data .stages :
0 commit comments