test_registry.py 1.07 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Unit tests for MultiModalRegistry.supports_multimodal_inputs and
Qwen2.5-VL visual component loading behavior.
"""

import pytest

from vllm.multimodal import MULTIMODAL_REGISTRY

from ..models.utils import build_model_context

14
15
pytestmark = pytest.mark.cpu_test

16
17
18
19
20
21

@pytest.mark.parametrize(
    "model_id,limit_mm_per_prompt,expected",
    [
        ("Qwen/Qwen2-0.5B-Instruct", {}, False),
        ("Qwen/Qwen2.5-VL-3B-Instruct", {}, True),
22
23
        ("Qwen/Qwen2.5-VL-3B-Instruct", {"image": 0, "video": 0}, False),
        ("Qwen/Qwen2.5-VL-3B-Instruct", {"image": 0}, True),
24
25
26
27
    ],
)
@pytest.mark.core_model
def test_supports_multimodal_inputs(model_id, limit_mm_per_prompt, expected):
28
    """Test supports_multimodal_inputs returns correct boolean for various
29
30
31
32
33
    configs."""
    ctx = build_model_context(
        model_id,
        limit_mm_per_prompt=limit_mm_per_prompt,
    )
34
35
36
    assert (
        MULTIMODAL_REGISTRY.supports_multimodal_inputs(ctx.renderer_config) is expected
    )