@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / b6e636c12c
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 5, 18:30 UTC

[Fix] handle PaddleOCR-VL image processor max_pixels across Transformers v4/v5 (#38629)

Signed-off-by: zhangyue66 <zhangyue66@baidu.com>

zhang-prog committed Mar 31, 2026 at 23:50 UTC b6e636c12c28c9ae83e22c65b4fca64a5571483b
1 file changed +7 -1
vllm/model_executor/models/paddleocr_vl.py
+7 -1
@@ -200,7 +200,13 @@ class PaddleOCRVLProcessingInfo(BaseProcessingInfo):
200 merge_size = hf_config.vision_config.spatial_merge_size
201 patch_size = hf_config.vision_config.patch_size
202 factor = merge_size * patch_size
203 - max_num_tokens = image_processor.max_pixels // (factor**2)
203 + if self.ctx.model_config.trust_remote_code:
204 + # Defined in HF Hub repo
205 + max_pixels = image_processor.max_pixels
206 + else:
207 + # Defined in Transformers library (requires v5.0 or above)
208 + max_pixels = image_processor.size.longest_edge
209 + max_num_tokens = max_pixels // (factor**2)
210 # Find factors of max_num_tokens close to its square root
211 # to create a dummy image with a reasonable aspect ratio.
212 h_patches = int(math.sqrt(max_num_tokens))