Skip to content

Commit f8b0ba0

Browse files
lishunyang12hsliuustc0106fake0fangcanlinZJY0516
committed
[Config] Phase 1 configuration refactoring (RFC #870)
Introduce StageConfigFactory for typed, validated stage configuration creation. Replace raw dict manipulation with a centralized config factory that supports Tier-2 CLI overrides (gpu_memory_utilization, tensor_parallel_size, devices, enforce_eager, trust_remote_code). Centralize all OmegaConf usage into vllm_omni/config/yaml_util.py with wrapper functions (load_yaml, load_yaml_raw, create_config, merge_configs, to_dict). - Add vllm_omni/config/stage_config.py with StageConfigFactory - Add vllm_omni/config/yaml_util.py as single OmegaConf entry point - Update entrypoints (omni.py, serve.py, omni_stage.py) to use factory - Add end2end.py example with CLI override support - Add config factory and YAML parsing unit tests - Add qwen3_omni_moe stage topology YAML Co-authored-by: hsliu <liuhongsheng4@huawei.com> Co-authored-by: Chenguang ZHENG <645327136@qq.com> Co-authored-by: gcanlin <canlinguosdu@gmail.com> Co-authored-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: wuhang <wuhang6@huawei.com> Co-authored-by: xiedeyantu <czjourney@163.com> Co-authored-by: Gaohan123 <hgaoaf@connect.ust.hk> Co-authored-by: root <tzhouam@connect.ust.hk> Signed-off-by: lishunyang <lishunyang12@163.com>
1 parent 5fea482 commit f8b0ba0

File tree

12 files changed

+1459
-50
lines changed

12 files changed

+1459
-50
lines changed

examples/offline_inference/qwen3_omni/end2end.py

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from vllm.multimodal.image import convert_image_mode
2222
from vllm.utils.argparse_utils import FlexibleArgumentParser
2323

24+
# Import StageConfigFactory for Tier-2 CLI override testing
2425
from vllm_omni.entrypoints.omni import Omni
2526

2627
SEED = 42
@@ -325,11 +326,30 @@ def main(args):
325326
else:
326327
query_result = query_func()
327328

329+
# Build kwargs with Tier-2 CLI overrides
330+
omni_kwargs = {
331+
"stage_configs_path": args.stage_configs_path,
332+
"log_stats": args.log_stats,
333+
"stage_init_timeout": args.stage_init_timeout,
334+
}
335+
336+
# Add Tier-2 CLI overrides if specified
337+
if args.gpu_memory_utilization is not None:
338+
omni_kwargs["gpu_memory_utilization"] = args.gpu_memory_utilization
339+
if args.tensor_parallel_size is not None:
340+
omni_kwargs["tensor_parallel_size"] = args.tensor_parallel_size
341+
if args.devices is not None:
342+
omni_kwargs["devices"] = args.devices
343+
if args.enforce_eager:
344+
omni_kwargs["enforce_eager"] = args.enforce_eager
345+
if args.trust_remote_code:
346+
omni_kwargs["trust_remote_code"] = args.trust_remote_code
347+
if args.stage_id is not None:
348+
omni_kwargs["stage_id"] = args.stage_id
349+
328350
omni_llm = Omni(
329351
model=model_name,
330-
stage_configs_path=args.stage_configs_path,
331-
log_stats=args.log_stats,
332-
stage_init_timeout=args.stage_init_timeout,
352+
**omni_kwargs,
333353
)
334354

335355
thinker_sampling_params = SamplingParams(
@@ -489,6 +509,12 @@ def parse_args():
489509
default="output_audio",
490510
help="[Deprecated] Output wav directory (use --output-dir).",
491511
)
512+
parser.add_argument(
513+
"--output-dir",
514+
type=str,
515+
default=None,
516+
help="Output directory for generated files (text and audio).",
517+
)
492518
parser.add_argument(
493519
"--num-prompts",
494520
type=int,
@@ -505,7 +531,44 @@ def parse_args():
505531
"--stage-configs-path",
506532
type=str,
507533
default=None,
508-
help="Path to a stage configs file.",
534+
help="Path to a stage configs file. If not specified, uses auto-detected Tier-1 topology.",
535+
)
536+
# Tier-2 CLI override arguments
537+
parser.add_argument(
538+
"--gpu-memory-utilization",
539+
type=float,
540+
default=None,
541+
help="GPU memory utilization for all stages (Tier-2 override). Example: 0.9",
542+
)
543+
parser.add_argument(
544+
"--tensor-parallel-size",
545+
type=int,
546+
default=None,
547+
help="Tensor parallel size for all stages (Tier-2 override). Example: 2",
548+
)
549+
parser.add_argument(
550+
"--devices",
551+
type=str,
552+
default=None,
553+
help="Device assignment for stages (Tier-2 override). Example: '0,1'",
554+
)
555+
parser.add_argument(
556+
"--enforce-eager",
557+
action="store_true",
558+
default=False,
559+
help="Enforce eager mode for all stages (Tier-2 override).",
560+
)
561+
parser.add_argument(
562+
"--trust-remote-code",
563+
action="store_true",
564+
default=False,
565+
help="Trust remote code for model loading (Tier-2 override).",
566+
)
567+
parser.add_argument(
568+
"--stage-id",
569+
type=int,
570+
default=None,
571+
help="Launch only the specified stage ID for independent stage testing.",
509572
)
510573
parser.add_argument(
511574
"--video-path",

tests/utils/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project

0 commit comments

Comments
 (0)