- 系统环境/System Environment: sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=64G --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda11.2-cudnn8 /bin/bash
- 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
- 运行指令/Command Code:
- 完整报错/Complete Error Message:
根据 基于Python引擎的PP-OCR模型库推理 说明,使用python3 tools/infer/predict_system.py
进行推理时,设置use_tensorrt=True
会出现如下报错:
Traceback (most recent call last):
Traceback (most recent call last):
File "tools/infer/predict_system.py", line 232, in <module>
File "tools/infer/predict_system.py", line 232, in <module>
main(args)
File "tools/infer/predict_system.py", line 184, in main
main(args)
File "tools/infer/predict_system.py", line 184, in main
text_sys = TextSystem(args)
File "tools/infer/predict_system.py", line 45, in __init__
text_sys = TextSystem(args)self.text_detector = predict_det.TextDetector(args)
File "tools/infer/predict_system.py", line 45, in __init__
File "/paddle/PaddleOCR/tools/infer/predict_det.py", line 107, in __init__
args, 'det', logger)
self.text_detector = predict_det.TextDetector(args) File "/paddle/PaddleOCR/tools/infer/utility.py", line 303, in create_predictor
File "/paddle/PaddleOCR/tools/infer/predict_det.py", line 107, in __init__
args, 'det', logger)
File "/paddle/PaddleOCR/tools/infer/utility.py", line 303, in create_predictor
predictor = inference.create_predictor(config)
ValueError: (InvalidArgument) Pass tensorrt_subgraph_pass has not been registered. Please use the paddle inference library compiled with tensorrt or disable the tensorrt engine in inference configuration!
[Hint: Expected Has(pass_type) == true, but received Has(pass_type):0 != true:1.] (at /paddle/paddle/fluid/framework/ir/pass.h:216)
predictor = inference.create_predictor(config)
ValueError: (InvalidArgument) Pass tensorrt_subgraph_pass has not been registered. Please use the paddle inference library compiled with tensorrt or disable the tensorrt engine in inference configuration!
[Hint: Expected Has(pass_type) == true, but received Has(pass_type):0 != true:1.] (at /paddle/paddle/fluid/framework/ir/pass.h:216)
如果use_tensorrt
设置为默认False
时不会出现问题,但是会太慢。
请问这里既然给出了tensorrt
加速参数,理论是可以使用的,为什么会报错呢?请解答疑惑,多谢