[Refactor] Remove legacy stage_args YAML loader (#6200)

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-08-16 11:22:28 +08:00
1 parent 9d2bb23ff6
commit baba7d1e2e
12 files changed
+73 -164

No files matched your search

+9 -1
View File
@@ -1102,6 +1102,13 @@ class TestResolveScheduler:
class TestDeployConfigLoading:
def test_rejects_legacy_stage_args_schema(self, tmp_path):
deploy_path = tmp_path / "legacy.yaml"
deploy_path.write_text("stage_args:\n - stage_id: 0\n", encoding="utf-8")
with pytest.raises(ValueError, match=r"stage_args.*PipelineConfig.*stages"):
load_deploy_config(deploy_path)
def test_load_minicpmo_duplex_deploy_config(self):
deploy_path = Path(get_deploy_config_path("minicpmo_4_5_duplex.yaml"))
@@ -1377,7 +1384,8 @@ stages:
assert async_stages[1].custom_process_input_func is None
def test_no_bundled_legacy_stage_config_yamls(self):
stage_config_dir = Path(__file__).parent.parent / "vllm_omni" / "model_executor" / "stage_configs"
repo_root = Path(__file__).resolve().parents[2]
stage_config_dir = repo_root / "vllm_omni" / "model_executor" / "stage_configs"
assert not list(stage_config_dir.glob("*.yaml"))
def test_merge_pipeline_deploy(self):
@@ -3,19 +3,18 @@
"""Smoke test for HunyuanImage-3.0 Image-to-Text (I2T) pipeline."""
from collections.abc import Generator
from pathlib import Path
import pytest
import torch
from PIL import Image
from tests.helpers.runtime import OmniRunner
from tests.helpers.stage_config import get_deploy_config_path
from vllm_omni import Omni
from vllm_omni.diffusion.models.hunyuan_image3.prompt_utils import build_prompt
MODEL_NAME = "tencent/HunyuanImage-3.0-Instruct"
REPO_ROOT = Path(__file__).resolve().parents[3]
STAGE_CONFIG_PATH = REPO_ROOT / "vllm_omni" / "model_executor" / "stage_configs" / "hunyuan_image3_i2t.yaml"
DEPLOY_CONFIG_PATH = get_deploy_config_path("hunyuan_image3_ar.yaml")
# First 20 generated token IDs from the HF greedy reference on this input.
# vllm-omni AR output matches this prefix bitwise; the two implementations
@@ -45,14 +44,14 @@ EXPECTED_PREFIX_TOKEN_IDS: list[int] = [
# Decoded form, kept only for human-readable assertion messages.
EXPECTED_PREFIX_TEXT = "The image is a solid, uniform green color with no variations, objects, or details present. It"
pytestmark = [pytest.mark.full_model, pytest.mark.diffusion]
pytestmark = [pytest.mark.full_model, pytest.mark.diffusion, pytest.mark.cuda]
@pytest.fixture(scope="module")
def omni() -> Generator[Omni, None, None]:
with OmniRunner(
MODEL_NAME,
deploy_config=str(STAGE_CONFIG_PATH),
deploy_config=DEPLOY_CONFIG_PATH,
trust_remote_code=True,
) as runner:
yield runner.omni
@@ -492,6 +492,24 @@ def test_resolve_stage_configs_injects_additional_config_into_diffusion_stage(mo
assert stage_configs[1].engine_args.additional_config == {"torchair_graph_config": {"enabled": True}}
@pytest.mark.parametrize(
("legacy_arg", "value"),
[
("stage_configs_path", "legacy.yaml"),
("stage_configs", [{"stage_id": 0}]),
],
)
def test_resolve_stage_configs_rejects_legacy_config_arguments(legacy_arg, value):
engine = AsyncOmniEngine.__new__(AsyncOmniEngine)
with pytest.raises(ValueError, match=rf"`{legacy_arg}`.*`deploy_config`"):
engine._resolve_stage_configs(
"dummy-model",
{legacy_arg: value},
trust_remote_code=False,
)
def test_default_stage_config_includes_quantization_config():
"""Ensure structured quantization_config survives default diffusion-stage creation."""
quantization_config = {
+11 -62
View File
@@ -27,7 +27,7 @@ from vllm_omni.entrypoints.utils import (
filter_dataclass_kwargs,
filter_stages,
load_and_resolve_stage_configs,
load_stage_configs_from_yaml,
load_stage_configs_from_model,
resolve_model_config_path,
)
@@ -520,71 +520,20 @@ class TestLoadAndResolveStageConfigs:
assert filtered[0].final_output_type is None
class TestLoadStageConfigsFromYaml:
"""Regression tests for stage-config loading and merging."""
def test_deep_merges_stage_engine_args(self, mocker: MockerFixture):
yaml_config = create_config(
{
"async_chunk": True,
"stage_args": [
{
"stage_id": 0,
"runtime": {"device": 0},
"engine_args": {
"parallel_config": {"tensor_parallel_size": 4},
},
}
],
}
)
class TestLoadStageConfigsFromModel:
def test_unresolved_model_does_not_fall_back_to_yaml(self, mocker: MockerFixture, caplog):
mocker.patch(
"vllm_omni.entrypoints.utils.load_yaml_config",
return_value=yaml_config,
"vllm_omni.entrypoints.utils.StageConfigFactory.create_legacy_stage_configs_from_model",
return_value=(None, None),
)
resolve_path = mocker.patch("vllm_omni.entrypoints.utils.resolve_model_config_path")
stages = load_stage_configs_from_yaml(
"fake.yaml",
base_engine_args={
"parallel_config": {
"tensor_parallel_size": 1,
"pipeline_parallel_size": 2,
},
"model": "base-model",
},
)
result = load_stage_configs_from_model("unregistered-model", trust_remote_code=False)
merged_engine_args = stages[0]["engine_args"]
assert merged_engine_args["parallel_config"]["tensor_parallel_size"] == 4
assert merged_engine_args["parallel_config"]["pipeline_parallel_size"] == 2
assert merged_engine_args["model"] == "base-model"
assert merged_engine_args["async_chunk"] is True
def test_merges_nested_stage_engine_args(self, mocker: MockerFixture):
yaml_config = create_config(
{
"stage_args": [
{
"stage_id": 0,
"engine_args": {
"nested": {"override": 2},
},
}
],
}
)
mocker.patch(
"vllm_omni.entrypoints.utils.load_yaml_config",
return_value=yaml_config,
)
stages = load_stage_configs_from_yaml(
"fake.yaml",
base_engine_args={"nested": {"base": 1}},
)
assert stages[0]["engine_args"]["nested"]["base"] == 1
assert stages[0]["engine_args"]["nested"]["override"] == 2
assert result == ([], None)
resolve_path.assert_not_called()
assert "No registered PipelineConfig resolved" in caplog.text
assert "deploy_config" in caplog.text
class TestCumulativeStreamingCoercion: