RuntimeError: Exception from the 'vlm' worker: Unable to create tensor
#64
by
fgdfbdfbdfsd3
- opened
from paddleocr import PaddleOCRVL
pipeline = PaddleOCRVL(device="cpu")
output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png")
Creating model: ('PP-DocLayoutV2', None)
Model files already exist. Using cached files. To redownload, please delete the directory manually: `/.paddlex/official_models/PP-DocLayoutV2`.
Creating model: ('PaddleOCR-VL-0.9B', None)
Model files already exist. Using cached files. To redownload, please delete the directory manually: `/.paddlex/official_models/PaddleOCR-VL`.
Loading configuration file /.paddlex/official_models/PaddleOCR-VL/config.json
Loading weights file /.paddlex/official_models/PaddleOCR-VL/model.safetensors
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
use GQA - num_heads: 16- num_key_value_heads: 2
Loaded weights file from disk, setting weights to model.
All model checkpoint weights were used when initializing PaddleOCRVLForConditionalGeneration.
...
Currently, the PaddleOCR-VL-0.9B local model only supports batch size of 1. The batch size will be updated to 1.
Connecting to https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png ...
Downloading paddleocr_vl_demo.png ...
[==================================================] 100.00%
Error:
RuntimeError Traceback (most recent call last)
Cell In[9], line 3
1 from paddleocr import PaddleOCRVL
2 pipeline = PaddleOCRVL(device="cpu")
----> 3 output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png")
4 for res in output:
5 res.print()
File ~/.venv/lib/python3.13/site-packages/paddleocr/_pipelines/paddleocr_vl.py:134, in PaddleOCRVL.predict(self, input, use_doc_orientation_classify, use_doc_unwarping, use_layout_detection, use_chart_recognition, layout_threshold, layout_nms, layout_unclip_ratio, layout_merge_bboxes_mode, use_queues, prompt_label, format_block_content, repetition_penalty, temperature, top_p, min_pixels, max_pixels, **kwargs)
112 def predict(
113 self,
114 input,
(...) 132 **kwargs,
133 ):
--> 134 return list(
135 self.predict_iter(
136 input,
137 use_doc_orientation_classify=use_doc_orientation_classify,
138 use_doc_unwarping=use_doc_unwarping,
139 use_layout_detection=use_layout_detection,
140 use_chart_recognition=use_chart_recognition,
141 layout_threshold=layout_threshold,
142 layout_nms=layout_nms,
143 layout_unclip_ratio=layout_unclip_ratio,
...
675 )
676 else:
677 yield item[1]
RuntimeError: Exception from the 'vlm' worker: Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' 'truncation=True' to have batched tensors with the same length.
Gj
Could you please confirm the following two questions?
Is it possible to provide more details about the hardware and the versions of the Paddle-related packages being used?
Is there any issue if the image is downloaded locally before running the prediction?