[Bugfix] Fix Qwen3-Omni crash on video with no audio track when use_audio_in_video=True (#48420)

Signed-off-by: RyanJHamby <ryanhamby22@gmail.com>
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Co-authored-by: Isotr0py <Isotr0py@outlook.com>
This commit is contained in:
Ryan Hamby
2026-08-03 16:22:00 -07:00
committed by GitHub
co-authored by Isotr0py
parent c2881ce603
commit 6a9109d865
3 changed files with 57 additions and 1 deletions
@@ -113,3 +113,35 @@ def test_audio_in_video_cache_correctness(model_id: str, num_videos: int) -> Non
f" baseline : {baseline_ids}\n"
f" cache-hit: {second_ids}"
)
@pytest.mark.parametrize("model_id", MODELS)
def test_use_audio_in_video_without_audio_track(model_id: str) -> None:
"""
A video with no audio track, combined with `use_audio_in_video=True`,
must raise a clear `ValueError` naming the mismatch, rather than an
opaque `StopIteration`-derived error from the underlying HF processor.
"""
ctx = build_model_context(
model_id,
limit_mm_per_prompt={"audio": 1, "image": 0, "video": 1},
)
processor = MULTIMODAL_REGISTRY.create_processor(ctx.model_config, cache=None)
video_token_id = processor.info.get_hf_config().video_token_id
rng = np.random.RandomState(0)
video = random_video(rng, min_frames=8, max_frames=9, min_wh=64, max_wh=65)
# No "audio" key at all in this request's data: this is the "video has
# no audio track" case. (The audio limit above is 1, not 0, so that
# `mm_counts["audio"]` is still declared for this request; a 0 limit
# would make vLLM omit the "audio" key from `mm_counts` entirely, which
# trips an unrelated assertion in `_apply_hf_processor_mm_only`.)
mm_data = {"video": [video]}
with pytest.raises(ValueError, match="doesn't have audio track"):
processor(
[video_token_id],
mm_items=processor.info.parse_mm_data(mm_data),
hf_processor_mm_kwargs={"use_audio_in_video": True},
)