YOLOv7_Tensorrt icon indicating copy to clipboard operation
YOLOv7_Tensorrt copied to clipboard

生成engine报错

Open lwplw opened this issue 2 years ago • 6 comments

相关环境: python 3.6.9 cuda-10.2 cuDNN-8.4.1 TensorRT-8.4.3.1 转的是官方的yolov7.pt,报错如下,搜了下有人说是cuda-10.2的问题,需要装2个补丁,我装过了还是报这个错,求助下

[10/12/2022-11:13:58] [W] [TRT] onnx2trt_utils.cpp:369: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[10/12/2022-11:13:58] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-11:13:58] [I] [TRT] No importer registered for op: EfficientNMS_TRT. Attempting to import as plugin.
[10/12/2022-11:13:58] [I] [TRT] Searching for plugin: EfficientNMS_TRT, plugin_version: 1, plugin_namespace: 
[10/12/2022-11:13:58] [I] [TRT] Successfully created plugin: EfficientNMS_TRT
[10/12/2022-11:13:58] [I] Finish parsing network model
[10/12/2022-11:15:26] [I] [TRT] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +101, GPU +50, now: CPU 450, GPU 207 (MiB)
[10/12/2022-11:16:56] [I] [TRT] [MemUsageChange] Init cuDNN: CPU +124, GPU +52, now: CPU 574, GPU 259 (MiB)
[10/12/2022-11:16:56] [I] [TRT] Local timing cache in use. Profiling results in this builder pass will not be stored.
[10/12/2022-11:20:42] [I] [TRT] Some tactics do not have sufficient workspace memory to run. Increasing workspace size will enable more tactics, please check verbose output for requested sizes.
[10/12/2022-11:21:06] [E] Error[2]: [ltWrapper.cpp::setupHeuristic::349] Error Code 2: Internal Error (Assertion cublasStatus == CUBLAS_STATUS_SUCCESS failed. )
[10/12/2022-11:21:06] [E] Error[2]: [builder.cpp::buildSerializedNetwork::636] Error Code 2: Internal Error (Assertion engine != nullptr failed. )
[10/12/2022-11:21:06] [E] Engine could not be created from network
[10/12/2022-11:21:06] [E] Building engine failed
[10/12/2022-11:21:06] [E] Failed to create engine from model or file.
[10/12/2022-11:21:06] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v8403] # ./trtexec --onnx=./yolov7.onnx --saveEngine=./yolov7.engine --workspace=200

lwplw avatar Oct 12 '22 03:10 lwplw

是的,建议安装一下两个cuda10.2的补丁试一下

Monday-Leo avatar Oct 12 '22 09:10 Monday-Leo

是的,建议安装一下两个cuda10.2的补丁试一下

试过了,没解决掉。

一度以为是onnx版本的问题(python-3.6.9只有onnx-1.11.0),刚才换python-3.7,重装了整个环境,把onnx升级到了1.12.0 现在各软件的版本和你列出来的是一致的,有点迷惑了...

现在表现的cuda的问题,我还在猜测会不会是cuda安装方式的问题,我是装的.run,请问你是.deb装的吗,我验证一下

lwplw avatar Oct 12 '22 09:10 lwplw

我尝试使用官方release的yolov7-v0.1及yolov7.pt重新生成了yolov7.onnx,出现了和之前不同的错误:

[10/12/2022-20:06:44] [I] [TRT] Input filename:   ./yolov7.onnx
[10/12/2022-20:06:44] [I] [TRT] ONNX IR version:  0.0.6
[10/12/2022-20:06:44] [I] [TRT] Opset version:    12
[10/12/2022-20:06:44] [I] [TRT] Producer name:    pytorch
[10/12/2022-20:06:44] [I] [TRT] Producer version: 1.7
[10/12/2022-20:06:44] [I] [TRT] Domain:           
[10/12/2022-20:06:44] [I] [TRT] Model version:    0
[10/12/2022-20:06:44] [I] [TRT] Doc string:       
[10/12/2022-20:06:44] [I] [TRT] ----------------------------------------------------------------
[10/12/2022-20:06:44] [W] [TRT] onnx2trt_utils.cpp:369: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[10/12/2022-20:06:44] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-20:06:44] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-20:06:44] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-20:06:45] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-20:06:45] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-20:06:45] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-20:06:45] [W] [TRT] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[10/12/2022-20:06:45] [I] [TRT] No importer registered for op: EfficientNMS_TRT. Attempting to import as plugin.
[10/12/2022-20:06:45] [I] [TRT] Searching for plugin: EfficientNMS_TRT, plugin_version: 1, plugin_namespace: 
[10/12/2022-20:06:45] [I] [TRT] Successfully created plugin: EfficientNMS_TRT
[10/12/2022-20:06:45] [I] Finish parsing network model
[10/12/2022-20:08:14] [I] [TRT] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +61, GPU +50, now: CPU 454, GPU 207 (MiB)
[10/12/2022-20:09:43] [I] [TRT] [MemUsageChange] Init cuDNN: CPU +125, GPU +52, now: CPU 579, GPU 259 (MiB)
[10/12/2022-20:09:43] [I] [TRT] Local timing cache in use. Profiling results in this builder pass will not be stored.
trtexec: /root/gpgpu/MachineLearning/myelin/src/compiler/optimizer/autotuner.cpp:1016: myelin::ir::tactic_attribute_t myelin::autotuner::autotuner_t::get_best_tactic(): Assertion `tactics.size() > 0 && "No tactics to implement operation"' failed.
已放弃

lwplw avatar Oct 12 '22 12:10 lwplw

建议使用压缩包方式安装cuda和tensorrt,ONNX模型可以使用QQ群的模型,看是不是onnx模型的问题。

Monday-Leo avatar Oct 13 '22 07:10 Monday-Leo

建议使用压缩包方式安装cuda和tensorrt,ONNX模型可以使用QQ群的模型,看是不是onnx模型的问题。

用了QQ群的模型,还是上一楼v0.1模型的那个错误,那就把onnx排除了,我重装下cuda试试

lwplw avatar Oct 13 '22 09:10 lwplw

deb装cuda有点行不通啊,deb装cuda-10.2会直接安装440驱动并且覆盖掉之前的,但是我gpu是3050,最低需要470的驱动... 卸载440的时候也会把装好的cuda一起卸载掉

lwplw avatar Oct 14 '22 05:10 lwplw