[Misc] Replace flaky image urls in pixtral test (#22574)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
Isotr0py 2025-08-10 21:18:21 +08:00 committed by GitHub
parent 00976db0c3
commit 049c245143
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 14 deletions

View File

@ -18,7 +18,7 @@ from vllm.multimodal.inputs import PlaceholderRange
from vllm.sequence import Logprob, SampleLogprobs from vllm.sequence import Logprob, SampleLogprobs
from ....utils import VLLM_PATH, large_gpu_test 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: if TYPE_CHECKING:
from _typeshed import StrPath 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] MODELS = [PIXTRAL_ID, MISTRAL_SMALL_3_1_ID]
IMG_URLS = [ IMG_URLS = [
"https://picsum.photos/id/237/400/300", "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/237-400x300.jpg",
"https://picsum.photos/id/231/200/300", "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/231-200x300.jpg",
"https://picsum.photos/id/27/500/500", "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/27-500x500.jpg",
"https://picsum.photos/id/17/150/600", "https://huggingface.co/datasets/Isotr0py/mistral-test-images/resolve/main/17-150x600.jpg",
] ]
PROMPT = "Describe each image in one short sentence." PROMPT = "Describe each image in one short sentence."
@ -110,11 +110,6 @@ MSGS = [
_create_msg_format(IMG_URLS[:2]), _create_msg_format(IMG_URLS[:2]),
_create_msg_format(IMG_URLS), _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) SAMPLING_PARAMS = SamplingParams(max_tokens=512, temperature=0.0, logprobs=5)
LIMIT_MM_PER_PROMPT = dict(image=4) LIMIT_MM_PER_PROMPT = dict(image=4)
@ -195,7 +190,6 @@ def test_chat(
name_1="output") name_1="output")
@large_gpu_test(min_gb=48)
@pytest.mark.parametrize("prompt,expected_ranges", @pytest.mark.parametrize("prompt,expected_ranges",
[(_create_engine_inputs_hf(IMG_URLS[:1]), [(_create_engine_inputs_hf(IMG_URLS[:1]),
[PlaceholderRange(offset=11, length=494)]), [PlaceholderRange(offset=11, length=494)]),
@ -204,7 +198,7 @@ def test_chat(
PlaceholderRange(offset=277, length=1056), PlaceholderRange(offset=277, length=1056),
PlaceholderRange(offset=1333, length=418) 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], expected_ranges: list[PlaceholderRange],
monkeypatch) -> None: monkeypatch) -> None:
@ -215,6 +209,8 @@ def test_multi_modal_placeholders(vllm_runner, prompt,
"mistral-community/pixtral-12b", "mistral-community/pixtral-12b",
max_model_len=8192, max_model_len=8192,
limit_mm_per_prompt=LIMIT_MM_PER_PROMPT, limit_mm_per_prompt=LIMIT_MM_PER_PROMPT,
load_format="dummy",
hf_overrides=dummy_hf_overrides,
) as vllm_model: ) as vllm_model:
outputs = vllm_model.llm.generate(prompt) outputs = vllm_model.llm.generate(prompt)
@ -230,5 +226,7 @@ def test_multi_modal_placeholders(vllm_runner, prompt,
expected_ranges), f"{image_placeholder_ranges=}" expected_ranges), f"{image_placeholder_ranges=}"
for real_range, expected_range in zip(image_placeholder_ranges, for real_range, expected_range in zip(image_placeholder_ranges,
expected_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=}" f"{real_range=} {expected_range=}"

View File

@ -357,7 +357,8 @@ class RerankModelInfo(NamedTuple):
def dummy_hf_overrides( def dummy_hf_overrides(
hf_config: PretrainedConfig, hf_config: PretrainedConfig,
model_arch: str, *,
model_arch: str = "",
exist_overrides: Optional[dict[str, Any]] = None, exist_overrides: Optional[dict[str, Any]] = None,
) -> PretrainedConfig: ) -> PretrainedConfig:
""" """