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 6, 19:15 UTC
[Bugfix] fix paddleocr crash on some image shape (#36959)
Signed-off-by: wangzhengtao <wangzhengtao@msh.team> Signed-off-by: bigmoyan <moyan_work@foxmail.com> Co-authored-by: wangzhengtao <wangzhengtao@msh.team> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
bigmoyan committed
Mar 13, 2026 at 21:46 UTC
4508532fbd299cff81ecb6f1ccea2e2d0f56d329
1 file changed
+6
-1
vllm/model_executor/models/paddleocr_vl.py
+6
-1
@@ -25,6 +25,7 @@ import torch.nn as nn
25
from einops import rearrange
26
from transformers import BaseImageProcessor, BatchFeature, PretrainedConfig
27
from transformers.activations import GELUActivation
28
+from transformers.image_utils import ChannelDimension
29
from transformers.modeling_outputs import (
30
BaseModelOutputWithPooling,
31
)
@@ -249,8 +250,12 @@ class PaddleOCRVLMultiModalProcessor(
250
tok_kwargs: Mapping[str, object],
251
) -> BatchFeature:
252
if mm_data:
253
+ final_mm_kwargs = dict(mm_kwargs or {})
254
+ final_mm_kwargs.setdefault("images_kwargs", {})
255
+ # vLLM use PIL.Image, always set channel_last
256
+ final_mm_kwargs["input_data_format"] = ChannelDimension.LAST
257
processed_outputs = self.info.ctx.call_hf_processor(
253
- self.info.get_hf_processor(**mm_kwargs),
258
+ self.info.get_hf_processor(**final_mm_kwargs),
259
dict(text=prompt, **mm_data),
260
dict(**mm_kwargs, **tok_kwargs),
261
)