Skip to content

Commit ebf4c1b

Browse files
committed
change the debug info of fx.GraphModule replay error
1 parent e25cb03 commit ebf4c1b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

graph_net/torch/fx_graph_module_util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def get_torch_module_and_inputs(model_path):
1515
def _get_torch_module(model_path):
1616
py_module = load_module(f"{model_path}/model.py")
1717
torch_module_cls = py_module.GraphModule
18+
torch_module_cls.__graph_net_file_path__ = model_path
1819
return torch_module_cls()
1920

2021

graph_net/torch/fx_graph_parse_util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,16 @@ def handle_underscore_suffix_difference():
221221

222222
zip_filter_names = get_zip_filter_names()
223223

224-
def zip_filter_names_str():
224+
def zip_filter_names_error_str():
225225
for triple in zip_filter_names:
226226
print(triple)
227-
return "<printed before>"
227+
error_model_path = module.__graph_net_file_path__
228+
return f"{error_model_path=}"
228229

229230
from pathlib import Path
230231

231232
Path("/tmp/a.py").write_text(traced_module.code)
232-
assert len(zip_filter_names) == 0, f"{zip_filter_names_str()=}"
233+
assert len(zip_filter_names) == 0, zip_filter_names_error_str()
233234
return traced_module
234235

235236

0 commit comments

Comments
 (0)