PaddleOCR环境配置与试用官方的模型笔记

首先去github下载:https://github.com/PaddlePaddle/PaddleOCR,然后解压。

一、配置环境

(背景环境:linux+anaconda,CUDA Version: 11.4,无root权限)

1.1新建一个虚拟环境,名字为paddleocr :

conda create -n paddleocr python=3.9
conda activate paddleocr

 1.2安装PaddleOCR的依赖

cd PaddleOCR
pip install -r requirements.txt

1.3安装paddlepaddle GPU版本:

注:尝试使用pip install paddlepaddle-gpu进行安装,报错:RuntimeError: (PreconditionNotMet) Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.

故本处参考【Paddle Detection】跳坑总结 中的问题3,利用如下方法进行安装即可。

conda install paddlepaddle-gpu==2.2.2 cudatoolkit=11.2 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/ -c conda-forge

可参考官网安装​​​​​​​

1.4运行测试

>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ... 
W0719 20:56:56.254106 33372 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.4, Runtime API Version: 11.2
W0719 20:56:56.260345 33372 device_context.cc:465] device: 0, cuDNN Version: 8.1.
PaddlePaddle works well on 1 GPU.
W0719 20:57:00.134809 33372 parallel_executor.cc:617] Cannot enable P2P access from 0 to 1
W0719 20:57:00.134840 33372 parallel_executor.cc:617] Cannot enable P2P access from 0 to 2
W0719 20:57:00.134847 33372 parallel_executor.cc:617] Cannot enable P2P access from 1 to 0
W0719 20:57:02.398772 33372 parallel_executor.cc:617] Cannot enable P2P access from 2 to 0
W0719 20:57:08.944207 33372 dynamic_loader.cc:258] You may need to install 'nccl2' from NVIDIA official website: https://developer.nvidia.com/nccl/nccl-downloadbefore install PaddlePaddle.
WARNING:root:PaddlePaddle meets some problem with 3 GPUs. This may be caused by:
 1. There is not enough GPUs visible on your system
 2. Some GPUs are occupied by other process now
 3. NVIDIA-NCCL2 is not installed correctly on your system. Please follow instruction on https://github.com/NVIDIA/nccl-tests 
 to test your NCCL, or reinstall it following https://docs.nvidia.com/deeplearning/sdk/nccl-install-guide/index.html
WARNING:root:
 Original Error is: (PreconditionNotMet) The third-party dynamic library (libnccl.so) that Paddle depends on is not configured correctly. (error code is libnccl.so: cannot open shared object file: No such file or directory)
  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/paddle/fluid/platform/dynload/dynamic_loader.cc:285)

PaddlePaddle is installed successfully ONLY for single GPU! Let's start deep learning with PaddlePaddle now.

提示多卡训练的警告,可以参考:

Linux下NCCL源码编译安装 - chenzhen0530 - 博客园

NCCL无root权限编译安装

我目前仍未解决这个警告,不过问题不大,暂时没用到多卡训练。用到再处理。。

二、试用官方的模型

参考PaddleOCR学习(一)PaddleOCR安装与测试中的试用官方的模型过程即可。

PaddleOCR环境配置与试用官方的模型笔记_第1张图片

你可能感兴趣的:(paddle,paddlepaddle,conda,linux,深度学习)