[Bugfix] Give model CLI flags typed owners in the Omni config (#7390)

Signed-off-by: Guangjian <hiro20833@gmail.com>
Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
Guangjian Dongandamy-why-3459 authored and GitHub committed 2026-09-12 12:00:15 +08:00
1 parent 220366db00
commit 4a7a8454ba
2 files changed
+76

No files matched your search

+50
View File
@@ -271,6 +271,44 @@ def test_from_pipeline_config_rejects_unowned_deploy_engine_extras(engine_extras
VllmOmniConfig.from_pipeline_config(pipeline, user_deploy_config=deploy)
_MODEL_CLI_FLAGS = {
"served_model_name": "omni",
"allowed_local_media_path": "/data",
"allowed_media_domains": ["example.com"],
"max_logprobs": 7,
"logprobs_mode": "processed_logprobs",
"mm_processor_kwargs": {"max_slice_nums": 1},
"mm_processor_cache_type": "shm",
"hf_token": "hf_test",
"hf_config_path": "/models/config",
"generation_config": "vllm",
"override_generation_config": {"temperature": 0.5},
"enable_prompt_embeds": True,
}
@pytest.mark.parametrize("model_type", ["minicpmo_4_5", "qwen3_tts"])
@pytest.mark.parametrize(("field", "value"), list(_MODEL_CLI_FLAGS.items()), ids=list(_MODEL_CLI_FLAGS))
def test_from_pipeline_config_owns_model_cli_fields(model_type, field, value):
config = _from_pipeline_key(model_type, cli_overrides={field: value})
for stage in config.stage_configs:
assert getattr(stage.model_config, field) == value
def test_model_cli_fields_reach_typed_engine_args(monkeypatch):
from vllm_omni.engine import stage_init_utils
from vllm_omni.engine.stage_init_utils import build_engine_args_dict_from_omni_stage_config
# Worker discovery requires hardware support; this test covers config transport.
monkeypatch.setattr(stage_init_utils, "resolve_worker_cls", lambda engine_args: None)
config = _from_pipeline_key("minicpmo_4_5", cli_overrides=dict(_MODEL_CLI_FLAGS))
engine_args = build_engine_args_dict_from_omni_stage_config(config.stage_by_id(0), model="test-model")
assert {field: engine_args.get(field) for field in _MODEL_CLI_FLAGS} == _MODEL_CLI_FLAGS
@pytest.mark.parametrize("stage_id", [0, 2], ids=["ar", "generation"])
def test_llm_additional_config_roundtrip_and_isolation(stage_id, monkeypatch):
from vllm_omni.engine import stage_init_utils
@@ -723,6 +761,18 @@ def test_sub_config_fields_match_structured_scopes():
"model_subdir",
"tokenizer_subdir",
"requires_full_payload_input",
"served_model_name",
"allowed_local_media_path",
"allowed_media_domains",
"max_logprobs",
"logprobs_mode",
"mm_processor_kwargs",
"mm_processor_cache_type",
"hf_token",
"hf_config_path",
"generation_config",
"override_generation_config",
"enable_prompt_embeds",
}
vllm_load_fields = {f.name for f in fields(VllmLoadConfig)}
assert issubclass(OmniStageLoadConfig, VllmLoadConfig)
+26
View File
@@ -168,6 +168,19 @@ class _ModelEngineOverrides(TypedDict, total=False):
enable_broadcast_weight_load: bool
num_weight_load_threads: int
disable_autocast: bool
# Upstream ModelConfig inputs that users pass as global CLI flags.
served_model_name: str | list[str]
allowed_local_media_path: str
allowed_media_domains: list[str]
max_logprobs: int
logprobs_mode: str
mm_processor_kwargs: dict[str, Any]
mm_processor_cache_type: str
hf_token: bool | str
hf_config_path: str
generation_config: str
override_generation_config: dict[str, Any]
enable_prompt_embeds: bool
class _LoadEngineOverrides(TypedDict, total=False):
@@ -445,6 +458,19 @@ class OmniStageModelConfig(_TrackExplicitConfigFields):
model_subdir: str | None = None
tokenizer_subdir: str | None = None
requires_full_payload_input: bool = False
# Upstream ModelConfig inputs that users pass as global CLI flags.
served_model_name: str | list[str] | None = None
allowed_local_media_path: str | None = None
allowed_media_domains: list[str] | None = None
max_logprobs: int | None = None
logprobs_mode: str | None = None
mm_processor_kwargs: dict[str, Any] | None = None
mm_processor_cache_type: str | None = None
hf_token: bool | str | None = None
hf_config_path: str | None = None
generation_config: str | None = None
override_generation_config: dict[str, Any] | None = None
enable_prompt_embeds: bool | None = None
@_enforce_keyword_only_init