Skip to content

Commit

Permalink
more better error messages [3/N] (#147494)
Browse files Browse the repository at this point in the history
Summary:
X-link: pytorch/pytorch#147494
Approved by: https://github.com/jansel, https://github.com/zou3519

Reviewed By: wdvr

Differential Revision: D70376072

fbshipit-source-id: d5122328e062214ecb9e28ec3720f7f2983ab035
  • Loading branch information
williamwen42 authored and facebook-github-bot committed Feb 28, 2025
1 parent 616de54 commit ee78538
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3248,7 +3248,10 @@ def run_node(tracer, node, args, kwargs, nnmodule):
with set_current_node(node):

def make_error_message(e):
return f"Failed running {op} {node.target}(*{args}, **{kwargs}):\n" + str(e)
return (
f"Dynamo failed to run FX node with fake tensors: {op} {node.target}(*{args}, **{kwargs}): got "
+ repr(e)
)

from .exc import Unsupported

Expand Down Expand Up @@ -3279,11 +3282,17 @@ def make_error_message(e):
# NB: mimic how wrap_fake_exception does it
from .exc import unimplemented_v2

hints = []
if isinstance(e, NotImplementedError):
hints = [
"If the op is a PyTorch op, please file an issue to PyTorch.",
]

unimplemented_v2(
gb_type="NotImplementedError/UnsupportedFakeTensorException when running node",
context=str(e),
gb_type="NotImplementedError/UnsupportedFakeTensorException when running FX node",
context="",
explanation=make_error_message(e),
hints=[],
hints=hints,
from_exc=e,
)
except Unsupported:
Expand Down

0 comments on commit ee78538

Please sign in to comment.