[Config] Return VllmOmniConfig from create_from_model (#4818)

Signed-off-by: zwhzzz0821 <2831474076@qq.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Yukim1andHongsheng Liu authored and GitHub committed 2026-07-18 09:21:07 +00:00
1 parent 907f932b72
commit 793d3e9ab7
56 files changed
+865 -282

No files matched your search

+16 -10
View File
@@ -49,6 +49,11 @@ _TEST_DEPLOY = DeployConfig(
@pytest.fixture()
def mock_stages(monkeypatch):
"""Register a fake pipeline and mock deploy YAML loading."""
from vllm_omni import platforms
platform = platforms.current_omni_platform
monkeypatch.setattr(platform, "device_name", "cpu", raising=False)
monkeypatch.setattr(platform, "device_type", "cpu", raising=False)
monkeypatch.setitem(OMNI_PIPELINES, _TEST_MODEL, _TEST_PIPELINE)
monkeypatch.setattr(
"vllm_omni.config.config_factory.load_deploy_config",
@@ -584,6 +589,12 @@ def test_cli_overrides_config(tmp_path):
### Integration tests for arg resolution through StageConfigFactory
#
# These tests still target the transitional legacy StageConfig path because the
# current runtime reads explicit CLI values from ``stage.runtime_overrides``.
# After RFC #4021 migrates engine startup to consume ``VllmOmniConfig`` directly,
# these assertions should move to the structured config/runtime boundary and the
# ``_create_legacy_from_registry`` calls should be removed.
def test_explicit_cli_arg_reaches_runtime_overrides(mock_stages):
"""Explicitly passed CLI values reach runtime_overrides on all stages."""
p = TrackingArgumentParser()
@@ -591,8 +602,7 @@ def test_explicit_cli_arg_reaches_runtime_overrides(mock_stages):
ns = p.parse_args(["--max-num-seqs", "999"])
explicit_kwargs = ns.get_explicit_kwargs_dict()
stages, _ = StageConfigFactory._create_from_registry(
_TEST_MODEL,
stages, _ = StageConfigFactory._create_legacy_from_registry(
_TEST_PIPELINE,
explicit_kwargs,
deploy_config_path=mock_stages,
@@ -608,8 +618,7 @@ def test_omitted_default_not_in_runtime_overrides(mock_stages):
ns = p.parse_args([])
explicit_kwargs = ns.get_explicit_kwargs_dict()
stages, _ = StageConfigFactory._create_from_registry(
_TEST_MODEL,
stages, _ = StageConfigFactory._create_legacy_from_registry(
_TEST_PIPELINE,
explicit_kwargs,
deploy_config_path=mock_stages,
@@ -630,8 +639,7 @@ def test_config_file_args_reach_runtime_overrides(mock_stages):
ns = p.parse_args(["--config", "fake.yaml"])
explicit_kwargs = ns.get_explicit_kwargs_dict()
stages, _ = StageConfigFactory._create_from_registry(
_TEST_MODEL,
stages, _ = StageConfigFactory._create_legacy_from_registry(
_TEST_PIPELINE,
explicit_kwargs,
deploy_config_path=mock_stages,
@@ -648,8 +656,7 @@ def test_per_stage_override_routes_correctly(mock_stages):
ns = p.parse_args(["--stage-0-gpu-memory-utilization", "0.42"])
explicit_kwargs = ns.get_explicit_kwargs_dict()
stages, _ = StageConfigFactory._create_from_registry(
_TEST_MODEL,
stages, _ = StageConfigFactory._create_legacy_from_registry(
_TEST_PIPELINE,
explicit_kwargs,
deploy_config_path=mock_stages,
@@ -670,8 +677,7 @@ def test_explicit_args_omitted_from_yaml(mock_stages):
ns = p.parse_args(["--enforce-eager"])
explicit_kwargs = ns.get_explicit_kwargs_dict()
stages, _ = StageConfigFactory._create_from_registry(
_TEST_MODEL,
stages, _ = StageConfigFactory._create_legacy_from_registry(
_TEST_PIPELINE,
explicit_kwargs,
deploy_config_path=mock_stages,