deepsworld / Yolo5Optimized

Optimized Yolo5 with TensorRT
GNU General Public License v3.0
3 stars 1 forks source link

AttributeError: 'tensorrt.tensorrt.Builder' object has no attribute 'max_workspace_size' #2

Open hdnh2006 opened 2 years ago

hdnh2006 commented 2 years ago

I tried on my jetson but I got the following error:

YOLOv5 \U0001f680 2021-10-7 torch 1.8.0 CUDA:0 (NVIDIA Tegra X1, 3964.1015625MB)

[TensorRT] INFO: [MemUsageChange] Init CUDA: CPU +198, GPU +0, now: CPU 1547, GPU 3688 (MiB)
input_names=['input_0']
output_names=['output_0', 'output_1', 'output_2']
[TensorRT] WARNING: onnx2trt_utils.cpp:364: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
Traceback (most recent call last):
  File "detect.py", line 107, in <module>
    main()
  File "detect.py", line 103, in main
    model = get_model(args.arch, dev, args.reload, fp16=args.fp16, bs=args.batch_size)
  File "detect.py", line 51, in get_model
    workspace_size=DEFAULT_WORKSPACE_SIZE
  File "/home/yolo5/yolo/detector.py", line 102, in deploy
    **kwargs)
  File "/home/yolo5/yolo/deploy/utils.py", line 185, in build
    **kwargs)
  File "/home/yolo5/yolo/deploy/trt.py", line 166, in torch2trt
    builder.max_workspace_size = max_workspace_size
AttributeError: 'tensorrt.tensorrt.Builder' object has no attribute 'max_workspace_size'

Please check again.

deepsworld commented 2 years ago

@hdnh2006 What is the TensorRT version? This might happen if your TensorRT>= 8.0.1. I think they removed the max_workspace_size argument from the builder object. You can just comment it out and it should work. Let me know how it goes. You can check the version using:

import tensorrt as trt
print(trt.__version__)