@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / f66f1e0fa3
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 12:15 UTC

[Bugfix] Fix broken Qwen2.5-omni tests (#17613)

Signed-off-by: Isotr0py <2037008807@qq.com>

Isotr0py committed May 4, 2025 at 01:08 UTC f66f1e0fa3d73da2d537eb1d16e8354f8c4379a8
4 files changed +21 -8
tests/models/multimodal/generation/test_common.py
+5 -3
@@ -8,7 +8,8 @@ from collections import defaultdict
8 from pathlib import PosixPath
9
10 import pytest
11 -from transformers import AutoModelForImageTextToText, AutoModelForVision2Seq
11 +from transformers import (AutoModelForImageTextToText,
12 + AutoModelForTextToWaveform, AutoModelForVision2Seq)
13
14 from vllm.platforms import current_platform
15 from vllm.utils import identity
@@ -140,7 +141,7 @@ VLM_TEST_SETTINGS = {
141 marks=[pytest.mark.core_model, pytest.mark.cpu_model],
142 ),
143 "qwen2_5_omni": VLMTestInfo(
143 - models=["Qwen/Qwen2.5-Omni-7B"],
144 + models=["Qwen/Qwen2.5-Omni-3B"],
145 test_type=(
146 VLMTestType.IMAGE,
147 VLMTestType.MULTI_IMAGE,
@@ -151,8 +152,9 @@ VLM_TEST_SETTINGS = {
152 video_idx_to_prompt=lambda idx: "<|vision_bos|><|VIDEO|><|vision_eos|>", # noqa: E501
153 max_model_len=4096,
154 max_num_seqs=2,
154 - auto_cls=AutoModelForVision2Seq,
155 + auto_cls=AutoModelForTextToWaveform,
156 vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
157 + patch_hf_runner=model_utils.qwen2_5_omni_patch_hf_runner,
158 image_size_factors=[(), (0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
159 marks=[pytest.mark.core_model, pytest.mark.cpu_model],
160 ),
tests/models/multimodal/generation/vlm_utils/model_utils.py
+8
@@ -706,3 +706,11 @@ def ovis2_patch_hf_runner(hf_model: HfRunner) -> HfRunner:
706
707 hf_model.processor = processor
708 return hf_model
709 +
710 +
711 +def qwen2_5_omni_patch_hf_runner(hf_model: HfRunner) -> HfRunner:
712 + """Patches and returns an instance of the HfRunner for Qwen2.5-Omni."""
713 + thinker = hf_model.model.thinker
714 + thinker.get_output_embeddings = lambda: thinker.lm_head
715 + hf_model.model = thinker
716 + return hf_model
tests/models/multimodal/processing/test_common.py
+1 -1
@@ -284,7 +284,7 @@ def _test_processing_correctness_mistral(
284 "Qwen/Qwen2-VL-2B-Instruct",
285 "Qwen/Qwen2.5-VL-3B-Instruct",
286 "Qwen/Qwen2-Audio-7B-Instruct",
287 - "Qwen/Qwen2.5-Omni-7B",
287 + "Qwen/Qwen2.5-Omni-3B",
288 "Skywork/Skywork-R1V-38B",
289 "fixie-ai/ultravox-v0_5-llama-3_2-1b",
290 "openai/whisper-large-v3",
tests/models/registry.py
+7 -4
@@ -72,12 +72,15 @@ class _HfExamplesInfo:
72 return
73
74 current_version = TRANSFORMERS_VERSION
75 + cur_base_version = Version(current_version).base_version
76 min_version = self.min_transformers_version
77 max_version = self.max_transformers_version
78 msg = f"`transformers=={current_version}` installed, but `transformers"
78 - if min_version and Version(current_version) < Version(min_version):
79 + # Only check the base version for the min/max version, otherwise preview
80 + # models cannot be run because `x.yy.0.dev0`<`x.yy.0`
81 + if min_version and Version(cur_base_version) < Version(min_version):
82 msg += f">={min_version}` is required to run this model."
80 - elif max_version and Version(current_version) > Version(max_version):
83 + elif max_version and Version(cur_base_version) > Version(max_version):
84 msg += f"<={max_version}` is required to run this model."
85 else:
86 return
@@ -362,8 +365,8 @@ _MULTIMODAL_EXAMPLE_MODELS = {
365 "Qwen2AudioForConditionalGeneration": _HfExamplesInfo("Qwen/Qwen2-Audio-7B-Instruct"), # noqa: E501
366 "Qwen2VLForConditionalGeneration": _HfExamplesInfo("Qwen/Qwen2-VL-2B-Instruct"), # noqa: E501
367 "Qwen2_5_VLForConditionalGeneration": _HfExamplesInfo("Qwen/Qwen2.5-VL-3B-Instruct"), # noqa: E501
365 - "Qwen2_5OmniModel": _HfExamplesInfo("Qwen/Qwen2.5-Omni-7B", # noqa: E501
366 - min_transformers_version="4.52"), # noqa: E501
368 + "Qwen2_5OmniModel": _HfExamplesInfo("Qwen/Qwen2.5-Omni-3B",
369 + min_transformers_version="4.52"),
370 "SkyworkR1VChatModel": _HfExamplesInfo("Skywork/Skywork-R1V-38B"),
371 "SmolVLMForConditionalGeneration": _HfExamplesInfo("HuggingFaceTB/SmolVLM2-2.2B-Instruct"), # noqa: E501
372 "UltravoxModel": _HfExamplesInfo("fixie-ai/ultravox-v0_5-llama-3_2-1b", # noqa: E501