test_common.py 56.9 KB
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4
5
"""Common tests for testing .generate() functionality for single / multiple
image, embedding, and video support for different VLMs in vLLM.
"""
6

7
8
import math
from collections import defaultdict
9
10
11
from pathlib import PosixPath

import pytest
12
from packaging.version import Version
13
14
from transformers import (
    AutoModel,
15
    AutoModelForCausalLM,
16
17
18
    AutoModelForImageTextToText,
    AutoModelForTextToWaveform,
)
19
from transformers import __version__ as TRANSFORMERS_VERSION
20
21

from vllm.platforms import current_platform
22
from vllm.utils.func_utils import identity
23

24
25
26
27
28
29
30
31
32
from ....conftest import (
    IMAGE_ASSETS,
    AudioTestAssets,
    HfRunner,
    ImageTestAssets,
    VideoTestAssets,
    VllmRunner,
)
from ....utils import create_new_process_for_each_test, large_gpu_mark, multi_gpu_marks
33
34
35
from ...utils import check_outputs_equal
from .vlm_utils import custom_inputs, model_utils, runners
from .vlm_utils.case_filtering import get_parametrized_options
36
37
38
39
40
41
from .vlm_utils.types import (
    CustomTestOptions,
    ExpandableVLMTestArgs,
    VLMTestInfo,
    VLMTestType,
)
42
43
44
45
46
47

COMMON_BROADCAST_SETTINGS = {
    "test_type": VLMTestType.IMAGE,
    "dtype": "half",
    "max_tokens": 5,
    "tensor_parallel_size": 2,
48
    "hf_model_kwargs": {"device_map": "auto"},
49
    "image_size_factors": [(0.25, 0.5, 1.0)],
50
51
52
    "distributed_executor_backend": (
        "ray",
        "mp",
53
    ),
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
}

### Test configuration for specific models
# NOTE: The convention of the test settings below is to lead each test key
# with the name of the model arch used in the test, using underscores in place
# of hyphens; this makes it more convenient to filter tests for a specific kind
# of model. For example....
#
# To run all test types for a specific key:
#     use the k flag to substring match with a leading square bracket; if the
#     model arch happens to be a substring of another one, you can add a
#     trailing hyphen. E.g.,
#                 - pytest $TEST_FILE -k "[llava-"
#     prevents matching on "[llava_next-" & will match just the enabled cases
#     for llava, i.e., single image, image embedding, and custom input tests.
#
# To run a test for a Test Info for just one of multiple models:
#     use the k flag to substring match the model name, e.g.,
#                 - pytest $TEST_FILE -k OpenGVLab/InternVL2-1B
#     prevents matching on nGVLab/InternVL2-2B.
#
# You can also combine substrings to match more granularly.
#     ex 1:
#        pytest $TEST_FILE -k "test_single_image and OpenGVLab/InternVL2-1B"
#     will run only test_single_image* for OpenGVLab/InternVL2-1B; this would
#     match both wrappers for single image tests, since it also matches
#     test_single_image_heavy (which forks if we have a distributed backend)
#     ex 2:
#        pytest $TEST_FILE -k  "[llava- or [intern_vl-"
#     will run all of the tests for only llava & internvl.
#
# NOTE you can add --collect-only to any of the above commands to see
# which cases would be selected and deselected by pytest. In general,
# this is a good idea for checking your command first, since tests are slow.

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

def _granite4_vision_vllm_to_hf_output(vllm_output, model):
    """Post-processor for granite4_vision vLLM output.

    Self-contained to avoid calling AutoConfig/AutoTokenizer without
    trust_remote_code (needed while the model is not in upstream HF).
    """
    output_ids, output_str, out_logprobs = vllm_output
    mm_token_id = 100352
    hf_output_ids = [
        token_id
        for idx, token_id in enumerate(output_ids)
        if token_id != mm_token_id or idx == 0 or output_ids[idx - 1] != mm_token_id
    ]
    hf_output_str = (
        output_str[1:] if output_str and output_str[0] == " " else output_str
    )
    eos_token_id = 100257
    if hf_output_ids and hf_output_ids[-1] == eos_token_id:
        hf_output_str = hf_output_str + "<|end_of_text|>"
    return hf_output_ids, hf_output_str, out_logprobs


112
VLM_TEST_SETTINGS = {
113
114
115
    #### Core tests to always run in the CI
    "llava": VLMTestInfo(
        models=["llava-hf/llava-1.5-7b-hf"],
116
        test_type=(VLMTestType.EMBEDDING, VLMTestType.IMAGE, VLMTestType.CUSTOM_INPUTS),
117
118
119
        prompt_formatter=lambda img_prompt: f"USER: {img_prompt}\nASSISTANT:",
        convert_assets_to_embeddings=model_utils.get_llava_embeddings,
        max_model_len=4096,
120
        auto_cls=AutoModelForImageTextToText,
121
        vllm_output_post_proc=model_utils.llava_image_vllm_to_hf_output,
122
123
124
125
126
127
128
129
        custom_test_opts=[
            CustomTestOptions(
                inputs=custom_inputs.multi_image_multi_aspect_ratio_inputs(
                    formatter=lambda img_prompt: f"USER: {img_prompt}\nASSISTANT:"
                ),
                limit_mm_per_prompt={"image": 4},
            )
        ],
130
        vllm_runner_kwargs={"enable_mm_embeds": True},
131
        marks=[pytest.mark.core_model, pytest.mark.cpu_model],
132
    ),
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
    "paligemma": VLMTestInfo(
        models=["google/paligemma-3b-mix-224"],
        test_type=VLMTestType.IMAGE,
        prompt_formatter=identity,
        img_idx_to_prompt=lambda idx: "",
        # Paligemma uses its own sample prompts because the default one fails
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
                "stop_sign": "caption es",
                "cherry_blossom": "What is in the picture?",
            }
        ),
        auto_cls=AutoModelForImageTextToText,
        vllm_output_post_proc=model_utils.paligemma_vllm_to_hf_output,
    ),
Roger Wang's avatar
Roger Wang committed
148
149
    "qwen2_5_vl": VLMTestInfo(
        models=["Qwen/Qwen2.5-VL-3B-Instruct"],
150
151
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE, VLMTestType.VIDEO),
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
152
153
        img_idx_to_prompt=lambda idx: "<|vision_start|><|image_pad|><|vision_end|>",
        video_idx_to_prompt=lambda idx: "<|vision_start|><|video_pad|><|vision_end|>",
154
        enforce_eager=False,
Roger Wang's avatar
Roger Wang committed
155
156
        max_model_len=4096,
        max_num_seqs=2,
157
        auto_cls=AutoModelForImageTextToText,
Roger Wang's avatar
Roger Wang committed
158
        vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
159
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
160
        marks=[pytest.mark.core_model, pytest.mark.cpu_model],
Roger Wang's avatar
Roger Wang committed
161
    ),
162
    "qwen2_5_omni": VLMTestInfo(
163
        models=["Qwen/Qwen2.5-Omni-3B"],
164
165
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE, VLMTestType.VIDEO),
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
166
167
        img_idx_to_prompt=lambda idx: "<|vision_bos|><|IMAGE|><|vision_eos|>",
        video_idx_to_prompt=lambda idx: "<|vision_bos|><|VIDEO|><|vision_eos|>",
168
169
        max_model_len=4096,
        max_num_seqs=2,
170
        num_logprobs=6 if current_platform.is_cpu() else 5,
171
        auto_cls=AutoModelForTextToWaveform,
172
        vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
173
        patch_hf_runner=model_utils.qwen2_5_omni_patch_hf_runner,
174
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
175
176
        marks=[pytest.mark.core_model, pytest.mark.cpu_model],
    ),
177
178
179
180
181
182
183
    "qwen3_vl": VLMTestInfo(
        models=["Qwen/Qwen3-VL-4B-Instruct"],
        test_type=(
            VLMTestType.IMAGE,
            VLMTestType.MULTI_IMAGE,
            VLMTestType.VIDEO,
        ),
184
        enforce_eager=False,
185
186
187
188
189
190
191
192
193
194
        needs_video_metadata=True,
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
        img_idx_to_prompt=lambda idx: "<|vision_start|><|image_pad|><|vision_end|>",  # noqa: E501
        video_idx_to_prompt=lambda idx: "<|vision_start|><|video_pad|><|vision_end|>",  # noqa: E501
        max_model_len=4096,
        max_num_seqs=2,
        num_logprobs=20,
        auto_cls=AutoModelForImageTextToText,
        vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
        patch_hf_runner=model_utils.qwen3_vl_patch_hf_runner,
195
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
196
197
198
        marks=[
            pytest.mark.core_model,
        ],
199
200
201
        vllm_runner_kwargs={"attention_backend": "TRITON_ATTN"}
        if current_platform.is_rocm()
        else {},
202
    ),
203
    "ultravox": VLMTestInfo(
204
        models=["fixie-ai/ultravox-v0_5-llama-3_2-1b"],
205
        test_type=VLMTestType.AUDIO,
206
        prompt_formatter=lambda audio_prompt: f"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n{audio_prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",  # noqa: E501
207
208
209
210
211
        audio_idx_to_prompt=lambda idx: "<|audio|>",
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModel,
        hf_output_post_proc=model_utils.ultravox_trunc_hf_output,
212
213
214
215
216
217
218
219
        marks=[
            pytest.mark.core_model,
            pytest.mark.cpu_model,
            # TODO: Remove skip once model has been upstreamed to Transformers
            pytest.mark.skip(
                reason="Custom model code is not compatible with Transformers v5"
            ),
        ],
220
    ),
221
222
223
224
225
226
    #### Transformers fallback to test
    ## To reduce test burden, we only test batching arbitrary image size
    # Dynamic image length and number of patches
    "llava-onevision-transformers": VLMTestInfo(
        models=["llava-hf/llava-onevision-qwen2-0.5b-ov-hf"],
        test_type=VLMTestType.IMAGE,
227
        prompt_formatter=lambda vid_prompt: f"<|im_start|>user\n{vid_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
228
        max_model_len=16384,
229
230
        hf_model_kwargs=model_utils.llava_onevision_hf_model_kwargs(
            "llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
231
        ),
232
233
234
235
236
        auto_cls=AutoModelForImageTextToText,
        vllm_output_post_proc=model_utils.llava_onevision_vllm_to_hf_output,
        image_size_factors=[(0.25, 0.5, 1.0)],
        vllm_runner_kwargs={
            "model_impl": "transformers",
237
            "default_torch_num_threads": 1,
238
        },
239
        marks=[pytest.mark.core_model],
240
    ),
241
242
243
    # Gemma3 has bidirectional mask on images
    "gemma3-transformers": VLMTestInfo(
        models=["google/gemma-3-4b-it"],
244
245
246
        test_type=VLMTestType.IMAGE,
        prompt_formatter=lambda vid_prompt: f"<'<bos><start_of_turn>user\n{vid_prompt}<start_of_image><end_of_turn>\n<start_of_turn>model\n",  # noqa: E501
        max_model_len=4096,
247
248
249
250
251
252
        auto_cls=AutoModelForImageTextToText,
        vllm_output_post_proc=model_utils.gemma3_vllm_to_hf_output,
        image_size_factors=[(0.25, 0.5, 1.0)],
        vllm_runner_kwargs={
            "model_impl": "transformers",
        },
253
254
255
256
        marks=[
            pytest.mark.core_model,
            *([large_gpu_mark(min_gb=80)] if current_platform.is_rocm() else []),
        ],
257
    ),
258
259
260
    "idefics3-transformers": VLMTestInfo(
        models=["HuggingFaceTB/SmolVLM-256M-Instruct"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
261
        prompt_formatter=lambda img_prompt: f"<|begin_of_text|>User:{img_prompt}<end_of_utterance>\nAssistant:",  # noqa: E501
262
263
264
265
266
267
268
269
270
271
272
        img_idx_to_prompt=lambda idx: "<image>",
        max_model_len=8192,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        hf_output_post_proc=model_utils.idefics3_trunc_hf_output,
        image_size_factors=[(0.25, 0.5, 1.0)],
        vllm_runner_kwargs={
            "model_impl": "transformers",
        },
        marks=[pytest.mark.core_model],
    ),
273
274
275
276
    # Pixel values from processor are not 4D or 5D arrays
    "qwen2_5_vl-transformers": VLMTestInfo(
        models=["Qwen/Qwen2.5-VL-3B-Instruct"],
        test_type=VLMTestType.IMAGE,
277
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
278
        img_idx_to_prompt=lambda idx: "<|vision_start|><|image_pad|><|vision_end|>",
279
280
281
282
283
284
285
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
        image_size_factors=[(0.25, 0.2, 0.15)],
        vllm_runner_kwargs={
            "model_impl": "transformers",
286
287
288
289
290
291
292
293
294
295
296
            # TODO: [ROCm] Revert this once issue #30167 is resolved
            **(
                {
                    "mm_processor_kwargs": {
                        "min_pixels": 256 * 28 * 28,
                        "max_pixels": 1280 * 28 * 28,
                    },
                }
                if current_platform.is_rocm()
                else {}
            ),
297
        },
298
        marks=[large_gpu_mark(min_gb=80 if current_platform.is_rocm() else 32)],
299
    ),
300
    #### Extended model tests
301
302
303
    "aria": VLMTestInfo(
        models=["rhymes-ai/Aria"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
304
        prompt_formatter=lambda img_prompt: f"<|im_start|>user\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n ",  # noqa: E501
305
306
307
308
        img_idx_to_prompt=lambda idx: "<fim_prefix><|img|><fim_suffix>\n",
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
309
310
311
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
                "stop_sign": "<vlm_image>Please describe the image shortly.",
312
                "cherry_blossom": "<vlm_image>Please infer the season with reason.",
313
314
            }
        ),
315
        multi_image_prompt="<vlm_image><vlm_image>Describe the two images shortly.",
316
317
318
319
320
        stop_str=["<|im_end|>"],
        image_size_factors=[(0.10, 0.15)],
        max_tokens=64,
        marks=[large_gpu_mark(min_gb=64)],
    ),
Jennifer Zhao's avatar
Jennifer Zhao committed
321
    "aya_vision": VLMTestInfo(
322
        models=["CohereLabs/aya-vision-8b"],
323
        test_type=(VLMTestType.IMAGE),
324
325
326
        prompt_formatter=lambda img_prompt: f"<|START_OF_TURN_TOKEN|><|USER_TOKEN|>{img_prompt}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",  # noqa: E501
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
327
328
                "stop_sign": "<image>What's the content in the center of the image?",
                "cherry_blossom": "<image>What is the season?",
329
330
            }
        ),
331
        multi_image_prompt="<image><image>Describe the two images in detail.",
332
333
334
335
336
337
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        vllm_runner_kwargs={"mm_processor_kwargs": {"crop_to_patches": True}},
    ),
    "aya_vision-multi_image": VLMTestInfo(
338
        models=["CohereLabs/aya-vision-8b"],
339
        test_type=(VLMTestType.MULTI_IMAGE),
340
341
342
        prompt_formatter=lambda img_prompt: f"<|START_OF_TURN_TOKEN|><|USER_TOKEN|>{img_prompt}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",  # noqa: E501
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
343
344
                "stop_sign": "<image>What's the content in the center of the image?",
                "cherry_blossom": "<image>What is the season?",
345
346
            }
        ),
347
        multi_image_prompt="<image><image>Describe the two images in detail.",
348
        max_model_len=4096,
Jennifer Zhao's avatar
Jennifer Zhao committed
349
350
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
351
352
        vllm_runner_kwargs={"mm_processor_kwargs": {"crop_to_patches": True}},
        marks=[large_gpu_mark(min_gb=32)],
Jennifer Zhao's avatar
Jennifer Zhao committed
353
    ),
354
    "blip2": VLMTestInfo(
355
        models=["Salesforce/blip2-opt-2.7b"],
356
357
358
        test_type=VLMTestType.IMAGE,
        prompt_formatter=lambda img_prompt: f"Question: {img_prompt} Answer:",
        img_idx_to_prompt=lambda idx: "",
359
        auto_cls=AutoModelForImageTextToText,
360
        vllm_output_post_proc=model_utils.blip2_vllm_to_hf_output,
361
362
        # FIXME: https://github.com/huggingface/transformers/pull/38510
        marks=[pytest.mark.skip("Model is broken")],
363
364
365
366
367
368
    ),
    "chameleon": VLMTestInfo(
        models=["facebook/chameleon-7b"],
        test_type=VLMTestType.IMAGE,
        prompt_formatter=lambda img_prompt: f"USER: {img_prompt}\nASSISTANT:",
        max_model_len=4096,
369
        max_num_seqs=2,
370
        auto_cls=AutoModelForImageTextToText,
371
        # For chameleon, we only compare the sequences
372
373
        vllm_output_post_proc=lambda vllm_output, model: vllm_output[:2],
        hf_output_post_proc=lambda hf_output, model: hf_output[:2],
374
375
376
377
        comparator=check_outputs_equal,
        max_tokens=8,
        dtype="bfloat16",
    ),
378
    "deepseek_vl_v2": VLMTestInfo(
379
        models=["Isotr0py/deepseek-vl2-tiny"],  # model repo using dynamic module
380
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
381
        prompt_formatter=lambda img_prompt: f"<|User|>: {img_prompt}\n\n<|Assistant|>: ",  # noqa: E501
382
383
        max_model_len=4096,
        max_num_seqs=2,
384
385
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
386
                "stop_sign": "<image>\nWhat's the content in the center of the image?",
387
388
389
390
                "cherry_blossom": "<image>\nPlease infer the season with reason in details.",  # noqa: E501
            }
        ),
        multi_image_prompt="image_1:<image>\nimage_2:<image>\nWhich image can we see the car and the tower?",  # noqa: E501
391
392
        patch_hf_runner=model_utils.deepseekvl2_patch_hf_runner,
        hf_output_post_proc=model_utils.deepseekvl2_trunc_hf_output,
393
        stop_str=["<|end▁of▁sentence|>", "<|begin▁of▁sentence|>"],
394
        image_size_factors=[(1.0,), (1.0, 1.0, 1.0), (0.1, 0.5, 1.0)],
395
    ),
396
397
398
399
400
401
402
    "fuyu": VLMTestInfo(
        models=["adept/fuyu-8b"],
        test_type=VLMTestType.IMAGE,
        prompt_formatter=lambda img_prompt: f"{img_prompt}\n",
        img_idx_to_prompt=lambda idx: "",
        max_model_len=2048,
        max_num_seqs=2,
403
        auto_cls=AutoModelForImageTextToText,
404
405
406
        use_tokenizer_eos=True,
        vllm_output_post_proc=model_utils.fuyu_vllm_to_hf_output,
        num_logprobs=10,
407
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
408
        marks=[large_gpu_mark(min_gb=32)],
409
    ),
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
    "gemma3": VLMTestInfo(
        models=["google/gemma-3-4b-it"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=lambda img_prompt: f"<bos><start_of_turn>user\n{img_prompt}<end_of_turn>\n<start_of_turn>model\n",  # noqa: E501
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
                "stop_sign": "<start_of_image>What's the content in the center of the image?",  # noqa: E501
                "cherry_blossom": "<start_of_image>What is the season?",
            }
        ),
        multi_image_prompt="<start_of_image><start_of_image>Describe the two images in detail.",  # noqa: E501
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        vllm_runner_kwargs={"mm_processor_kwargs": {"do_pan_and_scan": True}},
        patch_hf_runner=model_utils.gemma3_patch_hf_runner,
    ),
427
428
429
    "gemma4": VLMTestInfo(
        models=["google/gemma-4-E2B-it"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
430
        prompt_formatter=lambda img_prompt: f"<bos><|turn>user\n{img_prompt}<turn|>\n<|turn>model\n",  # noqa: E501
431
432
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
433
434
                "stop_sign": "<|image|>What's the content in the center of the image?",  # noqa: E501
                "cherry_blossom": "<|image|>What is the season?",
435
436
            }
        ),
437
        multi_image_prompt="<|image|><|image|>Describe the two images in detail.",  # noqa: E501
438
439
440
441
442
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        vllm_runner_kwargs={"limit_mm_per_prompt": {"image": 4}},
    ),
443
444
445
446
447
448
449
450
    "granite_vision": VLMTestInfo(
        models=["ibm-granite/granite-vision-3.3-2b"],
        test_type=(VLMTestType.IMAGE),
        prompt_formatter=lambda img_prompt: f"<|user|>\n{img_prompt}\n<|assistant|>\n",
        max_model_len=8192,
        auto_cls=AutoModelForImageTextToText,
        vllm_output_post_proc=model_utils.llava_image_vllm_to_hf_output,
    ),
451
    "glm4v": VLMTestInfo(
452
        models=["zai-org/glm-4v-9b"],
453
        test_type=VLMTestType.IMAGE,
454
        prompt_formatter=lambda img_prompt: f"<|user|>\n{img_prompt}<|assistant|>",
455
456
457
458
459
460
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
                "stop_sign": "<|begin_of_image|><|endoftext|><|end_of_image|>What's the content in the center of the image?",  # noqa: E501
                "cherry_blossom": "<|begin_of_image|><|endoftext|><|end_of_image|>What is the season?",  # noqa: E501
            }
        ),
461
462
463
        max_model_len=2048,
        max_num_seqs=2,
        get_stop_token_ids=lambda tok: [151329, 151336, 151338],
464
465
466
467
468
469
        patch_hf_runner=model_utils.glm4v_patch_hf_runner,
        # The image embeddings match with HF but the outputs of the language
        # decoder are only consistent up to 2 decimal places.
        # So, we need to reduce the number of tokens for the test to pass.
        max_tokens=8,
        num_logprobs=10,
470
        auto_cls=AutoModelForCausalLM,
471
        marks=[large_gpu_mark(min_gb=32)],
472
    ),
473
    "glm4_1v": VLMTestInfo(
474
        models=["zai-org/GLM-4.1V-9B-Thinking"],
475
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
476
        prompt_formatter=lambda img_prompt: f"[gMASK]<|user|>\n{img_prompt}<|assistant|>\n",  # noqa: E501
477
478
        img_idx_to_prompt=lambda idx: "<|begin_of_image|><|image|><|end_of_image|>",
        video_idx_to_prompt=lambda idx: "<|begin_of_video|><|video|><|end_of_video|>",
479
480
481
482
        max_model_len=2048,
        max_num_seqs=2,
        get_stop_token_ids=lambda tok: [151329, 151336, 151338],
        num_logprobs=10,
483
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
484
        auto_cls=AutoModelForImageTextToText,
485
        marks=[large_gpu_mark(min_gb=32)],
486
487
    ),
    "glm4_1v-video": VLMTestInfo(
488
        models=["zai-org/GLM-4.1V-9B-Thinking"],
489
490
        # GLM4.1V require include video metadata for input
        test_type=VLMTestType.CUSTOM_INPUTS,
491
        prompt_formatter=lambda vid_prompt: f"[gMASK]<|user|>\n{vid_prompt}<|assistant|>\n",  # noqa: E501
492
493
494
495
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        patch_hf_runner=model_utils.glm4_1v_patch_hf_runner,
496
497
498
499
500
501
        custom_test_opts=[
            CustomTestOptions(
                inputs=custom_inputs.video_with_metadata_glm4_1v(),
                limit_mm_per_prompt={"video": 1},
            )
        ],
502
        marks=[large_gpu_mark(min_gb=32)],
503
    ),
504
505
506
507
508
509
510
511
512
513
    "glm_ocr": VLMTestInfo(
        models=["zai-org/GLM-OCR"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=lambda img_prompt: f"[gMASK]<|user|>\n{img_prompt}<|assistant|>\n",  # noqa: E501
        img_idx_to_prompt=lambda idx: "<|begin_of_image|><|image|><|end_of_image|>",
        video_idx_to_prompt=lambda idx: "<|begin_of_video|><|video|><|end_of_video|>",
        max_model_len=2048,
        max_num_seqs=2,
        get_stop_token_ids=lambda tok: [151329, 151336, 151338],
        num_logprobs=10,
514
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
515
516
517
        auto_cls=AutoModelForImageTextToText,
        marks=[large_gpu_mark(min_gb=32)],
    ),
518
519
520
521
522
523
524
525
526
527
528
529
530
531
    "granite4_vision": VLMTestInfo(
        models=["ibm-granite/granite-vision-4.1-4b"],
        test_type=(VLMTestType.IMAGE),
        prompt_formatter=lambda img_prompt: f"<|user|>\n{img_prompt}\n<|assistant|>\n",
        max_model_len=8192,
        auto_cls=AutoModelForImageTextToText,
        vllm_output_post_proc=_granite4_vision_vllm_to_hf_output,
        image_size_factors=[(1.0,)],
        vllm_runner_kwargs={
            "enable_lora": True,
            "max_lora_rank": 256,
            "default_mm_loras": {"image": "ibm-granite/granite-vision-4.1-4b"},
        },
    ),
532
    "h2ovl": VLMTestInfo(
533
        models=[
534
            "h2oai/h2ovl-mississippi-800m",
535
            "h2oai/h2ovl-mississippi-2b",
536
537
        ],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
538
        prompt_formatter=lambda img_prompt: f"<|prompt|>{img_prompt}<|end|><|answer|>",
539
540
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
541
                "stop_sign": "<image>\nWhat's the content in the center of the image?",
542
543
544
                "cherry_blossom": "<image>\nWhat is the season?",
            }
        ),
545
546
547
        multi_image_prompt="Image-1: <image>\nImage-2: <image>\nDescribe the two images in short.",  # noqa: E501
        max_model_len=8192,
        use_tokenizer_eos=True,
548
        num_logprobs=10,
549
        patch_hf_runner=model_utils.h2ovl_patch_hf_runner,
550
    ),
551
    "idefics3": VLMTestInfo(
552
        models=["HuggingFaceTB/SmolVLM-256M-Instruct"],
553
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
554
        prompt_formatter=lambda img_prompt: f"<|begin_of_text|>User:{img_prompt}<end_of_utterance>\nAssistant:",  # noqa: E501
555
556
557
        img_idx_to_prompt=lambda idx: "<image>",
        max_model_len=8192,
        max_num_seqs=2,
558
        auto_cls=AutoModelForImageTextToText,
559
        hf_output_post_proc=model_utils.idefics3_trunc_hf_output,
560
    ),
561
562
563
564
    "intern_vl": VLMTestInfo(
        models=[
            "OpenGVLab/InternVL2-1B",
            "OpenGVLab/InternVL2-2B",
565
566
            # FIXME: Config cannot be loaded in transformers 4.52
            # "OpenGVLab/Mono-InternVL-2B",
567
568
        ],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
569
570
571
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>Assistant\n",  # noqa: E501
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
572
                "stop_sign": "<image>\nWhat's the content in the center of the image?",
573
574
575
                "cherry_blossom": "<image>\nWhat is the season?",
            }
        ),
576
577
578
579
        multi_image_prompt="Image-1: <image>\nImage-2: <image>\nDescribe the two images in short.",  # noqa: E501
        max_model_len=4096,
        use_tokenizer_eos=True,
        patch_hf_runner=model_utils.internvl_patch_hf_runner,
580
581
582
583
584
585
        # TODO: Remove skip once model has been upstreamed to Transformers
        marks=[
            pytest.mark.skip(
                reason="Custom model code tries to access data from meta-tensor"
            )
        ],
586
    ),
587
588
589
590
591
    "intern_vl-video": VLMTestInfo(
        models=[
            "OpenGVLab/InternVL3-1B",
        ],
        test_type=VLMTestType.VIDEO,
592
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>Assistant\n",  # noqa: E501
593
594
595
596
        video_idx_to_prompt=lambda idx: "<video>",
        max_model_len=8192,
        use_tokenizer_eos=True,
        patch_hf_runner=model_utils.internvl_patch_hf_runner,
597
        num_logprobs=10 if current_platform.is_rocm() else 5,
598
599
600
601
602
603
        # TODO: Remove skip once model has been upstreamed to Transformers
        marks=[
            pytest.mark.skip(
                reason="Custom model code tries to access data from meta-tensor"
            )
        ],
604
    ),
605
606
607
608
609
610
611
    "intern_vl-hf": VLMTestInfo(
        models=["OpenGVLab/InternVL3-1B-hf"],
        test_type=(
            VLMTestType.IMAGE,
            VLMTestType.MULTI_IMAGE,
            VLMTestType.VIDEO,
        ),
612
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>Assistant\n",  # noqa: E501
613
614
615
616
617
618
        img_idx_to_prompt=lambda idx: "<IMG_CONTEXT>",
        video_idx_to_prompt=lambda idx: "<video>",
        max_model_len=8192,
        use_tokenizer_eos=True,
        auto_cls=AutoModelForImageTextToText,
    ),
oscardev256's avatar
oscardev256 committed
619
    "isaac": VLMTestInfo(
620
621
622
623
624
        # NOTE: PerceptronAI/Isaac-0.1 removed because the upstream HF
        # repo has a stale model.safetensors.index.json that references
        # shard files which no longer exist (consolidated into a single
        # model.safetensors on 2026-03-20). Re-add once upstream fixes
        # the index file.
625
626
627
        models=[
            "PerceptronAI/Isaac-0.2-2B-Preview",
        ],
oscardev256's avatar
oscardev256 committed
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=lambda img_prompt: (
            f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n"
        ),
        img_idx_to_prompt=lambda idx: "<image>",
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
                "stop_sign": "<vlm_image>Please describe the image shortly.",
                "cherry_blossom": "<vlm_image>Please infer the season with reason.",
            }
        ),
        multi_image_prompt=(
            "Picture 1: <vlm_image>\n"
            "Picture 2: <vlm_image>\n"
            "Describe these two images with one paragraph respectively."
        ),
        enforce_eager=False,
        max_model_len=4096,
        max_num_seqs=2,
        hf_model_kwargs={"device_map": "auto"},
        patch_hf_runner=model_utils.isaac_patch_hf_runner,
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
650
651
        # TODO: Remove skip once model has been upstreamed to Transformers
        marks=[pytest.mark.skip(reason="Custom model imports deleted object")],  # noqa: E501
oscardev256's avatar
oscardev256 committed
652
    ),
653
654
655
    "kimi_vl": VLMTestInfo(
        models=["moonshotai/Kimi-VL-A3B-Instruct"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
656
        prompt_formatter=lambda img_prompt: f"<|im_user|>user<|im_middle|>{img_prompt}<|im_end|><|im_assistant|>assistant<|im_middle|>",  # noqa: E501
657
658
659
660
661
662
663
664
        img_idx_to_prompt=lambda _: "<|media_start|>image<|media_content|><|media_pad|><|media_end|>",  # noqa: E501
        max_model_len=8192,
        max_num_seqs=2,
        dtype="bfloat16",
        tensor_parallel_size=1,
        vllm_output_post_proc=model_utils.kimiv_vl_vllm_to_hf_output,
        marks=[large_gpu_mark(min_gb=48)],
    ),
665
666
    "llama4": VLMTestInfo(
        models=["meta-llama/Llama-4-Scout-17B-16E-Instruct"],
667
        prompt_formatter=lambda img_prompt: f"<|begin_of_text|><|header_start|>user<|header_end|>\n\n{img_prompt}<|eot|><|header_start|>assistant<|header_end|>\n\n",  # noqa: E501
668
669
670
        img_idx_to_prompt=lambda _: "<|image|>",
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        distributed_executor_backend="mp",
671
        image_size_factors=[(0.25, 0.5, 1.0)],
672
673
674
675
676
        hf_model_kwargs={"device_map": "auto"},
        max_model_len=8192,
        max_num_seqs=4,
        dtype="bfloat16",
        auto_cls=AutoModelForImageTextToText,
677
678
        tensor_parallel_size=4,
        marks=multi_gpu_marks(num_gpus=4),
679
    ),
680
681
682
683
684
    "llava_next": VLMTestInfo(
        models=["llava-hf/llava-v1.6-mistral-7b-hf"],
        test_type=(VLMTestType.IMAGE, VLMTestType.CUSTOM_INPUTS),
        prompt_formatter=lambda img_prompt: f"[INST] {img_prompt} [/INST]",
        max_model_len=10240,
685
        auto_cls=AutoModelForImageTextToText,
686
        vllm_output_post_proc=model_utils.llava_image_vllm_to_hf_output,
687
688
689
690
691
692
693
694
        custom_test_opts=[
            CustomTestOptions(
                inputs=custom_inputs.multi_image_multi_aspect_ratio_inputs(
                    formatter=lambda img_prompt: f"[INST] {img_prompt} [/INST]"
                ),
                limit_mm_per_prompt={"image": 4},
            )
        ],
695
    ),
696
    "llava_onevision": VLMTestInfo(
697
698
        models=["llava-hf/llava-onevision-qwen2-0.5b-ov-hf"],
        test_type=VLMTestType.CUSTOM_INPUTS,
699
        prompt_formatter=lambda vid_prompt: f"<|im_start|>user\n{vid_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
700
701
        num_video_frames=16,
        max_model_len=16384,
702
703
        hf_model_kwargs=model_utils.llava_onevision_hf_model_kwargs(
            "llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
704
        ),
705
        auto_cls=AutoModelForImageTextToText,
706
        vllm_output_post_proc=model_utils.llava_onevision_vllm_to_hf_output,
707
708
709
710
711
712
713
714
        custom_test_opts=[
            CustomTestOptions(
                inputs=custom_inputs.multi_video_multi_aspect_ratio_inputs(
                    formatter=lambda vid_prompt: f"<|im_start|>user\n{vid_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
                ),
                limit_mm_per_prompt={"video": 4},
            )
        ],
715
716
717
718
719
720
721
    ),
    "llava_next_video": VLMTestInfo(
        models=["llava-hf/LLaVA-NeXT-Video-7B-hf"],
        test_type=VLMTestType.VIDEO,
        prompt_formatter=lambda vid_prompt: f"USER: {vid_prompt} ASSISTANT:",
        num_video_frames=16,
        max_model_len=4096,
722
        max_num_seqs=2,
723
        auto_cls=AutoModelForImageTextToText,
724
725
        vllm_output_post_proc=model_utils.llava_video_vllm_to_hf_output,
    ),
726
727
728
729
730
731
    "mantis": VLMTestInfo(
        models=["TIGER-Lab/Mantis-8B-siglip-llama3"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=lambda img_prompt: f"<|start_header_id|>user<|end_header_id|>\n\n{img_prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",  # noqa: E501
        max_model_len=4096,
        get_stop_token_ids=lambda tok: [128009],
732
        auto_cls=AutoModelForImageTextToText,
733
734
735
        vllm_output_post_proc=model_utils.mantis_vllm_to_hf_output,
        patch_hf_runner=model_utils.mantis_patch_hf_runner,
    ),
736
    "minicpmv_25": VLMTestInfo(
737
        models=["openbmb/MiniCPM-Llama3-V-2_5"],
738
        test_type=VLMTestType.IMAGE,
739
740
741
742
743
        prompt_formatter=lambda img_prompt: f"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n{img_prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",  # noqa: E501
        img_idx_to_prompt=lambda idx: "(<image>./</image>)\n",
        max_model_len=4096,
        max_num_seqs=2,
        get_stop_token_ids=lambda tok: [tok.eos_id, tok.eot_id],
744
        hf_output_post_proc=model_utils.minicpmv_trunc_hf_output,
745
        patch_hf_runner=model_utils.minicpmv_25_patch_hf_runner,
746
747
        # FIXME: https://huggingface.co/openbmb/MiniCPM-V-2_6/discussions/55
        marks=[pytest.mark.skip("HF import fails")],
748
    ),
749
750
    "minicpmo_26": VLMTestInfo(
        models=["openbmb/MiniCPM-o-2_6"],
751
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
752
753
754
755
        prompt_formatter=lambda img_prompt: f"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n{img_prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",  # noqa: E501
        img_idx_to_prompt=lambda idx: "(<image>./</image>)\n",
        max_model_len=4096,
        max_num_seqs=2,
756
757
        get_stop_token_ids=lambda tok: tok.convert_tokens_to_ids(
            ["<|im_end|>", "<|endoftext|>"]
758
        ),
759
760
        hf_output_post_proc=model_utils.minicpmv_trunc_hf_output,
        patch_hf_runner=model_utils.minicpmo_26_patch_hf_runner,
761
        # FIXME: https://huggingface.co/openbmb/MiniCPM-o-2_6/discussions/49
762
        marks=[pytest.mark.skip("HF import fails")],
763
    ),
764
765
    "minicpmv_26": VLMTestInfo(
        models=["openbmb/MiniCPM-V-2_6"],
766
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
767
768
769
770
        prompt_formatter=lambda img_prompt: f"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n{img_prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",  # noqa: E501
        img_idx_to_prompt=lambda idx: "(<image>./</image>)\n",
        max_model_len=4096,
        max_num_seqs=2,
771
772
        get_stop_token_ids=lambda tok: tok.convert_tokens_to_ids(
            ["<|im_end|>", "<|endoftext|>"]
773
        ),
774
775
776
        hf_output_post_proc=model_utils.minicpmv_trunc_hf_output,
        patch_hf_runner=model_utils.minicpmv_26_patch_hf_runner,
    ),
777
778
    "minimax_vl_01": VLMTestInfo(
        models=["MiniMaxAI/MiniMax-VL-01"],
779
        prompt_formatter=lambda img_prompt: f"<beginning_of_sentence>user: {img_prompt} assistant:<end_of_sentence>",  # noqa: E501
780
781
782
783
784
785
786
787
        img_idx_to_prompt=lambda _: "<image>",
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        max_model_len=8192,
        max_num_seqs=4,
        dtype="bfloat16",
        hf_output_post_proc=model_utils.minimax_vl_01_hf_output,
        patch_hf_runner=model_utils.minimax_vl_01_patch_hf_runner,
        auto_cls=AutoModelForImageTextToText,
788
789
790
791
792
793
794
795
796
797
798
        marks=[
            large_gpu_mark(min_gb=80),
            # TODO: [ROCm] Fix pickle issue with ROCm spawn and tp>1
            pytest.mark.skipif(
                current_platform.is_rocm(),
                reason=(
                    "ROCm: Model too large for single GPU; "
                    "multi-GPU blocked by HF _LazyConfigMapping pickle issue with spawn"
                ),
            ),
        ],
799
    ),
800
801
    "molmo": VLMTestInfo(
        models=["allenai/Molmo-7B-D-0924"],
802
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
803
        prompt_formatter=identity,
804
805
        max_model_len=4096,
        max_num_seqs=2,
806
        patch_hf_runner=model_utils.molmo_patch_hf_runner,
807
    ),
808
809
810
    "ovis1_6-gemma2": VLMTestInfo(
        models=["AIDC-AI/Ovis1.6-Gemma2-9B"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
811
        prompt_formatter=lambda img_prompt: f"<bos><start_of_turn>user\n{img_prompt}<end_of_turn>\n<start_of_turn>model\n",  # noqa: E501
812
        img_idx_to_prompt=lambda idx: "<image>\n",
813
814
815
816
817
818
819
820
        max_model_len=4096,
        max_num_seqs=2,
        dtype="half",
        # use sdpa mode for hf runner since ovis2 didn't work with flash_attn
        hf_model_kwargs={"llm_attn_implementation": "sdpa"},
        patch_hf_runner=model_utils.ovis_patch_hf_runner,
        marks=[large_gpu_mark(min_gb=32)],
    ),
821
822
823
    "ovis2": VLMTestInfo(
        models=["AIDC-AI/Ovis2-1B"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
824
        prompt_formatter=lambda img_prompt: f"<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
825
        img_idx_to_prompt=lambda idx: "<image>\n",
826
827
828
829
830
        max_model_len=4096,
        max_num_seqs=2,
        dtype="half",
        # use sdpa mode for hf runner since ovis2 didn't work with flash_attn
        hf_model_kwargs={"llm_attn_implementation": "sdpa"},
831
        patch_hf_runner=model_utils.ovis_patch_hf_runner,
832
    ),
833
834
    "ovis2_5": VLMTestInfo(
        models=["AIDC-AI/Ovis2.5-2B"],
835
836
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE, VLMTestType.VIDEO),
        prompt_formatter=lambda img_prompt: f"<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
837
        img_idx_to_prompt=lambda idx: "<image>\n",
838
839
840
841
842
843
        video_idx_to_prompt=lambda idx: "<video>\n",
        max_model_len=4096,
        max_num_seqs=2,
        dtype="half",
        num_logprobs=10,
        patch_hf_runner=model_utils.ovis2_5_patch_hf_runner,
844
        hf_model_kwargs={"revision": "refs/pr/5"},
845
    ),
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
    "paddleocr_vl": VLMTestInfo(
        models=["PaddlePaddle/PaddleOCR-VL"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=lambda img_prompt: f"USER: {img_prompt}\nASSISTANT:",
        img_idx_to_prompt=lambda idx: (
            "<|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>"
        ),
        multi_image_prompt=(
            "Image-1: <|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>\n"
            "Image-2: <|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>\n"
            "Describe these two images separately."
        ),
        max_model_len=8192,
        max_num_seqs=2,
        auto_cls=AutoModelForCausalLM,
861
        patch_hf_runner=model_utils.paddleocr_vl_patch_hf_runner,
862
        image_size_factors=[(0.25,)],
863
864
865
866
        marks=[
            pytest.mark.skipif(
                Version(TRANSFORMERS_VERSION) == Version("4.57.3"),
                reason="This model is broken in Transformers v4.57.3",
867
868
869
870
871
872
            ),
            pytest.mark.skipif(
                Version(TRANSFORMERS_VERSION) >= Version("5.0.0"),
                reason="Model's custom code uses ROPE_INIT_FUNCTIONS"
                "['default'] which was removed in transformers v5",
            ),
873
        ],
874
    ),
875
876
877
    "phi3v": VLMTestInfo(
        models=["microsoft/Phi-3.5-vision-instruct"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
878
        prompt_formatter=lambda img_prompt: f"<|user|>\n{img_prompt}<|end|>\n<|assistant|>\n",  # noqa: E501
879
880
881
        img_idx_to_prompt=lambda idx: f"<|image_{idx}|>\n",
        max_model_len=4096,
        max_num_seqs=2,
882
        runner="generate",
883
884
        # use sdpa mode for hf runner since phi3v didn't work with flash_attn
        hf_model_kwargs={"_attn_implementation": "sdpa"},
885
886
887
888
        use_tokenizer_eos=True,
        vllm_output_post_proc=model_utils.phi3v_vllm_to_hf_output,
        num_logprobs=10,
    ),
889
890
891
892
893
894
895
    "pixtral_hf": VLMTestInfo(
        models=["nm-testing/pixtral-12b-FP8-dynamic"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=lambda img_prompt: f"<s>[INST]{img_prompt}[/INST]",
        img_idx_to_prompt=lambda idx: "[IMG]",
        max_model_len=8192,
        max_num_seqs=2,
896
        auto_cls=AutoModelForImageTextToText,
897
898
899
900
901
902
903
        marks=[
            large_gpu_mark(min_gb=48),
            pytest.mark.skipif(
                current_platform.is_rocm(),
                reason="Model produces a vector of <UNK> output in HF on ROCm",
            ),
        ],
904
    ),
905
    "qwen_vl": VLMTestInfo(
906
907
908
909
910
911
912
913
914
        models=["Qwen/Qwen-VL"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=identity,
        img_idx_to_prompt=lambda idx: f"Picture {idx}: <img></img>\n",
        max_model_len=1024,
        max_num_seqs=2,
        vllm_output_post_proc=model_utils.qwen_vllm_to_hf_output,
        prompt_path_encoder=model_utils.qwen_prompt_path_encoder,
    ),
915
916
    "qwen2_vl": VLMTestInfo(
        models=["Qwen/Qwen2-VL-2B-Instruct"],
917
918
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE, VLMTestType.VIDEO),
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
919
920
        img_idx_to_prompt=lambda idx: "<|vision_start|><|image_pad|><|vision_end|>",
        video_idx_to_prompt=lambda idx: "<|vision_start|><|video_pad|><|vision_end|>",
921
        multi_image_prompt="Picture 1: <vlm_image>\nPicture 2: <vlm_image>\nDescribe these two images with one paragraph respectively.",  # noqa: E501
922
923
        max_model_len=4096,
        max_num_seqs=2,
924
        auto_cls=AutoModelForImageTextToText,
925
        vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
926
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
927
928
        marks=[pytest.mark.cpu_model],
    ),
929
930
931
    "skywork_r1v": VLMTestInfo(
        models=["Skywork/Skywork-R1V-38B"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
932
933
934
        prompt_formatter=lambda img_prompt: f"<|begin▁of▁sentence|><|User|>\n{img_prompt}<|Assistant|><think>\n",  # noqa: E501
        single_image_prompts=IMAGE_ASSETS.prompts(
            {
935
                "stop_sign": "<image>\nWhat's the content in the center of the image?",
936
937
938
                "cherry_blossom": "<image>\nWhat is the season?",
            }
        ),
939
        multi_image_prompt="<image>\n<image>\nDescribe the two images in short.",
940
941
942
943
944
        max_model_len=4096,
        use_tokenizer_eos=True,
        patch_hf_runner=model_utils.skyworkr1v_patch_hf_runner,
        marks=[large_gpu_mark(min_gb=80)],
    ),
945
946
947
    "smolvlm": VLMTestInfo(
        models=["HuggingFaceTB/SmolVLM2-2.2B-Instruct"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
948
        prompt_formatter=lambda img_prompt: f"<|im_start|>User:{img_prompt}<end_of_utterance>\nAssistant:",  # noqa: E501
949
950
951
952
953
        img_idx_to_prompt=lambda idx: "<image>",
        max_model_len=8192,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        hf_output_post_proc=model_utils.smolvlm_trunc_hf_output,
954
        num_logprobs=10,
955
    ),
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
    "tarsier": VLMTestInfo(
        models=["omni-research/Tarsier-7b"],
        test_type=(VLMTestType.IMAGE, VLMTestType.MULTI_IMAGE),
        prompt_formatter=lambda img_prompt: f"USER: {img_prompt} ASSISTANT:",
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
        patch_hf_runner=model_utils.tarsier_patch_hf_runner,
    ),
    "tarsier2": VLMTestInfo(
        models=["omni-research/Tarsier2-Recap-7b"],
        test_type=(
            VLMTestType.IMAGE,
            VLMTestType.MULTI_IMAGE,
            VLMTestType.VIDEO,
        ),
972
        prompt_formatter=lambda img_prompt: f"<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{img_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
973
974
        img_idx_to_prompt=lambda idx: "<|vision_start|><|image_pad|><|vision_end|>",
        video_idx_to_prompt=lambda idx: "<|vision_start|><|video_pad|><|vision_end|>",
975
976
977
        max_model_len=4096,
        max_num_seqs=2,
        auto_cls=AutoModelForImageTextToText,
978
        image_size_factors=[(0.25,), (0.25, 0.25, 0.25), (0.25, 0.2, 0.15)],
979
980
        marks=[pytest.mark.skip("Model initialization hangs")],
    ),
981
    ### Tensor parallel / multi-gpu broadcast tests
982
    "chameleon-broadcast": VLMTestInfo(
983
984
985
        models=["facebook/chameleon-7b"],
        prompt_formatter=lambda img_prompt: f"USER: {img_prompt}\nASSISTANT:",
        max_model_len=4096,
986
        auto_cls=AutoModelForImageTextToText,
987
988
        vllm_output_post_proc=lambda vllm_output, model: vllm_output[:2],
        hf_output_post_proc=lambda hf_output, model: hf_output[:2],
989
        comparator=check_outputs_equal,
990
        marks=multi_gpu_marks(num_gpus=2),
991
        **COMMON_BROADCAST_SETTINGS,  # type: ignore
992
    ),
993
    "llava-broadcast": VLMTestInfo(
994
995
996
        models=["llava-hf/llava-1.5-7b-hf"],
        prompt_formatter=lambda img_prompt: f"USER: {img_prompt}\nASSISTANT:",
        max_model_len=4096,
997
        auto_cls=AutoModelForImageTextToText,
998
        vllm_output_post_proc=model_utils.llava_image_vllm_to_hf_output,
999
        marks=multi_gpu_marks(num_gpus=2),
1000
        **COMMON_BROADCAST_SETTINGS,  # type: ignore
1001
    ),
1002
    "llava_next-broadcast": VLMTestInfo(
1003
1004
1005
        models=["llava-hf/llava-v1.6-mistral-7b-hf"],
        prompt_formatter=lambda img_prompt: f"[INST] {img_prompt} [/INST]",
        max_model_len=10240,
1006
        auto_cls=AutoModelForImageTextToText,
1007
        vllm_output_post_proc=model_utils.llava_image_vllm_to_hf_output,
1008
        marks=multi_gpu_marks(num_gpus=2),
1009
        **COMMON_BROADCAST_SETTINGS,  # type: ignore
1010
1011
1012
1013
    ),
    ### Custom input edge-cases for specific models
    "intern_vl-diff-patches": VLMTestInfo(
        models=["OpenGVLab/InternVL2-2B"],
1014
        prompt_formatter=lambda img_prompt: f"<|im_start|>User\n{img_prompt}<|im_end|>\n<|im_start|>Assistant\n",  # noqa: E501
1015
1016
1017
1018
1019
1020
1021
1022
        test_type=VLMTestType.CUSTOM_INPUTS,
        max_model_len=4096,
        use_tokenizer_eos=True,
        patch_hf_runner=model_utils.internvl_patch_hf_runner,
        custom_test_opts=[
            CustomTestOptions(
                inputs=inp,
                limit_mm_per_prompt={"image": 2},
1023
1024
            )
            for inp in custom_inputs.different_patch_input_cases_internvl()
1025
        ],
1026
1027
1028
1029
1030
1031
        # TODO: Remove skip once model has been upstreamed to Transformers
        marks=[
            pytest.mark.skip(
                reason="Custom model code tries to access data from meta-tensor"
            )
        ],
1032
    ),
1033
    "llava_onevision-multiple-images": VLMTestInfo(
1034
1035
1036
1037
        models=["llava-hf/llava-onevision-qwen2-0.5b-ov-hf"],
        test_type=VLMTestType.CUSTOM_INPUTS,
        max_model_len=16384,
        max_num_seqs=2,
1038
        auto_cls=AutoModelForImageTextToText,
1039
1040
        hf_model_kwargs=model_utils.llava_onevision_hf_model_kwargs(
            "llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
1041
        ),
1042
        vllm_output_post_proc=model_utils.llava_onevision_vllm_to_hf_output,
1043
1044
1045
1046
1047
1048
1049
1050
        custom_test_opts=[
            CustomTestOptions(
                inputs=custom_inputs.multi_image_multi_aspect_ratio_inputs(
                    formatter=lambda vid_prompt: f"<|im_start|>user\n{vid_prompt}<|im_end|>\n<|im_start|>assistant\n",  # noqa: E501
                ),
                limit_mm_per_prompt={"image": 4},
            )
        ],
1051
    ),
1052
1053
1054
1055
1056
1057
    # regression test for https://github.com/vllm-project/vllm/issues/15122
    "qwen2_5_vl-windows-attention": VLMTestInfo(
        models=["Qwen/Qwen2.5-VL-3B-Instruct"],
        test_type=VLMTestType.CUSTOM_INPUTS,
        max_model_len=4096,
        max_num_seqs=2,
1058
        auto_cls=AutoModelForImageTextToText,
1059
        vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,
1060
1061
1062
1063
1064
1065
        custom_test_opts=[
            CustomTestOptions(
                inputs=custom_inputs.windows_attention_image_qwen2_5_vl(),
                limit_mm_per_prompt={"image": 1},
            )
        ],
1066
    ),
1067
1068
1069
}


1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
def _mark_splits(
    test_settings: dict[str, VLMTestInfo],
    *,
    num_groups: int,
) -> dict[str, VLMTestInfo]:
    name_by_test_info_id = {id(v): k for k, v in test_settings.items()}
    test_infos_by_model = defaultdict[str, list[VLMTestInfo]](list)

    for info in test_settings.values():
        for model in info.models:
            test_infos_by_model[model].append(info)

    models = sorted(test_infos_by_model.keys())
    split_size = math.ceil(len(models) / num_groups)

    new_test_settings = dict[str, VLMTestInfo]()

    for i in range(num_groups):
1088
        models_in_group = models[i * split_size : (i + 1) * split_size]
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104

        for model in models_in_group:
            for info in test_infos_by_model[model]:
                new_marks = (info.marks or []) + [pytest.mark.split(group=i)]
                new_info = info._replace(marks=new_marks)
                new_test_settings[name_by_test_info_id[id(info)]] = new_info

    missing_keys = test_settings.keys() - new_test_settings.keys()
    assert not missing_keys, f"Missing keys: {missing_keys}"

    return new_test_settings


VLM_TEST_SETTINGS = _mark_splits(VLM_TEST_SETTINGS, num_groups=2)


1105
1106
1107
1108
1109
1110
### Test wrappers
# Wrappers around the core test running func for:
# - single image
# - multi-image
# - image embeddings
# - video
1111
# - audio
1112
# - custom inputs
1113
1114
1115
1116
1117
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.IMAGE,
1118
        create_new_process_for_each_test=False,
1119
1120
    ),
)
1121
1122
1123
1124
1125
1126
1127
1128
def test_single_image_models(
    tmp_path: PosixPath,
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    image_assets: ImageTestAssets,
):
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_single_image_test(
        tmp_path=tmp_path,
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        image_assets=image_assets,
    )


1140
1141
1142
1143
1144
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.MULTI_IMAGE,
1145
        create_new_process_for_each_test=False,
1146
1147
    ),
)
1148
1149
1150
1151
1152
1153
1154
1155
def test_multi_image_models(
    tmp_path: PosixPath,
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    image_assets: ImageTestAssets,
):
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_multi_image_test(
        tmp_path=tmp_path,
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        image_assets=image_assets,
    )


1167
1168
1169
1170
1171
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.EMBEDDING,
1172
        create_new_process_for_each_test=False,
1173
1174
    ),
)
1175
1176
1177
1178
1179
1180
1181
def test_image_embedding_models(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    image_assets: ImageTestAssets,
):
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_embedding_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        image_assets=image_assets,
    )


1192
1193
1194
1195
1196
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.VIDEO,
1197
        create_new_process_for_each_test=False,
1198
1199
    ),
)
1200
1201
1202
1203
1204
1205
1206
def test_video_models(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    video_assets: VideoTestAssets,
):
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_video_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        video_assets=video_assets,
    )


1217
1218
1219
1220
1221
1222
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.AUDIO,
        create_new_process_for_each_test=False,
1223
1224
    ),
)
1225
1226
1227
1228
1229
1230
1231
def test_audio_models(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    audio_assets: AudioTestAssets,
):
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_audio_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        audio_assets=audio_assets,
    )


1242
1243
1244
1245
1246
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.CUSTOM_INPUTS,
1247
        create_new_process_for_each_test=False,
1248
1249
    ),
)
1250
1251
1252
def test_custom_inputs_models(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
1253
1254
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
):
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_custom_inputs_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
    )


#### Tests filtering for things running each test as a new process
1266
1267
1268
1269
1270
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.IMAGE,
1271
        create_new_process_for_each_test=True,
1272
1273
    ),
)
1274
@create_new_process_for_each_test()
1275
1276
1277
1278
1279
1280
1281
1282
def test_single_image_models_heavy(
    tmp_path: PosixPath,
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    image_assets: ImageTestAssets,
):
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_single_image_test(
        tmp_path=tmp_path,
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        image_assets=image_assets,
    )


1294
1295
1296
1297
1298
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.MULTI_IMAGE,
1299
        create_new_process_for_each_test=True,
1300
1301
    ),
)
1302
@create_new_process_for_each_test()
1303
1304
1305
1306
1307
1308
1309
1310
def test_multi_image_models_heavy(
    tmp_path: PosixPath,
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    image_assets: ImageTestAssets,
):
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_multi_image_test(
        tmp_path=tmp_path,
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        image_assets=image_assets,
    )


1322
1323
1324
1325
1326
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.EMBEDDING,
1327
        create_new_process_for_each_test=True,
1328
1329
    ),
)
1330
@create_new_process_for_each_test()
1331
1332
1333
1334
1335
1336
1337
def test_image_embedding_models_heavy(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    image_assets: ImageTestAssets,
):
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_embedding_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        image_assets=image_assets,
    )


1348
1349
1350
1351
1352
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.VIDEO,
1353
        create_new_process_for_each_test=True,
1354
1355
    ),
)
1356
1357
1358
1359
1360
1361
1362
def test_video_models_heavy(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    video_assets: VideoTestAssets,
):
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_video_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        video_assets=video_assets,
    )


1373
1374
1375
1376
1377
1378
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.AUDIO,
        create_new_process_for_each_test=True,
1379
1380
    ),
)
1381
1382
1383
1384
1385
1386
1387
def test_audio_models_heavy(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
    audio_assets: AudioTestAssets,
):
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_audio_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
        audio_assets=audio_assets,
    )


1398
1399
1400
1401
1402
@pytest.mark.parametrize(
    "model_type,test_case",
    get_parametrized_options(
        VLM_TEST_SETTINGS,
        test_type=VLMTestType.CUSTOM_INPUTS,
1403
        create_new_process_for_each_test=True,
1404
1405
    ),
)
1406
@create_new_process_for_each_test()
1407
1408
1409
def test_custom_inputs_models_heavy(
    model_type: str,
    test_case: ExpandableVLMTestArgs,
1410
1411
    hf_runner: type[HfRunner],
    vllm_runner: type[VllmRunner],
1412
1413
1414
1415
1416
1417
1418
1419
):
    model_test_info = VLM_TEST_SETTINGS[model_type]
    runners.run_custom_inputs_test(
        model_test_info=model_test_info,
        test_case=test_case,
        hf_runner=hf_runner,
        vllm_runner=vllm_runner,
    )