Fix TensorRT potential unordered binding addresses (#5826)

* feat: change file suffix in pythonic way

* fix: enforce binding addresses order

* fix: enforce binding addresses order
This commit is contained in:
imyhxy authored and GitHub committed 2021-11-30 13:52:22 +01:00
1 parent 5ca5dd4c87
commit a4207a202d
2 files changed
+5 -4

No files matched your search

+2 -1
View File
@@ -276,7 +276,7 @@ def export_engine(model, im, file, train, half, simplify, workspace=4, verbose=F
assert onnx.exists(), f'failed to export ONNX file: {onnx}'
LOGGER.info(f'\n{prefix} starting export with TensorRT {trt.__version__}...')
f = str(file).replace('.pt', '.engine') # TensorRT engine file
f = file.with_suffix('.engine') # TensorRT engine file
logger = trt.Logger(trt.Logger.INFO)
if verbose:
logger.min_severity = trt.Logger.Severity.VERBOSE
@@ -310,6 +310,7 @@ def export_engine(model, im, file, train, half, simplify, workspace=4, verbose=F
except Exception as e:
LOGGER.info(f'\n{prefix} export failure: {e}')
@torch.no_grad()
def run(data=ROOT / 'data/coco128.yaml', # 'dataset.yaml path'
weights=ROOT / 'yolov5s.pt', # weights path