Skip to content
Closed
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
55 changes: 55 additions & 0 deletions tests/config/test_omni_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,52 @@ def test_non_duplex_deploy_keeps_model_session_capacity_at_one(tmp_path: Path) -
assert [stage.model_config.session_mode for stage in omni_config.stage_configs] == ["turn", "turn"]


def test_vocoder_cudagraph_config_is_generation_stage_local(tmp_path: Path) -> None:
deploy_path = tmp_path / "qwen3-tts-vocoder-graph.yaml"
deploy_path.write_text(
"""
async_chunk: false
stages:
- stage_id: 1
vocoder_cudagraph:
capture_batch_sizes: [1, 2]
targets:
qwen3_tts.stateless:
enabled: true
capture_bucket_sizes: [150, 325]
""",
encoding="utf-8",
)

omni_config = _from_pipeline_key("qwen3_tts", deploy_config_path=str(deploy_path))

assert omni_config.stage_by_id(0).model_config.vocoder_cudagraph is None
assert omni_config.stage_by_id(1).model_config.vocoder_cudagraph == {
"capture_batch_sizes": [1, 2],
"targets": {
"qwen3_tts.stateless": {
"enabled": True,
"capture_bucket_sizes": [150, 325],
}
},
}


def test_vocoder_cudagraph_config_rejects_ar_stage(tmp_path: Path) -> None:
deploy_path = tmp_path / "qwen3-tts-ar-vocoder-graph.yaml"
deploy_path.write_text(
"""
stages:
- stage_id: 0
vocoder_cudagraph: {}
""",
encoding="utf-8",
)

with pytest.raises(ValueError, match="only for LLM_GENERATION"):
_from_pipeline_key("qwen3_tts", deploy_config_path=str(deploy_path))


@pytest.mark.parametrize("model_type", sorted(OMNI_PIPELINES))
def test_vllm_omni_config_from_pipeline_config_matches_merge_pipeline_deploy(model_type: str):
pipeline = _resolve_pipeline_or_skip(model_type)
Expand Down Expand Up @@ -490,6 +536,14 @@ def test_from_pipeline_config_dispatches_async_chunk_processors_without_mutating
assert async_config.stage_by_id(0).custom_process_next_stage_input_func.endswith("talker2code2wav_async_chunk")
assert async_config.stage_by_id(1).custom_process_input_func is None
assert async_config.stage_by_id(1).model_config.requires_full_payload_input is True
assert async_config.stage_by_id(1).model_config.vocoder_cudagraph == {
"decode_batch_max_size": 4,
"targets": {
"qwen3_tts.stateless": {
"capture_bucket_sizes": [150, 325],
}
},
}

sync_config = _from_pipeline_key("qwen3_tts", cli_overrides={"async_chunk": False})
assert sync_config.stage_by_id(0).custom_process_next_stage_input_func.endswith("talker2code2wav_full_payload")
Expand Down Expand Up @@ -617,6 +671,7 @@ def test_sub_config_fields_match_structured_scopes():
"model_subdir",
"tokenizer_subdir",
"requires_full_payload_input",
"vocoder_cudagraph",
}
vllm_load_fields = {f.name for f in fields(VllmLoadConfig)}
assert issubclass(OmniStageLoadConfig, VllmLoadConfig)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project

from __future__ import annotations

import pytest

from vllm_omni.model_executor.models.interfaces.vocoder_cudagraph import (
SupportsVocoderCUDAGraph,
supports_vocoder_cudagraph,
)

pytestmark = [pytest.mark.core_model, pytest.mark.cpu]


def test_capability_discovery_requires_both_declaration_and_provider() -> None:
class Model(SupportsVocoderCUDAGraph):
supports_vocoder_cudagraph = True

def get_vocoder_cudagraph_targets(self):
return ()

assert supports_vocoder_cudagraph(Model())
assert not supports_vocoder_cudagraph(object())
Loading
Loading