[Bugfix] Count unsplit Idefics3 image patches (#48760)

Signed-off-by: nightcityblade <nightcityblade@gmail.com> Co-authored-by: nightcityblade <nightcityblade@gmail.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>

nightcityblade committed Sep 25, 2026 at 02:36 UTC 5b3f280a6df68c4f8264014380249ba530173ed6
2 files changed +10 -1
tests/models/multimodal/processing/test_smolvlm.py
+9
@@ -17,6 +17,7 @@ from ...utils import build_model_context
17 [
18 ({"max_image_size": {"longest_edge": 384}}, 1377),
19 ({"max_image_size": {"longest_edge": 768}}, 405),
20 + ({"do_image_splitting": False}, 81),
21 ],
22 )
23 @pytest.mark.parametrize("num_imgs", [1, 2])
@@ -63,6 +64,14 @@ def test_processor_override(
64
65 # Ensure the placeholders format are correct
66 hf_processor = processor.info.get_hf_processor(**hf_processor_mm_kwargs)
67 + num_patches = processor.info.get_num_patches(
68 + image_width=dummy_image.width,
69 + image_height=dummy_image.height,
70 + processor=hf_processor,
71 + mm_kwargs=hf_processor_mm_kwargs,
72 + )
73 + assert num_patches == expected_toks_per_img // hf_processor.image_seq_len
74 +
75 hf_processed_inputs = hf_processor(
76 text=prompt,
77 images=mm_data["image"],
vllm/model_executor/models/idefics3.py
+1 -1
@@ -137,7 +137,7 @@ class Idefics3ProcessingInfo(BaseProcessingInfo):
137 mm_kwargs=mm_kwargs,
138 )
139
140 - return num_patches
140 + return max(num_patches, 1)
141
142 def _get_image_token(self, processor: Idefics3Processor) -> tuple[str, str, str]:
143 image_token = processor.image_token