Skip to content

Commit

Permalink
Merge pull request #810 from pfnet/take-cheeze-patch-2
Browse files Browse the repository at this point in the history
[onnx] Also check validation error in model load
  • Loading branch information
linshokaku committed Mar 26, 2024
2 parents 4979e30 + 08c20a5 commit 730085c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pytorch_pfn_extras/onnx/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def load_model(
"""
try:
return onnx.load_model(f, format=format, load_external_data=load_external_data)
except OSError as e: # The ONNX may contain stripped large tensors.
except (OSError, onnx.checker.ValidationError) as e: # The ONNX may contain stripped large tensors.
if (load_external_data
and isinstance(e, OSError)
and json.loads(Path(e.filename).name)["type"] != "stripped"):
raise
warnings.warn(
Expand Down

0 comments on commit 730085c

Please sign in to comment.