From 5cfd471907dc6491665d01ba7f8ef460ecea559b Mon Sep 17 00:00:00 2001 From: Zegorax Date: Thu, 9 Sep 2021 16:49:10 +0200 Subject: [PATCH] Scope `onnx-simplifier` requirements check (#4730) * 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. * Fix single-element tuples Co-authored-by: Glenn Jocher --- export.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/export.py b/export.py index 5db09884bae8..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', '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__}...')