[Core][Model] Enable Qwen3-TTS MRV2 and optimize the TTS pipeline (#7781)
Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
103 files changed
+10232
-661
No files matched your search
@@ -1429,6 +1429,9 @@ stages:
|
||||
assert deploy.async_chunk is True
|
||||
assert deploy.connectors is not None
|
||||
assert deploy.platforms is not None
|
||||
connector = deploy.connectors["connector_of_shared_memory"]
|
||||
assert "async_chunk_batch_min_size" not in connector["extra"]
|
||||
assert "async_chunk_batch_max_wait_ms" not in connector["extra"]
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("hf_config", "model"),
|
||||
@@ -2704,6 +2707,56 @@ class TestPlatformOverrides:
|
||||
|
||||
assert deploy.stages[0].engine_extras["block_size"] == 128
|
||||
|
||||
@pytest.mark.parametrize("platform", ["cuda", "npu"])
|
||||
def test_recommended_native_runner_platform_defaults(self, platform):
|
||||
filename, pipeline_key = "qwen3_tts_mrv2.yaml", "qwen3_tts"
|
||||
deploy = load_deploy_config(Path(get_deploy_config_path(filename)))
|
||||
deploy = _apply_platform_overrides(deploy, platform=platform)
|
||||
expect_v2 = platform == "cuda"
|
||||
assert deploy.model_runner == ("v2" if expect_v2 else "v1")
|
||||
|
||||
# The selection must reach the live worker-dispatch consumer, not just
|
||||
# the transport-level DeployConfig field.
|
||||
pipeline = resolve_pipeline_config(pipeline_key)
|
||||
stages = merge_pipeline_deploy(pipeline, deploy)
|
||||
assert [stage.yaml_engine_args["use_v2_model_runner"] for stage in stages] == [expect_v2] * len(stages)
|
||||
|
||||
if expect_v2 and pipeline.stages and deploy.async_chunk:
|
||||
# v2 only engages the native plane on stages declaring support.
|
||||
assert all(ps.supports_native_mrv2_data_plane for ps in pipeline.stages)
|
||||
|
||||
@pytest.mark.parametrize("runner,native", [("v1", False), ("v2", False), ("v2", True)])
|
||||
def test_mrv2_undeclared_transport_warns(self, monkeypatch, runner, native):
|
||||
from unittest.mock import Mock
|
||||
|
||||
warning = Mock()
|
||||
monkeypatch.setattr("vllm_omni.config.stage_config.logger.warning", warning)
|
||||
pipeline = PipelineConfig(
|
||||
model_type="custom_pipeline",
|
||||
stages=[
|
||||
StagePipelineConfig(
|
||||
stage_id=0, model_stage="custom_ar", final_output=True, supports_native_mrv2_data_plane=native
|
||||
)
|
||||
],
|
||||
)
|
||||
merge_pipeline_deploy(pipeline, DeployConfig(model_runner=runner))
|
||||
assert warning.call_count == int(runner == "v2" and not native)
|
||||
if warning.called:
|
||||
assert "legacy transport path" in warning.call_args.args[0]
|
||||
|
||||
def test_runner_selection_rejects_engine_extras_override(self):
|
||||
pipeline = PipelineConfig(
|
||||
model_type="runner_selection_reserved",
|
||||
stages=SINGLE_STAGE_PIPE_CFG,
|
||||
)
|
||||
for reserved in ("use_v2_model_runner", "supports_native_mrv2_data_plane"):
|
||||
deploy = DeployConfig(
|
||||
model_runner="v2",
|
||||
stages=[StageDeployConfig(stage_id=0, engine_extras={reserved: False})],
|
||||
)
|
||||
with pytest.raises(ValueError, match=f"{reserved!r} must not be set"):
|
||||
merge_pipeline_deploy(pipeline, deploy)
|
||||
|
||||
def test_npu_overrides(self):
|
||||
deploy_path = Path(get_deploy_config_path("qwen3_omni_moe.yaml"))
|
||||
if not deploy_path.exists():
|
||||
|
||||
@@ -50,8 +50,10 @@ from vllm_omni.config.stage_config import (
|
||||
StageDeployConfig,
|
||||
StageExecutionType,
|
||||
StagePipelineConfig,
|
||||
_apply_platform_overrides,
|
||||
load_deploy_config,
|
||||
merge_pipeline_deploy,
|
||||
resolve_deploy_yaml,
|
||||
)
|
||||
from vllm_omni.diffusion.diffusion_kv.config import DiffusionKVCacheMode
|
||||
from vllm_omni.engine.stage_engine_startup import _serialize_stage_config
|
||||
@@ -783,6 +785,67 @@ def test_joyai_code2wav_waits_for_full_payload():
|
||||
assert code2wav.model_config.requires_full_payload_input is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("model_runner", ["v1", "v2"])
|
||||
def test_deploy_model_runner_selection_propagates_to_every_stage(tmp_path: Path, model_runner: str):
|
||||
deploy_path = tmp_path / "qwen3_tts_runner.yaml"
|
||||
deploy_path.write_text(
|
||||
f"""\
|
||||
pipeline: qwen3_tts
|
||||
model_runner: {model_runner}
|
||||
async_chunk: true
|
||||
stages:
|
||||
- stage_id: 0
|
||||
- stage_id: 1
|
||||
"""
|
||||
)
|
||||
|
||||
deploy = load_deploy_config(deploy_path)
|
||||
pipeline = _resolve_pipeline_or_skip("qwen3_tts")
|
||||
legacy_stages = merge_pipeline_deploy(pipeline, deploy)
|
||||
structured = _from_pipeline_key("qwen3_tts", deploy_config_path=str(deploy_path))
|
||||
expect_v2 = model_runner == "v2"
|
||||
|
||||
assert deploy.model_runner == model_runner
|
||||
assert all(stage.yaml_engine_args["use_v2_model_runner"] is expect_v2 for stage in legacy_stages)
|
||||
assert all(stage.model_config.use_v2_model_runner is expect_v2 for stage in structured.stage_configs)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("platform", ["npu", "xpu"])
|
||||
def test_mrv2_fails_fast_on_platforms_without_native_workers(platform: str):
|
||||
with pytest.raises(NotImplementedError, match="Model Runner V2"):
|
||||
_apply_platform_overrides(DeployConfig(model_runner="v2"), platform=platform)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("default_name", "mrv2_name"),
|
||||
[
|
||||
("qwen3_tts.yaml", "qwen3_tts_mrv2.yaml"),
|
||||
(
|
||||
"qwen3_tts_high_concurrency.yaml",
|
||||
"qwen3_tts_high_concurrency_mrv2.yaml",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_qwen3_mrv2_profiles_are_explicit_opt_in(default_name: str, mrv2_name: str):
|
||||
assert load_deploy_config(_DEPLOY_DIR / default_name).model_runner == "v1"
|
||||
assert load_deploy_config(_DEPLOY_DIR / mrv2_name).model_runner == "v2"
|
||||
|
||||
|
||||
def test_qwen3_tts_mrv2_retunes_do_not_change_default_mrv1_profile():
|
||||
default = resolve_deploy_yaml(_DEPLOY_DIR / "qwen3_tts_high_concurrency.yaml")
|
||||
mrv2 = resolve_deploy_yaml(_DEPLOY_DIR / "qwen3_tts_high_concurrency_mrv2.yaml")
|
||||
default_extra = default["connectors"]["connector_of_shared_memory"]["extra"]
|
||||
mrv2_extra = mrv2["connectors"]["connector_of_shared_memory"]["extra"]
|
||||
|
||||
# B2 batch stays consistent with the graph buckets; V1 profile untouched.
|
||||
assert default_extra["decode_batch_max_size"] == 1
|
||||
assert mrv2_extra["decode_batch_max_size"] == 2
|
||||
assert mrv2_extra["decode_cudagraph_batch_sizes"] == [1, 2]
|
||||
assert mrv2_extra["code_predictor_prefix_graphs"] is False
|
||||
assert mrv2["stages"][1]["enforce_eager"] is False
|
||||
assert default["stages"][1]["enforce_eager"] is True
|
||||
|
||||
|
||||
def test_vllm_omni_stage_config_public_fields_use_typed_stage_realizations():
|
||||
assert not hasattr(BaseVllmOmniStageConfig, "from_stage_config")
|
||||
assert not hasattr(BaseVllmOmniStageConfig, "to_legacy_stage_config")
|
||||
@@ -879,9 +942,11 @@ def test_sub_config_fields_match_structured_scopes():
|
||||
"limit_mm_per_prompt",
|
||||
"interleave_mm_strings",
|
||||
"media_io_kwargs",
|
||||
"final_output",
|
||||
"active_stream_window",
|
||||
"session_mode",
|
||||
"duplex_max_sessions",
|
||||
"use_v2_model_runner",
|
||||
"enable_sleep_mode",
|
||||
"default_sampling_params",
|
||||
"subtalker_sampling_params",
|
||||
@@ -890,6 +955,7 @@ def test_sub_config_fields_match_structured_scopes():
|
||||
"custom_voice_dir",
|
||||
"task_type",
|
||||
"codec_frame_rate_hz",
|
||||
"supports_native_mrv2_data_plane",
|
||||
"enforce_eager",
|
||||
"max_cudagraph_capture_size",
|
||||
"enable_flashinfer_autotune",
|
||||
|
||||
Reference in new issue
Block a user