Files
vllm-omni/tests/e2e/offline_inference/test_qwen3_omni.py
T

69 lines
2.4 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
2025-12-12 14:25:52 +08:00
E2E offline tests for Omni model with video input and audio output.
"""
2025-12-08 18:11:39 +08:00
import os
from pathlib import Path
import pytest
from vllm.assets.video import VideoAsset
2025-12-12 14:25:52 +08:00
from .conftest import OmniRunner
2025-12-08 18:11:39 +08:00
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
2025-12-08 18:11:39 +08:00
models = ["Qwen/Qwen3-Omni-30B-A3B-Instruct"]
# CI stage config for 2xH100-80G GPUs
2025-12-12 14:25:52 +08:00
stage_configs = [str(Path(__file__).parent / "stage_configs" / "qwen3_omni_ci.yaml")]
# Create parameter combinations for model and stage config
test_params = [(model, stage_config) for model in models for stage_config in stage_configs]
2025-12-12 14:25:52 +08:00
@pytest.mark.parametrize("test_config", test_params)
def test_video_to_audio(omni_runner: type[OmniRunner], test_config) -> None:
2025-12-08 18:11:39 +08:00
"""Test processing video, generating audio output."""
2025-12-12 14:25:52 +08:00
model, stage_config_path = test_config
2025-12-19 16:42:02 +08:00
with omni_runner(model, seed=42, stage_configs_path=stage_config_path, init_sleep_seconds=90) as runner:
2025-12-08 18:11:39 +08:00
# Prepare inputs
question = "Describe the video briefly."
video = VideoAsset(name="baby_reading", num_frames=4).np_ndarrays
outputs = runner.generate_multimodal(
prompts=question,
videos=video,
)
# Verify we got outputs from multiple stages
assert len(outputs) > 0
# Find and verify text output (thinker stage)
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 len(text_output.request_output) > 0
text_content = text_output.request_output[0].outputs[0].text
assert text_content is not None
assert len(text_content.strip()) > 0
# Find and verify audio output (code2wav stage)
audio_output = None
for stage_output in outputs:
if stage_output.final_output_type == "audio":
audio_output = stage_output
break
assert audio_output is not None
assert len(audio_output.request_output) > 0
# Verify audio tensor exists and has content
audio_tensor = audio_output.request_output[0].multimodal_output["audio"]
assert audio_tensor is not None
assert audio_tensor.numel() > 0