【PaddlePaddle】使用百度飞桨PaddlePaddle中遇到的问题汇总

本文汇总了使用PaddlePaddle过程中遇到的问题及解决方案,包括cudnn64_7.dll错误、ValueError轴越界问题、Babel的localeselector属性缺失以及Paddle2ONNX转换模型时的静态输入形状错误。解决办法涉及版本匹配、源码安装、依赖冲突调整和模型导出参数设置。

The third-party dynamic library (cudnn64_7.dll) that Paddle depends on is not configured correctly. (error code is 126)

Windows10下安装PaddlePaddle,进行paddle.utils.run_check()测试时报错,初以为是缺少 cudnn64_7.dll 所致,其实不然,而是 CUDA 版本、CUDNN 版本与 Paddlepaddle 版本不兼容导致,PaddlePaddle官网信息如下:

  • 如果您的计算机没有 NVIDIA® GPU,请安装CPU 版的 PaddlePaddle
  • 如果您的计算机有 NVIDIA® GPU,请确保满足以下条件并且安装 GPU 版 PaddlePaddle
    • CUDA 工具包 10.2 配合 cuDNN v7.6.5,如需使用 PaddleTensorRT 推理,需配合 TensorRT7.0.0.11
    • CUDA 工具包 11.2 配合 cuDNN v8.2.1,如需使用 PaddleTensorRT 推理,需配合 TensorRT8.2.4.2
    • CUDA 工具包 11.6 配合 cuDNN v8.4.0,如需使用 PaddleTensorRT 推理,需配合 TensorRT8.4.0.6
    • CUDA 工具包 11.7 配合 cuDNN v8.4.1,如需使用 PaddleTensorRT 推理,需配合 TensorRT8.4.2.4
    • CUDA 工具包 11.8 配合 cuDNN v8.6.0,如需使用 PaddleTensorRT 推理,需配合 TensorRT8.5.1.7
    • CUDA 工具包 12.0 配合 cuDNN v8.9.1, 如需使用 PaddleTensorRT 推理,需配合 TensorRT8.6.1.6
    • GPU 运算能力超过 3.5 的硬件设备
    • 注:目前官方发布的 windows 安装包仅包含 CUDA 10.2/11.2/11.6/11.7/11.8/12.0,如需使用其他 cuda 版本,请通过源码自行编译。您可参考 NVIDIA 官方文档了解 CUDA、CUDNN 和 TensorRT 的安装流程和配置方法,请见CUDA,cuDNN,TensorRT

只要三者版本对应cudnn64_8.dll也是可以的,可参考CSDN文章:PaddlePaddle 验证安装报错 cudnn64_7.dll 相关OK

ValueError: (InvalidArgument) The axis is expected to be in range of [0, 0), but got 0

这是官方Bug,属于版本问题,使用pip install PaddleSeg包,版本为2.8.0,就会出现此Bug。
Install paddleseg through source code instead of pip, It works well:

git clone https://github.com/PaddlePaddle/PaddleSeg
cd PaddleSeg
pip install -r requirements.txt
python setup.py install

参考 Github Issues #3408#3373 解决 。OK

AttributeError: ‘Babel’ object has no attribute ‘localeselector’

在使用VisualDL进行可视化时遇到:

在这里插入图片描述

原因:版本问题,当前使用的是VisualDL 2.2.0版本,同时flask_babel包版本为4.0.0,其接口发生了变化,VisualDL需要更新。

解决:重新安装VisualDL包。

pip uninstall visualdl
pip install visualdl==2.5 -i https://pypi.tuna.tsinghua.edu.cn/simple

在这里插入图片描述

参考 Github Issues #1200OK

后续问题点补充

ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
eiseg 1.1.1 requires protobuf==3.20.0, but you have protobuf 4.25.1 which is incompatible.
paddlepaddle-gpu 2.5.2 requires protobuf<=3.20.2,>=3.1.0; platform_system == “Windows”, but you have protobuf 4.25.1 which is incompatible.

安装visualdl 2.5可能会安装protobuf 4.25.1,而paddlepaddle-gpu 2.5.2要求protobuf<=3.20.2,所以再重装一下protobuf就好,版本3.20.2OK

[ERROR] [Paddle2ONNX] [pool2d: pool2d_4.tmp_0] Adaptive only support static input shape. [Paddle2ONNX] Due to the operator: pool2d, this model cannot be exported to ONNX.

原因是在调用export.py时没有固定shape。因为pp-matting-hrnet_w18-human_1024的配置文件没有指定固定的输入shape。再调用export.py时,添加参数--input_shape。例子如下:

python tools/export.py \ 
    --config configs/pp_liteseg/pp_liteseg_stdc1_cityscapes_1024x512_scale0.5_160k.yml \ 
    --model_path model.pdparams \ 
    --save_dir output/inference_model \ 
    --input_shape 1 3 1024 1024

导出后,再调用paddle2onnx方法转换模型。

参考 Github Issues #813 OK

Process finished with exit code -1073741819 (0xC0000005) 【PPOCRv3 使用 FastDeploy gpu+trt 部署时无法正常推理】

class PPOCRv3Wrapper:
	def __init():
		pass
		
    def build_runtime_option(self):

        det_option = fd.RuntimeOption()
        cls_option = fd.RuntimeOption()
        rec_option = fd.RuntimeOption()

        if self.device.lower() == "gpu":
            det_option.use_gpu(self.device_id)
            cls_option.use_gpu(self.device_id)
            rec_option.use_gpu(self.device_id)

        if self.backend.lower() == "trt":
            assert self.device.lower(
            ) == "gpu", "TensorRT backend require inference on device GPU."
            det_option.use_trt_backend()
            cls_option.use_trt_backend()
            rec_option.use_trt_backend()

            # If use TRT backend, the dynamic shape will be set as follow.
            # We recommend that users set the length and height of the detection model to a multiple of 32.
            # We also recommend that users set the Trt input shape as follow.
            det_option.set_trt_input_shape("x",
                                           [1, 3, 64,<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值