Skip to content

Commit f66f1e0

Browse files
authored
[Bugfix] Fix broken Qwen2.5-omni tests (vllm-project#17613)
Signed-off-by: Isotr0py <2037008807@qq.com>
1 parent 887d7af commit f66f1e0

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

tests/models/multimodal/generation/test_common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from pathlib import PosixPath
99

1010
import pytest
11-
from transformers import AutoModelForImageTextToText, AutoModelForVision2Seq
11+
from transformers import (AutoModelForImageTextToText,
12+
AutoModelForTextToWaveform, AutoModelForVision2Seq)
1213

1314
from vllm.platforms import current_platform
1415
from vllm.utils import identity
@@ -140,7 +141,7 @@
140141
marks=[pytest.mark.core_model, pytest.mark.cpu_model],
141142
),
142143
"qwen2_5_omni": VLMTestInfo(
143-
models=["Qwen/Qwen2.5-Omni-7B"],
144+
models=["Qwen/Qwen2.5-Omni-3B"],
144145
test_type=(
145146
VLMTestType.IMAGE,
146147
VLMTestType.MULTI_IMAGE,
@@ -151,8 +152,9 @@
151152
video_idx_to_prompt=lambda idx: "<|vision_bos|><|VIDEO|><|vision_eos|>", # noqa: E501
152153
max_model_len=4096,
153154
max_num_seqs=2,
154-
auto_cls=AutoModelForVision2Seq,
155+
auto_cls=AutoModelForTextToWaveform,
155156
vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
157+
patch_hf_runner=model_utils.qwen2_5_omni_patch_hf_runner,
156158
image_size_factors=[(), (0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
157159
marks=[pytest.mark.core_model, pytest.mark.cpu_model],
158160
),

tests/models/multimodal/generation/vlm_utils/model_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,3 +706,11 @@ def processor(*args, text="", images=None, **kwargs):
706706

707707
hf_model.processor = processor
708708
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def _test_processing_correctness_mistral(
284284
"Qwen/Qwen2-VL-2B-Instruct",
285285
"Qwen/Qwen2.5-VL-3B-Instruct",
286286
"Qwen/Qwen2-Audio-7B-Instruct",
287-
"Qwen/Qwen2.5-Omni-7B",
287+
"Qwen/Qwen2.5-Omni-3B",
288288
"Skywork/Skywork-R1V-38B",
289289
"fixie-ai/ultravox-v0_5-llama-3_2-1b",
290290
"openai/whisper-large-v3",

tests/models/registry.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ def check_transformers_version(
7272
return
7373

7474
current_version = TRANSFORMERS_VERSION
75+
cur_base_version = Version(current_version).base_version
7576
min_version = self.min_transformers_version
7677
max_version = self.max_transformers_version
7778
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):
7982
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):
8184
msg += f"<={max_version}` is required to run this model."
8285
else:
8386
return
@@ -362,8 +365,8 @@ def check_available_online(
362365
"Qwen2AudioForConditionalGeneration": _HfExamplesInfo("Qwen/Qwen2-Audio-7B-Instruct"), # noqa: E501
363366
"Qwen2VLForConditionalGeneration": _HfExamplesInfo("Qwen/Qwen2-VL-2B-Instruct"), # noqa: E501
364367
"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"),
367370
"SkyworkR1VChatModel": _HfExamplesInfo("Skywork/Skywork-R1V-38B"),
368371
"SmolVLMForConditionalGeneration": _HfExamplesInfo("HuggingFaceTB/SmolVLM2-2.2B-Instruct"), # noqa: E501
369372
"UltravoxModel": _HfExamplesInfo("fixie-ai/ultravox-v0_5-llama-3_2-1b", # noqa: E501

0 commit comments

Comments
 (0)