Skip to content

Commit

Permalink
Skip onnx.check_model if model is too large
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoin authored Apr 10, 2023
1 parent 9382d2f commit f0ba51c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sparseml/onnx/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ def validate_onnx_file(path: str):
"""
try:
onnx_model = check_load_model(path)
onnx.checker.check_model(onnx_model)

if onnx_model.ByteSize() < onnx.checker.MAXIMUM_PROTOBUF:
onnx.checker.check_model(onnx_model)
else:
_LOGGER.warning(
"onnx check_model skipped as model exceeds maximum protobuf size of 2GB"
)

if not onnx_model.opset_import:
raise ValueError("could not parse opset_import")
except Exception as err:
Expand Down

0 comments on commit f0ba51c

Please sign in to comment.