[CI] Reducing mithril-h100-pool in ready&merge CI, optimize ready CI duration (#4354)

Signed-off-by: [Your Name] <your.email@example.com>
Signed-off-by: wangyu <410167048@qq.com>
Signed-off-by: wangyu <53896905+yenuo26@users.noreply.github.com>
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Signed-off-by: [Your Name] <[Your Email]>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
wangyuandHongsheng Liu authored and GitHub committed 2026-06-29 05:17:57 +00:00
1 parent e4026a50ad
commit 7619ed6b82
84 files changed
+1718 -2428

No files matched your search

@@ -21,7 +21,7 @@ models = [os.environ.get("AUDIOX_TEST_MODEL", "zhangj1an/audiox_random")]
_OMNI_RUNNER_PARAMS = [(m, None, {"model_class_name": "AudioXPipeline"}) for m in models]
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.diffusion,
pytest.mark.parametrize("omni_runner", _OMNI_RUNNER_PARAMS, indirect=True, ids=models),
]
@@ -141,7 +141,7 @@ _OMNI_RUNNER_PARAMS = [
),
]
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.tts,
pytest.mark.parametrize("omni_runner", _OMNI_RUNNER_PARAMS, indirect=True),
]
@@ -21,7 +21,7 @@ def get_question():
return "请回答这段音频里的问题。"
@pytest.mark.full_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100"}, num_cards={"cuda": 1})
@pytest.mark.parametrize("omni_runner", test_params, indirect=True)
@@ -30,7 +30,7 @@ from vllm_omni.inputs.data import OmniDiffusionSamplingParams
os.environ["VLLM_TEST_CLEAN_GPU_MEMORY"] = "1"
pytestmark = [pytest.mark.full_model, pytest.mark.diffusion, pytest.mark.cache, pytest.mark.slow]
pytestmark = [pytest.mark.diffusion, pytest.mark.cache, pytest.mark.slow]
REPO_ROOT = Path(__file__).resolve().parents[3]
DEFAULT_MODEL_PATH = REPO_ROOT / "dreamid_omni"
@@ -34,7 +34,7 @@ test_params = [(model, stage_config) for model in models for stage_config in sta
DYNIN_CONFIG_PATH = str(_DEFAULT_DYNIN_CONFIG_PATH) if _DEFAULT_DYNIN_CONFIG_PATH is not None else None
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.omni,
pytest.mark.parametrize("omni_runner", test_params, indirect=True),
]
@@ -290,7 +290,7 @@ def _numel(value: Any) -> int:
return 0
@hardware_test(res={"cuda": "L4", "rocm": "MI325"})
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
def test_dynin_t2i_decode_to_image(omni_runner) -> None:
_configure_dynin_config_env()
prompt = _build_t2i_decode_prompt(dynin_config_path=DYNIN_CONFIG_PATH)
@@ -304,7 +304,7 @@ def test_dynin_t2i_decode_to_image(omni_runner) -> None:
assert _numel(image_value) > 0
@hardware_test(res={"cuda": "L4", "rocm": "MI325"})
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
def test_dynin_mmu_to_text(omni_runner) -> None:
_configure_dynin_config_env()
tokenizer = AutoTokenizer.from_pretrained(omni_runner.model_name, trust_remote_code=True)
@@ -322,7 +322,7 @@ def test_dynin_mmu_to_text(omni_runner) -> None:
assert text_content
@hardware_test(res={"cuda": "L4", "rocm": "MI325"})
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
def test_dynin_image_to_text(omni_runner) -> None:
_configure_dynin_config_env()
tokenizer = AutoTokenizer.from_pretrained(omni_runner.model_name, trust_remote_code=True)
@@ -341,7 +341,7 @@ def test_dynin_image_to_text(omni_runner) -> None:
assert text_content
@hardware_test(res={"cuda": "L4", "rocm": "MI325"})
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
def test_dynin_speech_to_text(omni_runner) -> None:
_configure_dynin_config_env()
tokenizer = AutoTokenizer.from_pretrained(omni_runner.model_name, trust_remote_code=True)
@@ -360,7 +360,7 @@ def test_dynin_speech_to_text(omni_runner) -> None:
assert text_content
@hardware_test(res={"cuda": "L4", "rocm": "MI325"})
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
def test_dynin_t2s_decode_to_audio(omni_runner) -> None:
_configure_dynin_config_env()
prompt = _build_t2s_decode_prompt(dynin_config_path=DYNIN_CONFIG_PATH)
@@ -30,7 +30,7 @@ _OMNI_RUNNER_PARAM = (
)
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.diffusion,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
@@ -105,7 +105,7 @@ def _generate_image(model_name: str, **extra_kwargs) -> tuple[list, float]:
@pytest.mark.skip(reason="BF16 baseline model cannot be loaded correctly yet.")
@pytest.mark.full_model
@pytest.mark.slow
@pytest.mark.diffusion
@hardware_test(res={"cuda": "L4"})
@pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True)
@@ -124,7 +124,7 @@ def test_flux_autoround_w4a16_generates_image(omni_runner: OmniRunner):
@pytest.mark.skip(reason="BF16 baseline model cannot be loaded correctly yet.")
@pytest.mark.full_model
@pytest.mark.slow
@pytest.mark.diffusion
@hardware_test(res={"cuda": "L4"})
def test_flux_autoround_w4a16_memory_savings():
@@ -14,6 +14,7 @@ from __future__ import annotations
import pytest
from vllm.assets.image import ImageAsset
from tests.helpers.mark import hardware_test
from tests.helpers.runtime import OmniRunnerHandler
from vllm_omni.diffusion.data import DiffusionParallelConfig
from vllm_omni.inputs.data import OmniDiffusionSamplingParams
@@ -30,7 +31,7 @@ _OMNI_RUNNER_PARAM = (
)
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.diffusion,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
@@ -45,6 +46,7 @@ def _sampling_512() -> OmniDiffusionSamplingParams:
)
@hardware_test(res={"cuda": "H100"}, num_cards=2)
def test_flux_kontext_text_to_image(omni_runner_handler: OmniRunnerHandler):
"""Test FluxKontext text-to-image generation with real model."""
request_config = {
@@ -55,6 +57,7 @@ def test_flux_kontext_text_to_image(omni_runner_handler: OmniRunnerHandler):
omni_runner_handler.send_diffusion_request(request_config)
@hardware_test(res={"cuda": "H100"}, num_cards=2)
def test_flux_kontext_image_edit(omni_runner_handler: OmniRunnerHandler):
"""Test FluxKontext image-to-image editing with real model."""
input_image = ImageAsset("2560px-Gfp-wisconsin-madison-the-nature-boardwalk").pil_image.convert("RGB")
@@ -5,6 +5,7 @@
import pytest
from tests.helpers.mark import hardware_test
from tests.helpers.runtime import OmniRunnerHandler
from vllm_omni.inputs.data import OmniDiffusionSamplingParams
@@ -13,12 +14,13 @@ MODEL = "black-forest-labs/FLUX.1-schnell"
_OMNI_RUNNER_PARAM = (MODEL, None)
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.diffusion,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
@hardware_test(res={"cuda": "H100"}, num_cards=1)
def test_flux_schnell_text_to_image(omni_runner_handler: OmniRunnerHandler):
"""Test FLUX.1-schnell text-to-image generation."""
request_config = {
@@ -1,10 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""E2E Offline inference tests for GLM-TTS voice cloning.
GLM-TTS is a zero-shot voice cloning model that always requires ref_audio.
There is no text-only / non-clone inference path in the official implementation.
"""
"""E2E expansion tests for GLM-TTS voice cloning offline inference (nightly CI)."""
import os
import tempfile
@@ -23,11 +19,12 @@ from tests.helpers.runtime import OmniResponse
from tests.helpers.stage_config import get_deploy_config_path, modify_stage_config
from vllm_omni.model_executor.models.glm_tts.glm_tts import build_glm_tts_prefill_metadata
pytestmark = [pytest.mark.slow, pytest.mark.tts]
MODEL = os.environ.get("GLM_TTS_MODEL_PATH", "zai-org/GLM-TTS")
REF_TEXT = "他当时还跟线下其他的站姐吵架,然后,打架进局子了。"
DEPLOY_CONFIG = get_deploy_config_path("glm_tts.yaml")
REFERENCE_PROMPT_WAV_PATH = get_asset_path("glm_tts/jiayan_zh.wav")
ASYNC_CHUNK_MODES = [
@@ -84,9 +81,7 @@ def _get_deploy_config(*, async_chunk: bool) -> str:
)
@pytest.mark.advanced_model
@pytest.mark.omni
@hardware_test(res={"cuda": "H100"}, num_cards=1)
@hardware_test(res={"cuda": "L4"}, num_cards=1)
@pytest.mark.parametrize("async_chunk", ASYNC_CHUNK_MODES)
def test_offline_voice_clone_zh(async_chunk: bool) -> None:
"""
@@ -94,9 +89,6 @@ def test_offline_voice_clone_zh(async_chunk: bool) -> None:
Deploy Setting: glm_tts.yaml with explicit sync/async mode, enforce_eager
Input Modal: text + ref_audio + ref_text
Output Modal: audio
Uses the official jiayan_zh.wav reference audio from the upstream
GLM-TTS repository (real human speech matching REF_TEXT).
"""
synth_text = "今天天气真不错,适合出去散散步。"
prompt_audio = _load_ref_audio()
@@ -144,5 +136,5 @@ def test_offline_voice_clone_zh(async_chunk: bool) -> None:
audio_format="audio/wav",
),
{"input": synth_text, "response_format": "wav"},
run_level="advanced_model",
run_level="full_model",
)
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
End-to-end offline inference tests for higgs-audio v2.
E2E Offline expansion tests for higgs-audio v2.
Mirrors examples/offline_inference/text_to_speech/higgs_audio_v2/end2end.py:
build Stage-0 prompt_token_ids with the model's own processor + plain-text
@@ -34,6 +34,8 @@ from tests.helpers.media import get_asset_path
from tests.helpers.runtime import OmniRunner
from tests.helpers.stage_config import get_deploy_config_path
pytestmark = [pytest.mark.slow, pytest.mark.tts]
MODEL = "bosonai/higgs-audio-v2-generation-3B-base"
STAGE_CONFIG = get_deploy_config_path("higgs_audio_v2.yaml")
SAMPLE_RATE = 24_000
@@ -89,9 +91,7 @@ def _extract_pcm(outputs) -> torch.Tensor:
raise AssertionError(f"no audio payload in any stage output (got {len(outputs)} stages)")
@pytest.mark.core_model
@pytest.mark.tts
@hardware_test(res={"cuda": "H100"}, num_cards=1)
@hardware_test(res={"cuda": "L4"}, num_cards=1)
@pytest.mark.parametrize("omni_runner_function", [_OMNI_RUNNER_PARAM], indirect=True)
def test_higgs_audio_v2_offline_plain_text(omni_runner_function: OmniRunner) -> None:
"""
@@ -131,9 +131,7 @@ def test_higgs_audio_v2_offline_plain_text(omni_runner_function: OmniRunner) ->
assert np.isfinite(arr).all(), "audio contains non-finite samples (nan/inf)"
@pytest.mark.core_model
@pytest.mark.tts
@hardware_test(res={"cuda": "H100"}, num_cards=1)
@hardware_test(res={"cuda": "L4"}, num_cards=1)
@pytest.mark.parametrize("omni_runner_function", [_OMNI_RUNNER_PARAM], indirect=True)
def test_higgs_audio_v2_offline_batch_two_prompts(omni_runner_function: OmniRunner) -> None:
"""
@@ -199,9 +197,7 @@ def _compose_voice_clone_request(model_name: str, text: str, ref_text: str, ref_
}
@pytest.mark.advanced_model
@pytest.mark.tts
@hardware_test(res={"cuda": "H100"}, num_cards=1)
@hardware_test(res={"cuda": "L4"}, num_cards=1)
@pytest.mark.parametrize("omni_runner_function", [_OMNI_RUNNER_PARAM], indirect=True)
def test_higgs_audio_v2_offline_voice_clone(omni_runner_function: OmniRunner) -> None:
"""
@@ -36,7 +36,7 @@ _OMNI_RUNNER_PARAM_OFFLOAD = (
)
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.diffusion,
pytest.mark.parametrize(
"omni_runner",
@@ -99,7 +99,7 @@ def _sample_pixels(img_tensor: torch.Tensor) -> list[float]:
# End-to-end test
# ---------------------------------------------------------------------------
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.diffusion,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
@@ -49,7 +49,7 @@ test_params_thinker = [(m, c) for m in models for c in [get_eager_config_thinker
test_params = [(m, c) for m in models for c in [get_eager_config()]]
@pytest.mark.core_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", test_params_thinker, indirect=True)
@@ -65,7 +65,7 @@ def test_text_to_text(omni_runner, omni_runner_handler) -> None:
omni_runner_handler.send_omni_request(request_config)
@pytest.mark.core_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", test_params_thinker, indirect=True)
@@ -82,7 +82,7 @@ def test_image_to_text(omni_runner, omni_runner_handler) -> None:
omni_runner_handler.send_omni_request(request_config)
@pytest.mark.core_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", test_params_thinker, indirect=True)
@@ -101,7 +101,7 @@ def test_audio_to_text(omni_runner, omni_runner_handler) -> None:
omni_runner_handler.send_omni_request(request_config)
@pytest.mark.core_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", test_params_thinker, indirect=True)
@@ -118,7 +118,7 @@ def test_video_to_text(omni_runner, omni_runner_handler) -> None:
omni_runner_handler.send_omni_request(request_config)
@pytest.mark.core_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", test_params_thinker, indirect=True)
@@ -138,7 +138,7 @@ def test_mixed_to_text(omni_runner, omni_runner_handler) -> None:
omni_runner_handler.send_omni_request(request_config)
@pytest.mark.advanced_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", test_params, indirect=True)
@@ -154,7 +154,7 @@ def test_text_to_audio(omni_runner, omni_runner_handler) -> None:
omni_runner_handler.send_omni_request(request_config)
@pytest.mark.advanced_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", test_params, indirect=True)
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""End-to-end offline inference tests for Ming-omni-tts."""
"""E2E expansion tests for Ming-omni-tts offline inference (nightly CI)."""
import asyncio
import uuid
@@ -32,6 +32,12 @@ TEST_TEXT = "我会一直在这里陪着你,直到你慢慢地沉入那个最
TEST_INSTRUCTION = "轻柔的ASMR耳语,慢速,贴近麦克风"
MIN_AUDIO_SAMPLES = 1000
pytestmark = [
pytest.mark.slow,
pytest.mark.tts,
pytest.mark.skip(reason="https://github.com/vllm-project/vllm-omni/issues/4704"),
]
@pytest.fixture(scope="module")
def ming_tokenizer():
@@ -163,8 +169,6 @@ def _extract_multimodal_output(output) -> Mapping[str, Any]:
raise AssertionError("No multimodal audio output found in Ming generate results")
@pytest.mark.advanced_model
@pytest.mark.omni
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_ming_tts_offline_basic(ming_engine, ming_tokenizer) -> None:
"""Test blocking Ming generation through Omni."""
@@ -185,8 +189,6 @@ def test_ming_tts_offline_basic(ming_engine, ming_tokenizer) -> None:
assert sample_rate == SAMPLE_RATE, f"Expected Ming output sample rate {SAMPLE_RATE}, got {sample_rate}"
@pytest.mark.advanced_model
@pytest.mark.omni
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_ming_tts_speaker_conditioning_differs(ming_engine, ming_tokenizer) -> None:
"""Test that different Ming speaker controls produce different waveform outputs."""
@@ -220,8 +222,6 @@ def test_ming_tts_speaker_conditioning_differs(ming_engine, ming_tokenizer) -> N
)
@pytest.mark.advanced_model
@pytest.mark.omni
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_ming_tts_multiple_prompts_queued(ming_engine, ming_tokenizer) -> None:
"""Regression: supported max_num_seqs=1 config must still drain queued prompts."""
@@ -251,8 +251,6 @@ def test_ming_tts_multiple_prompts_queued(ming_engine, ming_tokenizer) -> None:
assert np.max(np.abs(waveform.numpy())) > 0.01, f"Request {i} audio appears silent"
@pytest.mark.advanced_model
@pytest.mark.omni
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_ming_tts_offline_streaming(async_omni_engine, ming_tokenizer) -> None:
"""Test async_chunk streaming Ming generation through AsyncOmni."""
@@ -2,9 +2,9 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""E2E offline inference tests for MOSS-VoiceGenerator (MossTTSDelayModel, 1.7B).
Uses the standard omni_runner + pytestmark pattern (one module-scoped engine
per file, skill invariant I4). The realtime variant lives in the sibling file
test_moss_tts_realtime.py.
Weekly expansion coverage (``pytest.mark.slow``) for the delay-model path.
Upstream keeps the same tests in ``test_moss_tts.py``; this branch uses the
``*_expansion.py`` naming convention and deletes the base file on merge.
MOSS-VoiceGenerator synthesizes speech from a text *instruction* that describes
the desired voice (e.g. "a warm female voice with an American accent"). It does
@@ -14,6 +14,8 @@ pair into the (prompt_token_ids, codes.ref) grid that the MossTTSDelayModel
talker expects — same as examples/offline_inference/text_to_speech/moss_tts/
end2end.py:_build_unified_codes.
Realtime coverage: ``test_moss_tts_realtime_expansion.py``.
No determinism test: VoiceGenerator produces variable-length output even with
a fixed seed; waveform length reproducibility is not guaranteed.
"""
@@ -31,10 +33,6 @@ from tests.helpers.mark import hardware_test
from tests.helpers.runtime import OmniRunner
from tests.helpers.stage_config import get_deploy_config_path, modify_stage_config
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
MODEL = "OpenMOSS-Team/MOSS-VoiceGenerator"
SAMPLE_RATE = 24_000
@@ -58,18 +56,9 @@ _STAGE1_PARAMS = SamplingParams(
)
_SAMPLING = [_STAGE0_PARAMS, _STAGE1_PARAMS]
# ---------------------------------------------------------------------------
# Deploy config
# ---------------------------------------------------------------------------
def _get_test_config() -> str:
"""Derive a CI-friendly config from moss_voice_generator.yaml.
Reduces Stage 0 gpu_memory_utilization from 0.60 → 0.45 to leave headroom
for Stage 1 (0.12) on a shared L4/A10G. max_num_seqs=1 keeps per-test
peak memory predictable.
"""
"""Derive a CI-friendly config from moss_voice_generator.yaml."""
return modify_stage_config(
get_deploy_config_path("moss_voice_generator.yaml"),
updates={
@@ -83,35 +72,16 @@ def _get_test_config() -> str:
)
# ---------------------------------------------------------------------------
# pytestmark — one engine for the whole module
# ---------------------------------------------------------------------------
pytestmark = [
pytest.mark.slow,
pytest.mark.skip(reason="https://github.com/vllm-project/vllm-omni/issues/4700"),
pytest.mark.full_model,
pytest.mark.tts,
pytest.mark.parametrize("omni_runner", [(MODEL, _get_test_config())], indirect=True),
]
# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------
def _build_request(text: str, instruction: str) -> dict:
"""Build a VoiceGenerator request using AutoProcessor.
Calls proc.build_user_message + proc() to produce the unified-codes grid
(L, 1+n_vq) and splits it into prompt_token_ids + codes.ref, exactly as
end2end.py:_build_unified_codes does for the voice_generator variant.
The processor (including its CPU-resident audio_tokenizer) is freed before
returning so it does not compete with the running engine.
Set MOSS_TTS_SKIP_ON_NET_FAIL=1 to skip in air-gapped environments where
the HF snapshot is not cached.
"""
"""Build a VoiceGenerator request using AutoProcessor."""
from transformers import AutoProcessor
try:
@@ -124,9 +94,9 @@ def _build_request(text: str, instruction: str) -> dict:
user_msg = proc.build_user_message(text=text, instruction=instruction)
batch = proc(conversations=[[user_msg]], mode="generation")
unified = batch["input_ids"][0] # (L, 1+n_vq)
unified = batch["input_ids"][0]
text_ids = unified[:, 0].tolist()
audio_codes = unified[:, 1:].contiguous().to(torch.int64) # (L, n_vq)
audio_codes = unified[:, 1:].contiguous().to(torch.int64)
del proc
gc.collect()
@@ -137,15 +107,6 @@ def _build_request(text: str, instruction: str) -> dict:
def _collect_audio(omni_runner: OmniRunner, request: dict) -> tuple[torch.Tensor, int]:
"""Run one request and return (waveform_cpu, sample_rate).
Iterates all OmniRequestOutputs from generate() via the top-level
multimodal_output property (which aggregates from completion outputs).
AR-stage outputs have empty multimodal_output and are silently skipped.
With async_chunk=True and FINAL_ONLY, the codec stage consolidates its
chunks into a single tensor before yielding — but we handle list fallback
for robustness.
"""
chunks: list[torch.Tensor] = []
sr_final = SAMPLE_RATE
for out in omni_runner.omni.generate(request, _SAMPLING):
@@ -172,14 +133,8 @@ def _collect_audio(omni_runner: OmniRunner, request: dict) -> tuple[torch.Tensor
return torch.cat(chunks, dim=0), sr_final
# ---------------------------------------------------------------------------
# Tests
# ---------------------------------------------------------------------------
@pytest.mark.advanced_model
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_moss_tts_english(omni_runner: OmniRunner) -> None:
def test_moss_tts_delay_english(omni_runner: OmniRunner) -> None:
"""VoiceGenerator: English instruction produces non-empty 24 kHz audio."""
req = _build_request(
"Hello, this is a MOSS voice design test.",
@@ -192,9 +147,8 @@ def test_moss_tts_english(omni_runner: OmniRunner) -> None:
assert not torch.all(audio == 0), "Audio is silence"
@pytest.mark.advanced_model
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_moss_tts_chinese(omni_runner: OmniRunner) -> None:
def test_moss_tts_delay_chinese(omni_runner: OmniRunner) -> None:
"""VoiceGenerator: Chinese input produces non-empty audio."""
req = _build_request(
"你好,这是语音合成测试。",
@@ -207,9 +161,8 @@ def test_moss_tts_chinese(omni_runner: OmniRunner) -> None:
assert not torch.all(audio == 0)
@pytest.mark.advanced_model
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_moss_tts_batch(omni_runner: OmniRunner) -> None:
def test_moss_tts_delay_batch(omni_runner: OmniRunner) -> None:
"""VoiceGenerator: batch of two requests each returns non-empty audio."""
requests = [
_build_request("First sentence.", "a warm female voice"),
@@ -233,9 +186,6 @@ def test_moss_tts_batch(omni_runner: OmniRunner) -> None:
if isinstance(audio, torch.Tensor) and audio.numel() > 0:
results.append(audio.reshape(-1).cpu())
# With async_chunk streaming + FINAL_ONLY, each request produces one
# consolidated output. The >= 2 guard handles backward-compatibility if
# consolidation behavior changes.
assert len(results) >= 2, f"Expected at least 2 audio outputs, got {len(results)}"
for i, audio in enumerate(results):
assert audio.numel() > 0, f"Audio chunk[{i}] is empty"
@@ -32,7 +32,7 @@ _OMNI_RUNNER_PARAM = (
)
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.tts,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
@@ -0,0 +1,125 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""E2E offline inference tests for MOSS-TTS-Realtime (MossTTSRealtime, 1.7B).
Exercises the local-transformer generation path on L4. Delay-model coverage is in
``test_moss_tts_expansion.py``.
No determinism test: MossTTSRealtime is sensitive to async scheduling timing;
waveform reproducibility is not guaranteed across sequential ``generate`` calls.
"""
from __future__ import annotations
import os
import urllib.request
import pytest
import torch
from vllm import SamplingParams
from tests.helpers.mark import hardware_test
from tests.helpers.runtime import OmniRunner
from tests.helpers.stage_config import get_deploy_config_path
MODEL = "OpenMOSS-Team/MOSS-TTS-Realtime"
DEPLOY_CONFIG = get_deploy_config_path("moss_tts_realtime.yaml")
_OMNI_RUNNER_PARAM = (MODEL, DEPLOY_CONFIG, {"stage_init_timeout": 300})
pytestmark = [
pytest.mark.slow,
pytest.mark.tts,
pytest.mark.skip(reason="https://github.com/vllm-project/vllm-omni/issues/4700"),
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
SAMPLE_RATE = 24_000
REF_AUDIO_URL = "https://raw.githubusercontent.com/OpenMOSS/MOSS-TTS/main/assets/audio/reference_zh_1.wav"
_DEFAULT_SAMPLING = SamplingParams(
temperature=1.7,
top_p=0.8,
top_k=25,
max_tokens=512,
seed=42,
detokenize=False,
)
@pytest.fixture(scope="session")
def ref_audio_path(tmp_path_factory) -> str:
cache_dir = tmp_path_factory.mktemp("moss_tts_realtime_ref")
target = cache_dir / "zh_1.wav"
try:
with urllib.request.urlopen(REF_AUDIO_URL, timeout=30) as resp:
target.write_bytes(resp.read())
except Exception as exc:
msg = f"Cannot fetch reference clip {REF_AUDIO_URL}: {exc}"
if os.environ.get("MOSS_TTS_SKIP_ON_NET_FAIL"):
pytest.skip(msg)
pytest.fail(msg)
if not target.exists() or target.stat().st_size == 0:
pytest.fail(f"Reference clip empty after download: {target}")
return str(target)
def _build_request(text: str, ref_audio_path: str, seed: int = 42) -> dict:
return {
"prompt": "<|im_start|>assistant\n",
"additional_information": {
"task_type": ["voice_clone"],
"text": [text],
"mode": ["voice_clone"],
"prompt_audio_path": [ref_audio_path],
"seed": [seed],
},
}
def _sampling_for(omni_runner: OmniRunner) -> SamplingParams | list[SamplingParams]:
omni = omni_runner.omni
if omni.num_stages == 1:
return _DEFAULT_SAMPLING
params = omni_runner.get_default_sampling_params_list()
params[0] = _DEFAULT_SAMPLING
return params
def _audio_from_stage(stage_outputs) -> tuple[torch.Tensor, int] | None:
mm = stage_outputs.multimodal_output
if not mm:
return None
audio = mm.get("audio")
if audio is None:
audio = mm.get("model_outputs")
if audio is None:
return None
if isinstance(audio, list):
audio = torch.cat(
[t.reshape(-1) for t in audio if isinstance(t, torch.Tensor) and t.numel() > 0],
dim=0,
)
if not isinstance(audio, torch.Tensor) or audio.numel() == 0:
return None
sr = mm.get("sr")
sample_rate = int(sr.item()) if sr is not None else SAMPLE_RATE
return audio.reshape(-1).cpu(), sample_rate
def _collect_audio(omni_runner: OmniRunner, request: dict) -> tuple[torch.Tensor, int]:
for stage_outputs in omni_runner.omni.generate(request, _sampling_for(omni_runner)):
parsed = _audio_from_stage(stage_outputs)
if parsed is not None:
return parsed
raise AssertionError("No stage outputs received")
@hardware_test(res={"cuda": "L4"})
def test_moss_tts_realtime_english(omni_runner: OmniRunner, ref_audio_path) -> None:
"""MossTTSRealtime: English voice_clone produces non-empty 24 kHz audio."""
req = _build_request("This is a real-time TTS streaming test.", ref_audio_path)
audio, sr = _collect_audio(omni_runner, req)
assert sr == SAMPLE_RATE, f"Expected {SAMPLE_RATE} Hz, got {sr}"
assert audio.numel() > 0, "Audio tensor is empty"
assert not torch.all(audio == 0), "Audio is silence"
@@ -1,113 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""E2E offline inference test for MOSS-TTS-v1.5 (MossTTSDelay-8B).
MOSS-TTS-v1.5 is a continued-training upgrade of MOSS-TTS 1.0 with the SAME
``MossTTSDelay`` architecture and API, so it reuses the existing talker/codec
path unchanged — this test just pins that the 8B v1.5 checkpoint loads and
produces audio.
The model is 8B, so this lives in its own file (one module-scoped engine per
file, per skill invariant I4) and is gated behind an 80 GB GPU; the small-GPU
MossTTSDelay coverage stays in ``test_moss_tts.py`` (1.7B VoiceGenerator).
"""
from __future__ import annotations
import os
import urllib.request
import pytest
import torch
from vllm import SamplingParams
from tests.helpers.mark import hardware_test
from vllm_omni import Omni
# H100-gated (8B). Picked up by the nightly "TTS · Function Test with H100"
# job (-m "full_model and H100 and tts"); the L4 MOSS-TTS tests land in the
# sibling L4 tts lane instead.
# TODO: Fix this test
# pytestmark = [pytest.mark.full_model, pytest.mark.tts]
SAMPLE_RATE = 24_000
REF_AUDIO_URL = "https://raw.githubusercontent.com/OpenMOSS/MOSS-TTS/main/assets/audio/reference_zh_1.wav"
_MODEL = "OpenMOSS-Team/MOSS-TTS-v1.5"
_DEFAULT_SAMPLING = SamplingParams(
temperature=1.7,
top_p=0.8,
top_k=25,
max_tokens=512, # short for tests (~20 s at 24 kHz, ~12.5 tokens/s)
seed=42,
detokenize=False,
)
@pytest.fixture(scope="session")
def ref_audio_path(tmp_path_factory) -> str:
"""Download the upstream reference clip once per session.
Set ``MOSS_TTS_SKIP_ON_NET_FAIL=1`` to skip in air-gapped environments.
"""
target = tmp_path_factory.mktemp("moss_tts_v15_ref") / "zh_1.wav"
try:
with urllib.request.urlopen(REF_AUDIO_URL, timeout=30) as resp:
target.write_bytes(resp.read())
except Exception as exc: # noqa: BLE001
msg = f"Cannot fetch reference clip {REF_AUDIO_URL}: {exc}"
if os.environ.get("MOSS_TTS_SKIP_ON_NET_FAIL"):
pytest.skip(msg)
pytest.fail(msg)
if not target.exists() or target.stat().st_size == 0:
pytest.fail(f"Reference clip empty after download: {target}")
return str(target)
@pytest.fixture(scope="module")
def v15_engine():
return Omni(model=_MODEL, stage_init_timeout=600)
def _build_request(text: str, ref_audio_path: str) -> dict:
return {
"prompt": "<|im_start|>assistant\n",
"additional_information": {
"task_type": ["voice_clone"],
"text": [text],
"mode": ["voice_clone"],
"prompt_audio_path": [ref_audio_path],
"seed": [42],
},
}
def _collect_audio(omni: Omni, request: dict) -> tuple[torch.Tensor, int]:
for stage_outputs in omni.generate(request, _DEFAULT_SAMPLING):
for req_output in stage_outputs.request_output:
mm = req_output.outputs[0].multimodal_output
assert mm is not None, "Expected non-None multimodal_output"
audio = mm.get("audio")
if audio is None:
audio = mm.get("model_outputs")
sr = mm.get("sr")
assert audio is not None, "Expected 'audio' or 'model_outputs' in multimodal_output"
if isinstance(audio, list):
audio = torch.cat(
[t.reshape(-1) for t in audio if isinstance(t, torch.Tensor) and t.numel() > 0],
dim=0,
)
assert isinstance(audio, torch.Tensor), f"Expected Tensor, got {type(audio)}"
return audio.reshape(-1).cpu(), int(sr.item()) if sr is not None else SAMPLE_RATE
raise AssertionError("No stage outputs received")
@hardware_test(res={"cuda": "H100"})
def test_moss_tts_v15_voice_clone(v15_engine, ref_audio_path):
"""MOSS-TTS-v1.5 (8B): voice_clone produces non-empty 24 kHz audio."""
req = _build_request("Hello, this is a MOSS-TTS v1.5 voice cloning test.", ref_audio_path)
audio, sr = _collect_audio(v15_engine, req)
assert sr == SAMPLE_RATE, f"Expected {SAMPLE_RATE} Hz, got {sr}"
assert audio.numel() > 0, "Audio tensor is empty"
assert not torch.all(audio == 0), "Audio is silence"
@@ -0,0 +1,115 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""E2E offline inference test for MOSS-TTS-v1.5 (MossTTSDelay-8B).
MOSS-TTS-v1.5 is a continued-training upgrade of MOSS-TTS 1.0 with the SAME
``MossTTSDelay`` architecture and API. The 8B checkpoint is H100-gated; small-GPU
MossTTSDelay coverage stays in ``test_moss_tts_expansion.py``.
"""
from __future__ import annotations
import os
import urllib.request
import pytest
import torch
from vllm import SamplingParams
from tests.helpers.mark import hardware_test
from tests.helpers.runtime import OmniRunner
from tests.helpers.stage_config import get_deploy_config_path
MODEL = "OpenMOSS-Team/MOSS-TTS-v1.5"
DEPLOY_CONFIG = get_deploy_config_path("moss_tts.yaml")
_OMNI_RUNNER_PARAM = (MODEL, DEPLOY_CONFIG, {"stage_init_timeout": 600})
pytestmark = [
pytest.mark.skip(reason="https://github.com/vllm-project/vllm-omni/issues/4643"),
pytest.mark.slow,
pytest.mark.tts,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
SAMPLE_RATE = 24_000
REF_AUDIO_URL = "https://raw.githubusercontent.com/OpenMOSS/MOSS-TTS/main/assets/audio/reference_zh_1.wav"
_DEFAULT_SAMPLING = SamplingParams(
temperature=1.7,
top_p=0.8,
top_k=25,
max_tokens=512,
seed=42,
detokenize=False,
)
@pytest.fixture(scope="session")
def ref_audio_path(tmp_path_factory) -> str:
target = tmp_path_factory.mktemp("moss_tts_v15_ref") / "zh_1.wav"
try:
with urllib.request.urlopen(REF_AUDIO_URL, timeout=30) as resp:
target.write_bytes(resp.read())
except Exception as exc: # noqa: BLE001
msg = f"Cannot fetch reference clip {REF_AUDIO_URL}: {exc}"
if os.environ.get("MOSS_TTS_SKIP_ON_NET_FAIL"):
pytest.skip(msg)
pytest.fail(msg)
if not target.exists() or target.stat().st_size == 0:
pytest.fail(f"Reference clip empty after download: {target}")
return str(target)
def _build_request(text: str, ref_audio_path: str) -> dict:
return {
"prompt": "<|im_start|>assistant\n",
"additional_information": {
"task_type": ["voice_clone"],
"text": [text],
"mode": ["voice_clone"],
"prompt_audio_path": [ref_audio_path],
"seed": [42],
},
}
def _sampling_for(omni_runner: OmniRunner) -> SamplingParams | list[SamplingParams]:
omni = omni_runner.omni
if omni.num_stages == 1:
return _DEFAULT_SAMPLING
params = omni_runner.get_default_sampling_params_list()
params[0] = _DEFAULT_SAMPLING
return params
def _collect_audio(omni_runner: OmniRunner, request: dict) -> tuple[torch.Tensor, int]:
for stage_outputs in omni_runner.omni.generate(request, _sampling_for(omni_runner)):
mm = stage_outputs.multimodal_output
if not mm:
continue
audio = mm.get("audio")
if audio is None:
audio = mm.get("model_outputs")
if audio is None:
continue
if isinstance(audio, list):
audio = torch.cat(
[t.reshape(-1) for t in audio if isinstance(t, torch.Tensor) and t.numel() > 0],
dim=0,
)
if not isinstance(audio, torch.Tensor) or audio.numel() == 0:
continue
sr = mm.get("sr")
return audio.reshape(-1).cpu(), int(sr.item()) if sr is not None else SAMPLE_RATE
raise AssertionError("No stage outputs received")
@hardware_test(res={"cuda": "H100"})
def test_moss_tts_v15_voice_clone(omni_runner: OmniRunner, ref_audio_path) -> None:
"""MOSS-TTS-v1.5 (8B): voice_clone produces non-empty 24 kHz audio."""
req = _build_request("Hello, this is a MOSS-TTS v1.5 voice cloning test.", ref_audio_path)
audio, sr = _collect_audio(omni_runner, req)
assert sr == SAMPLE_RATE, f"Expected {SAMPLE_RATE} Hz, got {sr}"
assert audio.numel() > 0, "Audio tensor is empty"
assert not torch.all(audio == 0), "Audio is silence"
@@ -31,7 +31,7 @@ _OMNI_RUNNER_PARAM = (
)
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.tts,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
]
@@ -23,7 +23,7 @@ from tests.helpers.media import (
from tests.helpers.stage_config import get_deploy_config_path, modify_stage_config
pytestmark = [
pytest.mark.full_model,
pytest.mark.slow,
pytest.mark.omni,
]
@@ -36,6 +36,10 @@ BASELINE_MODEL = os.environ.get("QWEN2_5_OMNI_BASELINE_MODEL", BASELINE_MODEL)
_CI_DEPLOY = get_deploy_config_path("ci/qwen2_5_omni.yaml")
_SKIP_ISSUE_4663 = pytest.mark.skip(
reason="https://github.com/vllm-project/vllm-omni/issues/4663",
)
def _get_stage_config():
"""Build a CI-friendly stage config with eager mode."""
@@ -61,6 +65,7 @@ quant_params = [(QUANTIZED_MODEL, stage_config)]
# ------------------------------------------------------------------
@_SKIP_ISSUE_4663
@hardware_test(res={"cuda": "L4"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", quant_params, indirect=True)
def test_text_to_text(omni_runner, omni_runner_handler):
@@ -79,6 +84,7 @@ def test_text_to_text(omni_runner, omni_runner_handler):
# ------------------------------------------------------------------
@_SKIP_ISSUE_4663
@hardware_test(res={"cuda": "L4"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", quant_params, indirect=True)
def test_audio_to_text(omni_runner, omni_runner_handler):
@@ -102,6 +108,7 @@ def test_audio_to_text(omni_runner, omni_runner_handler):
# ------------------------------------------------------------------
@_SKIP_ISSUE_4663
@hardware_test(res={"cuda": "L4"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", quant_params, indirect=True)
def test_image_to_text(omni_runner, omni_runner_handler):
@@ -123,6 +130,7 @@ def test_image_to_text(omni_runner, omni_runner_handler):
# ------------------------------------------------------------------
@_SKIP_ISSUE_4663
@hardware_test(res={"cuda": "L4"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", quant_params, indirect=True)
def test_video_to_text(omni_runner, omni_runner_handler):
@@ -144,6 +152,7 @@ def test_video_to_text(omni_runner, omni_runner_handler):
# ------------------------------------------------------------------
@_SKIP_ISSUE_4663
@hardware_test(res={"cuda": "L4"}, num_cards=4)
@pytest.mark.parametrize("omni_runner", quant_params, indirect=True)
def test_mix_to_audio(omni_runner, omni_runner_handler):
@@ -51,7 +51,7 @@ def get_question(prompt_type="mix"):
return prompts.get(prompt_type, prompts["mix"])
@pytest.mark.advanced_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "L4", "rocm": "MI325", "xpu": "B60"}, num_cards={"cuda": 4, "rocm": 2, "xpu": 3})
@pytest.mark.parametrize("omni_runner", test_params, indirect=True)
@@ -82,7 +82,7 @@ def test_mix_to_audio(omni_runner, omni_runner_handler) -> None:
omni_runner_handler.send_omni_request(request_config)
@pytest.mark.advanced_model
@pytest.mark.slow
@pytest.mark.omni
@hardware_test(res={"cuda": "L4", "rocm": "MI325", "xpu": "B60"}, num_cards={"cuda": 4, "rocm": 2, "xpu": 3})
@pytest.mark.parametrize("omni_runner", test_params, indirect=True)
@@ -124,7 +124,7 @@ def _make_file_lora_request(adapter_dir: Path) -> LoRARequest:
# ---------------------------------------------------------------------------
@pytest.mark.full_model
@pytest.mark.slow
@pytest.mark.diffusion
@hardware_test(res={"cuda": "H100"})
def test_sensenova_u1_lora_scale_and_deactivation(tmp_path) -> None:
@@ -153,9 +153,9 @@ def _generate_sensenova_u1_img2img(
return generated_image
@pytest.mark.core_model
@pytest.mark.advanced_model
@pytest.mark.slow
@pytest.mark.diffusion
@pytest.mark.skip(reason="https://github.com/vllm-project/vllm-omni/issues/4636")
@hardware_test(res={"cuda": "H100"})
def test_sensenova_u1_img2img(run_level):
"""Test SenseNova-U1 img2img (single-stage diffusion, no deploy YAML)."""
@@ -165,11 +165,11 @@ def test_sensenova_u1_img2img(run_level):
stage_configs_path=None,
) as runner:
generated_image = _generate_sensenova_u1_img2img(runner.omni, input_image)
if run_level == "advanced_model":
if run_level == "full_model" or run_level == "advanced_model":
_validate_pixels(generated_image)
@pytest.mark.core_model
@pytest.mark.slow
@pytest.mark.diffusion
@pytest.mark.cache
@hardware_test(res={"cuda": "H100"})
@@ -143,9 +143,9 @@ def _generate_sensenova_u1_image(
return generated_image
@pytest.mark.core_model
@pytest.mark.advanced_model
@pytest.mark.slow
@pytest.mark.diffusion
@pytest.mark.skip(reason="https://github.com/vllm-project/vllm-omni/issues/4636")
@hardware_test(res={"cuda": "H100"})
def test_sensenova_u1_text2img(run_level):
"""Test SenseNova-U1 text2img (single-stage diffusion, no deploy YAML)."""
@@ -154,11 +154,11 @@ def test_sensenova_u1_text2img(run_level):
stage_configs_path=None,
) as runner:
generated_image = _generate_sensenova_u1_image(runner.omni)
if run_level == "advanced_model":
if run_level == "full_model" or run_level == "advanced_model":
_validate_pixels(generated_image)
@pytest.mark.core_model
@pytest.mark.slow
@pytest.mark.diffusion
@pytest.mark.cache
@hardware_test(res={"cuda": "H100"})
@@ -23,7 +23,7 @@ from vllm_omni.inputs.data import OmniDiffusionSamplingParams
from vllm_omni.outputs import OmniRequestOutput
from vllm_omni.platforms import current_omni_platform
pytestmark = [pytest.mark.full_model, pytest.mark.diffusion]
pytestmark = [pytest.mark.slow, pytest.mark.diffusion]
_MODEL_REPO = "stabilityai/stable-audio-open-1.0"
@@ -1,303 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
E2E tests for Step-Audio2 model with audio input and audio output.
These tests verify:
1. Processor loads correctly and handles audio input
2. Field configuration for vLLM batching (flat_from_sizes)
3. Tensor shapes are correct (3D not 4D for profiling)
4. Basic E2E inference works with audio input
"""
from pathlib import Path
import numpy as np
import pytest
import torch
from tests.helpers.runtime import OmniRunner
models = ["stepfun-ai/Step-Audio-2-mini"]
stage_configs = [str(Path(__file__).parent / "stage_configs" / "step_audio2_ci.yaml")]
test_params = [(model, stage_config) for model in models for stage_config in stage_configs]
def create_dummy_audio(sample_rate: int = 16000, duration_sec: float = 1.0) -> tuple[np.ndarray, int]:
"""Create a dummy audio signal (sine wave) for testing."""
t = np.linspace(0, duration_sec, int(sample_rate * duration_sec), dtype=np.float32)
audio = 0.5 * np.sin(2 * np.pi * 440 * t)
return audio, sample_rate
class StepAudio2OmniRunner(OmniRunner):
"""Test runner specialized for Step-Audio2 model."""
def get_omni_inputs(
self,
prompts: list[str] | str,
system_prompt: str | None = None,
audios=None,
**kwargs,
) -> list[dict]:
"""Construct Omni input format for Step-Audio2."""
if system_prompt is None:
system_prompt = "你是一个语音对话助手,能够理解音频输入并生成语音回复。"
audio_placeholder = "<audio_patch>"
if isinstance(prompts, str):
prompts = [prompts]
num_prompts = len(prompts)
if audios is None:
audios_list = [None] * num_prompts
elif isinstance(audios, list):
audios_list = audios if len(audios) == num_prompts else [audios[0]] * num_prompts
else:
audios_list = [audios] * num_prompts
omni_inputs = []
for i, prompt_text in enumerate(prompts):
user_content = ""
multi_modal_data = {}
audio = audios_list[i]
if audio is not None:
user_content += audio_placeholder
multi_modal_data["audio"] = audio
user_content += prompt_text
full_prompt = (
f"<|im_start|>system\n{system_prompt}<|im_end|>\n"
f"<|im_start|>user\n{user_content}<|im_end|>\n"
f"<|im_start|>assistant\n"
)
input_dict = {"prompt": full_prompt}
if multi_modal_data:
input_dict["multi_modal_data"] = multi_modal_data
omni_inputs.append(input_dict)
return omni_inputs
@pytest.fixture(scope="session")
def step_audio2_runner():
return StepAudio2OmniRunner
@pytest.mark.core_model
def test_processor_loads_correctly():
"""Test that Step-Audio2 processor can be imported and initialized."""
from vllm_omni.model_executor.models.step_audio2.step_audio2_thinker import (
StepAudio2MultiModalProcessor,
StepAudio2ProcessingInfo,
StepAudio2Processor,
)
assert StepAudio2MultiModalProcessor is not None
assert StepAudio2ProcessingInfo is not None
assert StepAudio2Processor is not None
@pytest.mark.core_model
def test_audio_preprocessing():
"""Test that audio preprocessing produces correct tensor shapes."""
from vllm_omni.model_executor.models.step_audio2.step_audio2_thinker import (
log_mel_spectrogram,
padding_mels,
)
audio, sample_rate = create_dummy_audio(sample_rate=16000, duration_sec=1.0)
mel = log_mel_spectrogram(audio)
assert mel.ndim == 2, f"Expected 2D tensor, got {mel.ndim}D"
assert mel.shape[0] == 128, f"Expected 128 mel bins, got {mel.shape[0]}"
mels = [mel, mel]
padded_mels, mel_lens = padding_mels(mels)
assert padded_mels.ndim == 3, f"Expected 3D tensor, got {padded_mels.ndim}D"
assert padded_mels.shape[0] == 2, f"Expected batch size 2, got {padded_mels.shape[0]}"
assert padded_mels.shape[1] == 128, f"Expected 128 mel bins, got {padded_mels.shape[1]}"
@pytest.mark.core_model
def test_feature_length_calculation():
"""Test that audio feature length calculation is correct."""
from vllm_omni.model_executor.models.step_audio2.step_audio2_thinker import (
calculate_audio_feature_length,
)
assert calculate_audio_feature_length(1000) == 125
assert calculate_audio_feature_length(100) > 0
assert calculate_audio_feature_length(1) >= 1
@pytest.mark.core_model
def test_token_config_constants():
"""Test that token configuration constants are set correctly."""
from vllm_omni.model_executor.models.step_audio2.step_audio2_constants import (
DEFAULT_TOKEN_CONFIG,
STEP_AUDIO2_AUDIO_END,
STEP_AUDIO2_AUDIO_PATCH_TOKEN_ID,
STEP_AUDIO2_AUDIO_START,
STEP_AUDIO2_AUDIO_VOCAB_SIZE,
STEP_AUDIO2_TEXT_MAX,
)
assert STEP_AUDIO2_TEXT_MAX < STEP_AUDIO2_AUDIO_START, "Text tokens should come before audio tokens"
assert STEP_AUDIO2_AUDIO_END == STEP_AUDIO2_AUDIO_START + STEP_AUDIO2_AUDIO_VOCAB_SIZE - 1
assert STEP_AUDIO2_AUDIO_PATCH_TOKEN_ID > STEP_AUDIO2_TEXT_MAX
assert STEP_AUDIO2_AUDIO_PATCH_TOKEN_ID < STEP_AUDIO2_AUDIO_START
assert DEFAULT_TOKEN_CONFIG.text_max == STEP_AUDIO2_TEXT_MAX
assert DEFAULT_TOKEN_CONFIG.audio_start == STEP_AUDIO2_AUDIO_START
@pytest.mark.core_model
def test_mm_field_config_structure():
"""Test that multimodal field config is properly structured for vLLM batching."""
from vllm.multimodal.inputs import MultiModalFieldConfig
audio_lens = torch.tensor([100, 200, 150], dtype=torch.int32)
field_config = MultiModalFieldConfig.flat_from_sizes("audio", audio_lens)
assert field_config is not None
@pytest.mark.core_model
def test_audio_encoder_output_shape():
"""Test that audio encoder produces correct output shapes."""
from vllm_omni.model_executor.models.step_audio2.step_audio2_thinker import (
Adaptor,
AudioEncoder,
)
encoder = AudioEncoder(n_mels=128, n_ctx=1500, n_state=512, n_head=8, n_layer=6)
batch_size = 2
n_mels = 128
time_steps = 400
x = torch.randn(batch_size, n_mels, time_steps)
x_len = torch.tensor([time_steps, time_steps // 2], dtype=torch.int32)
encoded, encoded_lens = encoder(x, x_len)
assert encoded.ndim == 3, f"Expected 3D tensor, got {encoded.ndim}D"
assert encoded.shape[0] == batch_size
assert encoded.shape[2] == 512
adapter = Adaptor(n_state=512, n_hidden=4096, kernel_size=3, stride=2)
adapted = adapter(encoded)
assert adapted.ndim == 3
assert adapted.shape[0] == batch_size
assert adapted.shape[2] == 4096
@pytest.mark.core_model
def test_token_separation():
"""Test that token separation works correctly."""
from vllm_omni.model_executor.models.step_audio2.step_audio2_thinker import (
StepAudio2ThinkerForConditionalGeneration,
)
token_ids = [100, 200, 151700, 300, 151800, 400]
text_tokens, audio_tokens = StepAudio2ThinkerForConditionalGeneration.separate_tokens(token_ids)
assert text_tokens == [100, 200, 300, 400]
assert audio_tokens == [4, 104]
@pytest.mark.core_model
def test_has_audio_output():
"""Test detection of audio tokens in output."""
from vllm_omni.model_executor.models.step_audio2.step_audio2_thinker import (
StepAudio2ThinkerForConditionalGeneration,
)
text_only = [100, 200, 300]
assert not StepAudio2ThinkerForConditionalGeneration.has_audio_output(text_only)
with_audio = [100, 200, 151700, 300]
assert StepAudio2ThinkerForConditionalGeneration.has_audio_output(with_audio)
@pytest.mark.advanced_model
@pytest.mark.parametrize("test_config", test_params)
def test_audio_to_text_and_audio(step_audio2_runner: type[StepAudio2OmniRunner], test_config: tuple[str, str]) -> None:
"""Test processing audio input and generating text + audio output."""
model, stage_config_path = test_config
with step_audio2_runner(model, seed=42, stage_configs_path=stage_config_path) as runner:
audio = create_dummy_audio(sample_rate=16000, duration_sec=2.0)
outputs = runner.generate_multimodal(
prompts="请复述这段音频的内容。",
audios=audio,
)
assert len(outputs) > 0
text_output = None
for stage_output in outputs:
if stage_output.final_output_type == "text":
text_output = stage_output
break
assert text_output is not None
assert text_output.request_output is not None
text_content = text_output.request_output.outputs[0].text
assert text_content is not None
assert len(text_content.strip()) > 0
audio_output = None
for stage_output in outputs:
if stage_output.final_output_type == "audio":
audio_output = stage_output
break
if audio_output is not None:
assert audio_output.request_output is not None
audio_tensor = audio_output.request_output.outputs[0].multimodal_output.get("audio")
if audio_tensor is not None:
assert audio_tensor.numel() > 0
@pytest.mark.advanced_model
@pytest.mark.parametrize("test_config", test_params)
def test_text_only_input(step_audio2_runner: type[StepAudio2OmniRunner], test_config: tuple[str, str]) -> None:
"""Test processing text-only input (no audio)."""
model, stage_config_path = test_config
with step_audio2_runner(model, seed=42, stage_configs_path=stage_config_path) as runner:
outputs = runner.generate_multimodal(
prompts="你好,请用中文回答。",
audios=None,
)
assert len(outputs) > 0
text_output = None
for stage_output in outputs:
if stage_output.final_output_type == "text":
text_output = stage_output
break
assert text_output is not None
assert text_output.request_output is not None
text_content = text_output.request_output.outputs[0].text
assert text_content is not None
assert len(text_content.strip()) > 0
@@ -0,0 +1,96 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
E2E expansion tests for Step-Audio2 offline inference (nightly CI).
Full-model inference with audio input and audio output.
"""
from pathlib import Path
from typing import Any
import numpy as np
import pytest
from tests.helpers.mark import hardware_test
from tests.helpers.media import generate_synthetic_audio
from tests.helpers.runtime import OmniRunner
from vllm_omni.outputs import OmniRequestOutput
MODEL = "stepfun-ai/Step-Audio-2-mini"
STAGE_CONFIG = str(Path(__file__).parent / "stage_configs" / "step_audio2_ci.yaml")
TEST_PARAMS = [(MODEL, STAGE_CONFIG)]
pytestmark = [pytest.mark.slow, pytest.mark.tts]
DEFAULT_SYSTEM_PROMPT = "你是一个语音对话助手,能够理解音频输入并生成语音回复。"
SAMPLE_RATE = 16000
def _synthetic_audio(duration_sec: int = 2) -> tuple[np.ndarray, int]:
audio = generate_synthetic_audio(duration_sec, 1, SAMPLE_RATE)["np_array"]
if len(audio.shape) == 2:
audio = audio.squeeze()
return np.asarray(audio, dtype=np.float32), SAMPLE_RATE
def _build_step_audio2_input(
user_text: str,
*,
system_prompt: str = DEFAULT_SYSTEM_PROMPT,
audio: tuple[np.ndarray, int] | None = None,
) -> dict[str, Any]:
user_content = ""
multi_modal_data: dict[str, Any] = {}
if audio is not None:
user_content += "<audio_patch>"
multi_modal_data["audio"] = audio
user_content += user_text
full_prompt = (
f"<|im_start|>system\n{system_prompt}<|im_end|>\n"
f"<|im_start|>user\n{user_content}<|im_end|>\n"
f"<|im_start|>assistant\n"
)
input_dict: dict[str, Any] = {"prompt": full_prompt}
if multi_modal_data:
input_dict["multi_modal_data"] = multi_modal_data
return input_dict
def _assert_non_empty_text_output(outputs: list[OmniRequestOutput]) -> None:
assert len(outputs) > 0
text_output = next((o for o in outputs if o.final_output_type == "text"), None)
assert text_output is not None
assert text_output.request_output is not None
text_content = text_output.request_output.outputs[0].text
assert text_content is not None
assert len(text_content.strip()) > 0
@hardware_test(res={"cuda": "L4"}, num_cards=1)
@pytest.mark.parametrize("omni_runner", TEST_PARAMS, indirect=True)
def test_audio_to_text_and_audio(omni_runner: OmniRunner) -> None:
"""Test processing audio input and generating text + audio output."""
audio = _synthetic_audio(duration_sec=2)
omni_input = _build_step_audio2_input("请复述这段音频的内容。", audio=audio)
outputs = omni_runner.generate([omni_input])
_assert_non_empty_text_output(outputs)
audio_output = next((o for o in outputs if o.final_output_type == "audio"), None)
if audio_output is not None:
assert audio_output.request_output is not None
audio_tensor = audio_output.request_output.outputs[0].multimodal_output.get("audio")
if audio_tensor is not None:
assert audio_tensor.numel() > 0
@hardware_test(res={"cuda": "L4"}, num_cards=1)
@pytest.mark.parametrize("omni_runner", TEST_PARAMS, indirect=True)
def test_text_only_input(omni_runner: OmniRunner) -> None:
"""Test processing text-only input (no audio)."""
omni_input = _build_step_audio2_input("你好,请用中文回答。")
outputs = omni_runner.generate([omni_input])
_assert_non_empty_text_output(outputs)
@@ -14,12 +14,10 @@ VOXCPM2_MODEL = "openbmb/VoxCPM2"
DEPLOY_CONFIG = get_deploy_config_path("voxcpm2.yaml")
SAMPLE_RATE = 48000
# (model, stage_config_path) — see ``omni_runner`` in tests.helpers.fixtures.runtime
_OMNI_RUNNER_PARAM = (VOXCPM2_MODEL, DEPLOY_CONFIG)
@pytest.fixture(scope="module")
def voxcpm2_engine():
"""Create VoxCPM2 engine for testing."""
with OmniRunner(VOXCPM2_MODEL, stage_configs_path=DEPLOY_CONFIG) as runner:
yield runner.omni
pytestmark = pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True)
def _extract_audio(multimodal_output: dict) -> torch.Tensor:
@@ -45,9 +43,9 @@ def _extract_audio(multimodal_output: dict) -> torch.Tensor:
@pytest.mark.advanced_model
@pytest.mark.tts
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_voxcpm2_zero_shot_001(voxcpm2_engine):
def test_voxcpm2_zero_shot_001(omni_runner: OmniRunner) -> None:
"""Test zero-shot TTS produces valid audio output."""
outputs = voxcpm2_engine.generate([{"prompt": "Hello, this is a test."}])
outputs = omni_runner.omni.generate([{"prompt": "Hello, this is a test."}])
assert len(outputs) == 1
audio = _extract_audio(outputs[0].outputs[0].multimodal_output)
@@ -59,7 +57,7 @@ def test_voxcpm2_zero_shot_001(voxcpm2_engine):
@pytest.mark.advanced_model
@pytest.mark.tts
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_voxcpm2_voice_clone_002(voxcpm2_engine):
def test_voxcpm2_voice_clone_002(omni_runner: OmniRunner) -> None:
"""Test voice cloning with a reference audio file.
Uses the example ``reference_speaker.wav`` bundled with the voxcpm
@@ -82,7 +80,7 @@ def test_voxcpm2_voice_clone_002(voxcpm2_engine):
if ref_path is None:
pytest.skip("No reference audio available for voice clone test")
outputs = voxcpm2_engine.generate(
outputs = omni_runner.omni.generate(
[
{
"prompt": "Hello, this is a voice clone demo.",
@@ -101,7 +99,7 @@ def test_voxcpm2_voice_clone_002(voxcpm2_engine):
@pytest.mark.advanced_model
@pytest.mark.tts
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_voxcpm2_prefill_decode_mixed_batch_003(voxcpm2_engine):
def test_voxcpm2_prefill_decode_mixed_batch_003(omni_runner: OmniRunner) -> None:
"""Regression: prefill+decode mixed batch must not crash (PR #2903)."""
long_prompt = (
"This is a deliberately long prompt that will stay in the decode "
@@ -117,7 +115,7 @@ def test_voxcpm2_prefill_decode_mixed_batch_003(voxcpm2_engine):
]
requests = [{"prompt": long_prompt}] + [{"prompt": p} for p in short_prompts]
outputs = voxcpm2_engine.generate(requests)
outputs = omni_runner.omni.generate(requests)
assert len(outputs) == len(requests)
for i, out in enumerate(outputs):
@@ -2,16 +2,9 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
End-to-end offline inference tests for Voxtral TTS model.
E2E expansion tests for Voxtral TTS offline inference (nightly CI).
Tests both synchronous (Omni) and async streaming (AsyncOmni) paths.
Equivalent to running:
python3 examples/offline_inference/text_to_speech/voxtral_tts/end2end.py \
--model mistralai/Voxtral-4B-TTS-2603 \
--voice casual_female \
--text "Hello, how are you?" \
--write-audio
"""
import asyncio
@@ -36,14 +29,12 @@ from vllm_omni.entrypoints.async_omni import AsyncOmni
MODEL = "mistralai/Voxtral-4B-TTS-2603"
STAGE_CONFIG = get_deploy_config_path("voxtral_tts.yaml")
SAMPLE_RATE = 24000
# Minimum expected audio samples for a short sentence (~0.04s of 24kHz audio)
MIN_AUDIO_SAMPLES = 1000
VOICE = "casual_female"
TEST_TEXT = "Hello, how are you?"
# (model, stage_config_path, extra_omni_kwargs) for indirect parametrize on
# ``omni_runner_function`` (function-scoped: must exit before ``AsyncOmni`` test).
pytestmark = [pytest.mark.slow, pytest.mark.tts]
_OMNI_RUNNER_PARAM = (
MODEL,
STAGE_CONFIG,
@@ -66,10 +57,8 @@ def _compose_request(model_name: str, text: str, voice: str) -> dict:
}
@pytest.mark.advanced_model
@pytest.mark.tts
@pytest.mark.parametrize("omni_runner_function", [_OMNI_RUNNER_PARAM], indirect=True)
@hardware_test(res={"cuda": "H100"}, num_cards=1)
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_voxtral_tts_offline_basic(omni_runner_function: OmniRunner) -> None:
"""Offline sync path; function-scoped runner so AsyncOmni test does not overlap a live Omni."""
omni = omni_runner_function.omni
@@ -82,7 +71,6 @@ def test_voxtral_tts_offline_basic(omni_runner_function: OmniRunner) -> None:
assert len(outputs) > 0, "No outputs generated"
# Find audio output from the final stage
audio_data = None
for o in outputs:
mm = getattr(o, "multimodal_output", None)
@@ -92,7 +80,6 @@ def test_voxtral_tts_offline_basic(omni_runner_function: OmniRunner) -> None:
assert audio_data is not None, "No audio output found in any stage output"
# Concatenate audio chunks if returned as a list of tensors
if isinstance(audio_data, list):
audio_tensor = torch.cat(audio_data)
elif isinstance(audio_data, torch.Tensor):
@@ -105,14 +92,10 @@ def test_voxtral_tts_offline_basic(omni_runner_function: OmniRunner) -> None:
assert len(audio_array) > MIN_AUDIO_SAMPLES, (
f"Audio too short: {len(audio_array)} samples, expected > {MIN_AUDIO_SAMPLES}"
)
# Verify audio isn't all zeros / silence
assert np.max(np.abs(audio_array)) > 0.01, "Audio appears to be silence"
@pytest.mark.advanced_model
@pytest.mark.tts
@hardware_test(res={"cuda": "H100"}, num_cards=1)
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_voxtral_tts_offline_streaming():
"""Test AsyncOmni streaming inference for Voxtral TTS."""
@@ -126,7 +109,6 @@ def test_voxtral_tts_offline_streaming():
try:
inputs = _compose_request(MODEL, TEST_TEXT, VOICE)
sampling_params = SamplingParams(max_tokens=2500)
all_audio_chunks = []
@@ -146,8 +128,6 @@ def test_voxtral_tts_offline_streaming():
if isinstance(audio_chunk, torch.Tensor):
if finished:
# Last chunk may return whole audio instead of
# a delta — cut already-accumulated samples.
audio_np = audio_chunk[accumulated_samples:].float().detach().cpu().numpy()
else:
audio_np = audio_chunk.float().detach().cpu().numpy()
@@ -167,8 +147,6 @@ def test_voxtral_tts_offline_streaming():
assert len(audio_array) > MIN_AUDIO_SAMPLES, (
f"Audio too short: {len(audio_array)} samples, expected > {MIN_AUDIO_SAMPLES}"
)
# Verify audio isn't all zeros / silence
assert np.max(np.abs(audio_array)) > 0.01, "Audio appears to be silence"
finally: