def PrepareEngine():
with trt.Builder(TRT_LOGGER) as builder, builder.create_network(EXPLICIT_BATCH) as network, trt.OnnxParser(network, TRT_LOGGER) as parser:
builder.max_workspace_size = 1 << 30
with open('best.onnx', 'rb') as model:
if not parser.parse(model.read()):
print ('ERROR: Failed to parse the ONNX file.')
for error in range(parser.num_errors):
print (parser.get_error(error))
engine = builder.build_cuda_engine(network)
and I am getting an error of
AttributeError: 'tensorrt.tensorrt.Builder' object has no attribute 'max_workspace_size' Can anyone please help me with this. Below are the details of my hardware:
Jetson Xavier NX
TensorRT version: ‘8.0.1.6’
Jetpack 4.6
Cuda Version: 10.2.300
cuDNN version: 8.2.1.32
Cuda Arch: 7.2
Python: 3.6
I have tried to run the code again. But getting below error now:
Traceback (most recent call last):
File "app4.py", line 74, in <module>
engine = PrepareEngine()
File "app4.py", line 42, in PrepareEngine
config.set_memory_pool_limit(trt.MemoryPoolType.WORKSPACE, 1 << 30)
AttributeError: 'tensorrt.tensorrt.IBuilderConfig' object has no attribute 'set_memory_pool_limit'
I am using yolov7-tiny model. I have converted it into onnx and then using it with this script. I have also executed it with trtexec and it worked fine with no issues and generated the .engine file.