From 0842770b0d6418377a503f49fa68bb41de85e38d Mon Sep 17 00:00:00 2001 From: Zegorax Date: Thu, 9 Sep 2021 16:11:19 +0200 Subject: [PATCH 1/2] Changed onnx-simplifier check behavior Export.py has been updated to check for onnx-simplifier requirement only when the --simplify argument is added. Allows for better flexibility and one less requirement if simplify is not needed. --- export.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/export.py b/export.py index 5db09884bae8..97c5ad951928 100644 --- a/export.py +++ b/export.py @@ -44,7 +44,7 @@ def export_onnx(model, img, file, opset, train, dynamic, simplify): # ONNX model export prefix = colorstr('ONNX:') try: - check_requirements(('onnx', 'onnx-simplifier')) + check_requirements(('onnx')) import onnx print(f'\n{prefix} starting export with onnx {onnx.__version__}...') @@ -66,6 +66,7 @@ def export_onnx(model, img, file, opset, train, dynamic, simplify): # Simplify if simplify: try: + check_requirements(('onnx-simplifier')) import onnxsim print(f'{prefix} simplifying with onnx-simplifier {onnxsim.__version__}...') From 122c231f28a4e1e3994efc1820e229e78e871e9a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 9 Sep 2021 16:30:42 +0200 Subject: [PATCH 2/2] Fix single-element tuples --- export.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/export.py b/export.py index 97c5ad951928..b9b32b55ac7f 100644 --- a/export.py +++ b/export.py @@ -44,7 +44,7 @@ def export_onnx(model, img, file, opset, train, dynamic, simplify): # ONNX model export prefix = colorstr('ONNX:') try: - check_requirements(('onnx')) + check_requirements(('onnx',)) import onnx print(f'\n{prefix} starting export with onnx {onnx.__version__}...') @@ -66,7 +66,7 @@ def export_onnx(model, img, file, opset, train, dynamic, simplify): # Simplify if simplify: try: - check_requirements(('onnx-simplifier')) + check_requirements(('onnx-simplifier',)) import onnxsim print(f'{prefix} simplifying with onnx-simplifier {onnxsim.__version__}...')