PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

在PP-Structure 文档分析中将SLANet替换为SLANet_plus

Open Danee-wawawa opened this issue 10 months ago • 18 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 (问题描述)

您好,最近PaddleX更新了表格识别模型SLANet_plus,我想将其替换目前PP-Structure 文档分析流程中的SLANet表格识别模型,现在只替换模型,即将https://github.com/PaddlePaddle/PaddleOCR/blob/main/deploy/hubserving/structure_table/params.py#L27修改为如下: cfg.table_model_dir = './models/SLANet_plus_infer/' SLANet_plus_infer来源于https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0rc0/SLANet_plus_infer.tar

其他未做更改,目前报了错误,错误如下: Traceback (most recent call last): File "/usr/local/bin/hub", line 8, in sys.exit(execute()) File "/usr/local/lib/python3.10/dist-packages/paddlehub/commands/utils.py", line 84, in execute status = 0 if com'_entry'.execute(sys.argv[idx:]) else 1 File "/usr/local/lib/python3.10/dist-packages/paddlehub/commands/serving.py", line 352, in execute self.start_serving() File "/usr/local/lib/python3.10/dist-packages/paddlehub/commands/serving.py", line 245, in start_serving self.start_single_app_with_args() File "/usr/local/lib/python3.10/dist-packages/paddlehub/commands/serving.py", line 221, in start_single_app_with_args self.preinstall_modules() File "/usr/local/lib/python3.10/dist-packages/paddlehub/commands/serving.py", line 152, in preinstall_modules m = hub.Module(**init_args) File "/usr/local/lib/python3.10/dist-packages/paddlehub/module/module.py", line 393, in new module = cls.init_with_name( File "/usr/local/lib/python3.10/dist-packages/paddlehub/module/module.py", line 509, in init_with_name user_module._initialize(**kwargs) File "/usr/local/lib/python3.10/dist-packages/paddlehub/compat/paddle_utils.py", line 221, in runner return func(*args, **kwargs) File "/root/.paddlehub/modules/structure_system/module.py", line 70, in _initialize self.table_sys = PPStructureSystem(cfg) File "/paddle/./ppstructure/predict_system.py", line 72, in init self.table_system = TableSystem( File "/paddle/./ppstructure/table/predict_table.py", line 73, in init self.table_structurer = predict_strture.TableStructurer(args) File "/paddle/./ppstructure/table/predict_structure.py", line 91, in init utility.create_predictor(args, 'table', logger) File "/paddle/./tools/infer/utility.py", line 280, in create_predictor predictor = inference.create_predictor(config) RuntimeError: (PreconditionNotMet) Tensor's dimension is out of bound.Tensor's dimension must be equal or less than the size of its memory.But received Tensor's dimension is 8, memory's size is 0. [Hint: Expected numel() * SizeOf(dtype()) <= memory_size(), but received numel() * SizeOf(dtype()):8 > memory_size():0.] (at ../paddle/phi/core/dense_tensor_impl.cc:46) [operator < scale > error]

🏃‍♂️ Environment (运行环境)

paddle.version.show() commit: fbf852dd832bc0e63ae31cd4aa37defd829e4c03 cuda: 12.0 cudnn: 8.9.1 xpu: False xpu_xccl: False cinn: False

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

docker run -d --restart=always -p 3000:8868 -v /PaddleOCR:/paddle --gpus "device=7" -e CUDA_VISIBLE_DEVICES=0 --name test -w /paddle -it paddle_ocr:latest hub serving start -c config.json

Danee-wawawa avatar Feb 20 '25 06:02 Danee-wawawa

可以试试更新一下paddle版本到3.0

GreatV avatar Feb 20 '25 07:02 GreatV

谢谢您的回答,我运行下面指令:

pip install paddlepaddle-gpu==3.0 ERROR: Could not find a version that satisfies the requirement paddlepaddle-gpu==3.0 (from versions: 2.3.0, 2.3.1, 2.3.2, 2.4.0rc0, 2.4.0, 2.4.1, 2.4.2, 2.5.0rc0, 2.5.0rc1, 2.5.0, 2.5.1, 2.5.2, 2.6.0, 2.6.1, 2.6.2) ERROR: No matching distribution found for paddlepaddle-gpu==3.0

应该是我的基础镜像有问题,目前基础镜像的dockerfile为:

FROM registry.baidubce.com/paddlepaddle/paddle:2.6.0-gpu-cuda12.0-cudnn8.9-trt8.6

WORKDIR /PaddleOCR

COPY . /PaddleOCR

RUN pip3.10 install --upgrade pip -i https://mirror.baidu.com/pypi/simple

RUN pip3.10 install paddlehub --upgrade -i https://mirror.baidu.com/pypi/simple

RUN pip3.10 install -r requirements.txt -i https://mirror.baidu.com/pypi/simple

EXPOSE 8868

CMD ["/bin/bash","-c","hub install deploy/hubserving/structure_system/ && hub serving start -m structure_system"]

需要如何修改呢?

Danee-wawawa avatar Feb 20 '25 07:02 Danee-wawawa

https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html 参考该文档安装PaddlePaddle3.0

UserWangZz avatar Feb 20 '25 09:02 UserWangZz

感谢您的回答,我的cuda版本是12.2,但我看3.0系列只支持cuda12.3和cuda11.8,该如何选择呢?

Danee-wawawa avatar Feb 21 '25 01:02 Danee-wawawa

cuda是向下兼容的,可以试试11.8版本的,但是这种大版本可能存在不兼容的情况,建议升级cuda

UserWangZz avatar Feb 21 '25 02:02 UserWangZz

感谢~我在运行的时候报了这个错误,麻烦帮助下~

File "/usr/local/lib/python3.10/dist-packages/google/protobuf/descriptor.py", line 914, in new _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Danee-wawawa avatar Feb 21 '25 02:02 Danee-wawawa

Downgrade the protobuf package to 3.20.x or lower. 尝试降级 protobuf包到3.20.x版本或者更低试试

UserWangZz avatar Feb 21 '25 02:02 UserWangZz

嗯嗯,protobuf版本降了,但是又遇到另一个问题,辛苦再看下~

File "/usr/local/lib/python3.10/dist-packages/paddle2onnx/convert.py", line 17, in import paddle2onnx.paddle2onnx_cpp2py_export as c_p2o ImportError: /usr/local/lib/python3.10/dist-packages/paddle2onnx/paddle2onnx_cpp2py_export.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3pir6detail14TypeIdResolverINS_14Float8E5M2TypeEE3id_E

Danee-wawawa avatar Feb 21 '25 02:02 Danee-wawawa

重装一下这个paddle2onnx试试

UserWangZz avatar Feb 21 '25 03:02 UserWangZz

重装之后,还是一样的错误~这个要怎么办哇

Danee-wawawa avatar Feb 21 '25 03:02 Danee-wawawa

直接试试paddlex呢

GreatV avatar Feb 21 '25 03:02 GreatV

您是说用paddlex的服务化部署是嘛~ https://paddlepaddle.github.io/PaddleX/latest/pipeline_deploy/serving.html

Danee-wawawa avatar Feb 21 '25 03:02 Danee-wawawa

您好,上面问题我都解决了,通过版本调整,现在又出现另一个问题,辛苦看下~

ExternalError: CUDNN error(9), CUDNN_STATUS_NOT_SUPPORTED. \n [Hint: 'CUDNN_STATUS_NOT_SUPPORTED'. The functionality requested is not presently supported by cuDNN. ] (at ../paddle/phi/kernels/fusion/gpu/fused_conv2d_add_act_kernel.cu:618)\n [operator < fused_conv2d_add_act > error]",

Danee-wawawa avatar Feb 21 '25 06:02 Danee-wawawa

嗯嗯,protobuf版本降了,但是又遇到另一个问题,辛苦再看下~

File "/usr/local/lib/python3.10/dist-packages/paddle2onnx/convert.py", line 17, in import paddle2onnx.paddle2onnx_cpp2py_export as c_p2o ImportError: /usr/local/lib/python3.10/dist-packages/paddle2onnx/paddle2onnx_cpp2py_export.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3pir6detail14TypeIdResolverINS_14Float8E5M2TypeEE3id_E

您好,请问这个问题是怎么解决的呀,我试了很多版本的paddle2onnx,paddle,都还有这个问题,求解答

HonLZL avatar Mar 18 '25 04:03 HonLZL

嗯嗯,protobuf版本降了,但是又遇到另一个问题,辛苦再看下~ File "/usr/local/lib/python3.10/dist-packages/paddle2onnx/convert.py", line 17, in import paddle2onnx.paddle2onnx_cpp2py_export as c_p2o ImportError: /usr/local/lib/python3.10/dist-packages/paddle2onnx/paddle2onnx_cpp2py_export.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3pir6detail14TypeIdResolverINS_14Float8E5M2TypeEE3id_E

您好,请问这个问题是怎么解决的呀,我试了很多版本的paddle2onnx,paddle,都还有这个问题,求解答

我切换到paddlx了~

Danee-wawawa avatar Mar 18 '25 06:03 Danee-wawawa

@HonLZL 你解决了吗,我也碰到这个问题了

sheiy avatar Mar 20 '25 07:03 sheiy

@sheiy 问题解决了吗,能详细描述下遇到的问题吗,建议先按照 paddleocr3.0 的说明文档来安装环境

leo-q8 avatar Jun 04 '25 03:06 leo-q8

@leo-q8 我已经不记得这是通过什么部署发生的问题了,反正现在是通过paddle-hub部署的用gpu只能单线程,只能通过启多个docker镜像达到多线程,cpu倒是可以多线程但是推理要慢一些,然后大图在调用ocr之前resize小一些才行

sheiy avatar Jun 04 '25 03:06 sheiy

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Sep 03 '25 02:09 github-actions[bot]