PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

CPU推理报错:Exception from the 'vlm' worker

Open minmie opened this issue 2 months ago • 4 comments

🔎 Search before asking

  • [x] I have searched the PaddleOCR Docs and found no similar bug report.
  • [x] I have searched the PaddleOCR Issues and found no similar bug report.
  • [x] I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

装的GPU版本的paddle,但是推理的时候device指定CPU就报错,指定GPU就正常。 期望:通过device参数指定cpu,可以正常运行

import os
from paddleocr import PaddleOCRVL

# pipeline = PaddleOCRVL(vl_rec_backend="vllm-server", vl_rec_server_url="http://127.0.0.1:8080/v1")
pipeline = PaddleOCRVL(
    device='CPU',
    layout_detection_model_dir='/home/chenjq/pythonWork/paddleocr-vl/official_models/PP-DocLayoutV2',
    vl_rec_model_dir='/home/chenjq/pythonWork/paddleocr-vl/official_models/PaddleOCR-VL')
output = pipeline.predict("1.png")
for res in output:
    res.print()
    res.save_to_json(save_path="output1")
    res.save_to_markdown(save_path="output1")

错误日志

Traceback (most recent call last):
  File "/home/chenjq/pythonWork/paddleocr-vl/main.py", line 12, in <module>
    output = pipeline.predict("1.png")
  File "/home/chenjq/miniconda3/envs/paddle-vl/lib/python3.10/site-packages/paddleocr/_pipelines/paddleocr_vl.py", line 134, in predict
    return list(
  File "/home/chenjq/miniconda3/envs/paddle-vl/lib/python3.10/site-packages/paddlex/inference/pipelines/_parallel.py", line 129, in predict
    yield from self._pipeline.predict(
  File "/home/chenjq/miniconda3/envs/paddle-vl/lib/python3.10/site-packages/paddlex/inference/pipelines/paddleocr_vl/pipeline.py", line 656, in predict
    raise RuntimeError(
RuntimeError: Exception from the 'vlm' worker: (NotFound) The kernel with key (CPU, Undefined(AnyLayout), bfloat16) of kernel `conv2d` is not registered. Selected wrong DataType `bfloat16`. Paddle support following DataTypes: float64, float32.
  [Hint: Expected kernel_iter == iter->second.end() && kernel_key.backend() == Backend::CPU != true, but received kernel_iter == iter->second.end() && kernel_key.backend() == Backend::CPU:1 == true:1.] (at /paddle/paddle/phi/core/kernel_factory.cc:317)

🏃‍♂️ Environment (运行环境)

python 3.10.19 paddleocr 3.3.0 paddlepaddle-gpu 3.2.0 paddlex 3.3.4

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

见上面

minmie avatar Oct 27 '25 03:10 minmie

CPU正在适配中,预计本周内可以完成支持。

Bobholamovic avatar Oct 27 '25 04:10 Bobholamovic

Hi @Bobholamovic , any updates for the CPU adaptations?

ownia avatar Nov 06 '25 09:11 ownia

Hi @Bobholamovic , any updates for the CPU adaptations?

x86-64 CPUs are supported now. Please check the latest documentation for reference.

Bobholamovic avatar Nov 06 '25 09:11 Bobholamovic

@Bobholamovic Thanks. Will support for arm64 CPU be added in future updates?

ownia avatar Nov 06 '25 11:11 ownia