PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

使用inference模型进行推理,如何使用多个gpu

Open sybest1259 opened this issue 2 years ago • 3 comments

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:ubuntu18.04 python3.7.0

  • 版本号/Version:Paddle: paddlepaddle-gpu=2.4.0rc0 PaddleOCR:2.6 Paddlenlp: 2.4.1

  • 运行指令/Command Code: from pprint import pprint from paddlenlp import Taskflow docprompt = Taskflow("document_intelligence") pprint(docprompt([{"doc": "1.jpg", "prompt": ["发票代码是多少?"]}]))

  • 完整报错/Complete Error Message: 看到tools/infer/utility.py中代码: 223行:config.enable_use_gpu(args.gpu_mem, 0)设置是使用一个gpu,id是0,能不能设置使用多个gpu进行推理

可以看到只使用了0号卡 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 450.102.04 Driver Version: 450.102.04 CUDA Version: 11.0 | |-------------------------------+----------------------+----------------------+ | 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 RTX 208... Off | 00000000:5A:00.0 Off | N/A | | 16% 35C P8 19W / 250W | 2586MiB / 11019MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ | 1 GeForce RTX 208... Off | 00000000:66:00.0 Off | N/A | | 16% 29C P8 21W / 250W | 3MiB / 11019MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ | 2 GeForce RTX 208... Off | 00000000:BD:00.0 Off | N/A | | 16% 36C P8 18W / 250W | 3MiB / 11019MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ | 3 GeForce RTX 208... Off | 00000000:C1:00.0 Off | N/A | | 16% 33C P8 11W / 250W | 3MiB / 11019MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 60920 C python 2583MiB | +-----------------------------------------------------------------------------+

sybest1259 avatar Nov 02 '22 09:11 sybest1259

暂时不支持单次预测在多个GPU上运行,如果要利用多个GPU批量预测,需要自己写个多进程

LDOUBLEV avatar Nov 02 '22 11:11 LDOUBLEV

好的,谢谢。推理的多卡功能后续会提供支持吗?

sybest1259 avatar Nov 03 '22 01:11 sybest1259

这个还不确定

LDOUBLEV avatar Nov 03 '22 03:11 LDOUBLEV

好的,谢谢

sybest1259 avatar Nov 04 '22 09:11 sybest1259