基于PaddleHub Serving的服务部署实践

环境1080ti

32G

Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz

前置条件,安装NVI驱动和CUDA,CUDNN,驱动安装参考这里

https://www.cnblogs.com/whitelittle/p/15985984.html

CUDNN安装

  1. Navigate to your <cudnnpath> directory containing the cuDNN Debian file.
  2. Install the runtime library, for example:
    sudo dpkg -i libcudnn8_x.x.x-1+cudax.x_amd64.deb

    or

    sudo dpkg -i libcudnn8_x.x.x-1+cudax.x_arm64.deb
  3. Install the developer library, for example:
    sudo dpkg -i libcudnn8-dev_8.x.x.x-1+cudax.x_amd64.deb

    or

    sudo dpkg -i libcudnn8-dev_8.x.x.x-1+cudax.x_arm64.deb
  4. Install the code samples and the cuDNN library documentation, for example:
    sudo dpkg -i libcudnn8-samples_8.x.x.x-1+cudax.x_amd64.deb

    or

    sudo dpkg -i libcudnn8-samples_8.x.x.x-1+cudax.x_arm64.deb


    验证安装结果

    安装完成后您可以使用 python 或 python3 进入python解释器,输入import paddle ,再输入 paddle.utils.run_check()

    如果出现PaddlePaddle is installed successfully!,说明您已成功安装


    CUDA和CUDNn的版本兼容参考这里https://blog.csdn.net/qq_44691524/article/details/117226459


驱动版本信息

xxxxxxx:/home/www/htdocs/ocr/orc-git/PaddleOCR# nvidia-smi
Fri May 20 14:51:55 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.27.04 Driver Version: 460.27.04 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 107... On | 00000000:01:00.0 Off | N/A |
| 0% 38C P8 8W / 180W | 1263MiB / 8118MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1276 G /usr/lib/xorg/Xorg 8MiB |
| 0 N/A N/A 1322 G /usr/bin/gnome-shell 7MiB |
| 0 N/A N/A 163054 C /root/miniconda3/bin/python 1243MiB |
+-----------------------------------------------------------------------------+

 

CUAD版本信息

(base) root@xxxxxxx:/home/www/htdocs/ocr/orc-git/PaddleOCR# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Nov_30_19:08:53_PST_2020
Cuda compilation tools, release 11.2, V11.2.67
Build cuda_11.2.r11.2/compiler.29373293_0

pip list|grep paddle
paddle 1.0.2
paddle-bfloat 0.1.2
paddle2onnx 0.9.6
paddlefsl 1.1.0
paddlehub 2.2.0
paddlenlp 2.2.0
paddlepaddle-gpu 2.3.0.post112

按照官网部署基本没什么大问题,CPU模式一遍就过了

在测试GPU模式的时候,一直报错request模块远程连接拒绝

最后查询好多资料才发现必须安装post版本的paddlepaddle-gpu 

python -m pip install paddlepaddle-gpu==2.3.0.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

 

 结果OK

 

 

今天发现一个问题,pip安装包在root下和在普通用户下不同,导致使用super管理时报错,

解决办法:指定用户为普通用户

问题,hubserving起来以后,GPU没有占用

paddlepaddle-gpu       2.3.0.post112

原因是同时安装了paddlepaddle和paddlepaddle-gpu。优先调用CPU模块,即使配置了GPU=true也没用

另外会报错

RuntimeError: Version mismatch in PaddleHub and PaddlePaddle, you need to upgrade PaddlePaddle to version 2.0.0 or above.

答案的paddlehub和paddlepaddle-gpu的版本不匹配,安装同样的2.2.0即可

 

遇到问题,

测试paddle是否正常

RuntimeError: (PreconditionNotMet) Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.
[Hint: cudnn_dso_handle should not be null.] (at /paddle/paddle/phi/backends/dynload/cudnn.cc:59)

说明没有安装CNDNN,官网测试的话报错STRING OUT OF RANGE

 

posted @ 2022-05-20 14:55  不敲代码  阅读(2053)  评论(0)    收藏  举报