From 049c245143ef0f8fd338fc3200f51a18fc53b403 Mon Sep 17 00:00:00 2001 From: Isotr0py Date: Sun, 10 Aug 2025 21:18:21 +0800 Subject: [PATCH] [Misc] Replace flaky image urls in pixtral test (#22574) Signed-off-by: Isotr0py Signed-off-by: Isotr0py <2037008807@qq.com> --- .../multimodal/generation/test_pixtral.py | 24 +++++++++---------- tests/models/utils.py | 3 ++- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/models/multimodal/generation/test_pixtral.py b/tests/models/multimodal/generation/test_pixtral.py index e157d6f4a79df..d39cf706786e2 100644 --- a/tests/models/multimodal/generation/test_pixtral.py +++ b/tests/models/multimodal/generation/test_pixtral.py @@ -18,7 +18,7 @@ from vllm.multimodal.inputs import PlaceholderRange from vllm.sequence import Logprob, SampleLogprobs from ....utils import VLLM_PATH, large_gpu_test -from ...utils import check_logprobs_close +from ...utils import check_logprobs_close, dummy_hf_overrides if TYPE_CHECKING: from _typeshed import StrPath @@ -29,10 +29,10 @@ MISTRAL_SMALL_3_1_ID = "mistralai/Mistral-Small-3.1-24B-Instruct-2503" MODELS = [PIXTRAL_ID, MISTRAL_SMALL_3_1_ID] IMG_URLS = [ - "https://picsum.photos/id/237/400/300", - "https://picsum.photos/id/231/200/300", - "https://picsum.photos/id/27/500/500", - "https://picsum.photos/id/17/150/600", + "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/237-400x300.jpg", + "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/231-200x300.jpg", + "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/27-500x500.jpg", + "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/17-150x600.jpg", ] PROMPT = "Describe each image in one short sentence." @@ -110,11 +110,6 @@ MSGS = [ _create_msg_format(IMG_URLS[:2]), _create_msg_format(IMG_URLS), ] -ENGINE_INPUTS = [ - _create_engine_inputs(IMG_URLS[:1]), - _create_engine_inputs(IMG_URLS[:2]), - _create_engine_inputs(IMG_URLS), -] SAMPLING_PARAMS = SamplingParams(max_tokens=512, temperature=0.0, logprobs=5) LIMIT_MM_PER_PROMPT = dict(image=4) @@ -195,7 +190,6 @@ def test_chat( name_1="output") -@large_gpu_test(min_gb=48) @pytest.mark.parametrize("prompt,expected_ranges", [(_create_engine_inputs_hf(IMG_URLS[:1]), [PlaceholderRange(offset=11, length=494)]), @@ -204,7 +198,7 @@ def test_chat( PlaceholderRange(offset=277, length=1056), PlaceholderRange(offset=1333, length=418) ])]) -def test_multi_modal_placeholders(vllm_runner, prompt, +def test_multi_modal_placeholders(vllm_runner, prompt: TextPrompt, expected_ranges: list[PlaceholderRange], monkeypatch) -> None: @@ -215,6 +209,8 @@ def test_multi_modal_placeholders(vllm_runner, prompt, "mistral-community/pixtral-12b", max_model_len=8192, limit_mm_per_prompt=LIMIT_MM_PER_PROMPT, + load_format="dummy", + hf_overrides=dummy_hf_overrides, ) as vllm_model: outputs = vllm_model.llm.generate(prompt) @@ -230,5 +226,7 @@ def test_multi_modal_placeholders(vllm_runner, prompt, expected_ranges), f"{image_placeholder_ranges=}" for real_range, expected_range in zip(image_placeholder_ranges, expected_ranges): - assert real_range == expected_range, \ + assert real_range.offset == expected_range.offset, \ + f"{real_range=} {expected_range=}" + assert real_range.length == expected_range.length, \ f"{real_range=} {expected_range=}" diff --git a/tests/models/utils.py b/tests/models/utils.py index 1e3d51aeec64e..11ddf45c8e542 100644 --- a/tests/models/utils.py +++ b/tests/models/utils.py @@ -357,7 +357,8 @@ class RerankModelInfo(NamedTuple): def dummy_hf_overrides( hf_config: PretrainedConfig, - model_arch: str, + *, + model_arch: str = "", exist_overrides: Optional[dict[str, Any]] = None, ) -> PretrainedConfig: """