diff --git a/onnxsim/onnx_simplifier.py b/onnxsim/onnx_simplifier.py index 27f6594..528b26f 100644 --- a/onnxsim/onnx_simplifier.py +++ b/onnxsim/onnx_simplifier.py @@ -209,7 +209,7 @@ def parse_size(size: str) -> int: check_ok = model_checking.compare( model_opt, model, check_n, test_input_shapes, input_data, custom_lib ) - except ValueError: + except (ValueError, onnx.onnx_cpp2py_export.checker.ValidationError): print("[bold magenta]Simplified model larger than 2GB. Trying to save as external data...[/bold magenta]") # large models try to convert through a temporary file with tempfile.TemporaryDirectory() as tmpdirname: