paddleocr 2.6 + torch 2.4.1 环境搭建指南

1、安装CUDA

下载 CUDA 12.1 cuda_12.1.0_531.14_windows.exe,然后完成安装,如下图:
在这里插入图片描述

2、安装cudnn

下载CUDNN 8.9.1 cudnn-windows-x86_64-8.9.1.23_cuda12-archive.zip,注意需要先登录才能下载。
因为使用paddleocr时有版本对应要求,目前CUDA12.1对应的CUDNN版本为8.9.1。
下载后,如下图所示:
在这里插入图片描述
将这三个文件夹复制到cuda的安装目录下即可。

3、安装PyTorch

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

4、安装飞桨

python -m pip install paddlepaddle-gpu==2.6.1.post120 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
python -m pip install paddleocr==2.6.1.3

问题1

RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_8.dll) that Paddle depends on is not configured correctly. (error code is 126)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:305)

此问题可能与飞桨要求的CUDNN和CUDA版本没有对应上,但笔者没有遇到此问题。

又或者cudnn64_8.dll不在环境变量。

又或者你在Pycharm中打开时安装的cudnn和cuda,此时应该把Pycharm全部关闭,重新打开。

问题2

Could not locate zlibwapi.dll. Please make sure it is in your library path!

下载zlibwapi.dll,放到cuda的bin目录下即可。

问题3

RuntimeError: (PreconditionNotMet) The third-party dynamic library (cublas64_118.dll;cublas64_11.dll) that Paddle depends on is not configured correctly. (error code is 126)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.

到cuda安装目录的bin目录下,找到cublas64_12.dll,将其复制一个副本为cublas64_11.dll即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值