PaddleX
PaddleX copied to clipboard
TensorRT部署时,加载模型时间长的问题
环境:cuda11.2+cudnn8.1+trt8.0.1.6 模型类型为PPYolov2,输入尺寸800*800 用的接口为paddle.deploy.predictor
import paddlex as pdx
import time
a=time.time()
model=pdx.deploy.Predictor(
model_dir = r'F:\gasket3\inference_model',
use_gpu = True,
use_trt = True,
trt_precision_mode = 'float16'
)
print(time.time()-a)
加载时间为459秒,差不多8分钟
已将deploy.py中的use_static设置为True,如图
并且在模型路径文件夹内已经自动生成了TRT优化序列信息("_opt_cache"文件夹内)
但是似乎每次加载模型时,都会重新生成一遍优化序列信息文件,文件夹内的文件每次加载都在增多
windows下连编tensorrt的paddle预编译包暂未提供,您是自己编译的吗?
我在linux(连编tensorrt的paddle预编译包: https://paddleinference.paddlepaddle.org.cn/user_guides/download_lib.html#linux )加载PPYOLOv2(输入尺寸800*800)需要51s 。
@FlyingQianMM
我是在paddle inference的版块下载到的(https://paddle-inference.readthedocs.io/en/latest/user_guides/download_lib.html#windows)
@FlyingQianMM 这个是bug吗,有办法解决吗
请问你TensorRT加速成功了吗?我显卡RTX3060,Cuda11.1 , Cudnn版本8.0.5.39 , TensorRT版本TensorRT-7.2.1.6 用C#一调用就报错内存受保护
@1316540491 可以加速
加速效果明显么?
@1316540491 我用的是python部署
@chliang 挺明显的,int8我还没有去弄,光用float16的加速,就提升了30%左右
@CashBai 大佬您好,关于trt里面shape该怎么设置? 像有很多 trt input [elementwise_add_101.tmp_1] dynamic shape info not set, please check and retry. 这样的报错,我一个一个加进去,但是参数不知道该怎么设置才是最优的?
请问使用TensorRT每次都重新生成一次优化序列文件的问题解决了吗?能分享吗