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 <glenn.jocher@ultralytics.com>
This commit is contained in:
ZegoraxandGlenn Jocher authored and GitHub committed 2021-09-09 16:49:10 +02:00
1 parent 1cad0ce2c7
commit 2d9411dbb8
1 file changed
+2 -1
+2 -1
View File
@@ -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__}...')