Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions tests/config/test_omni_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
26 changes: 26 additions & 0 deletions vllm_omni/config/omni_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
Loading