Skip to content

Commit fdc0705

Browse files
generatedunixname499836121meta-codesync[bot]
authored andcommitted
fix wrong accuracy_status when exception. (#165731)
Summary: When I debug `XPU` accruacy issue, I found the script output wrong accuracy_status. When the `try` block raise an exception, we should process the exception, but not return the `fail_accuracy`. Before fixing, it returned as `fail_accuracy`: <img width="1109" height="216" alt="image" src="https://github.com/user-attachments/assets/385c354f-fbf6-48e4-a1be-3e37e987341b" /> After fixing, it returned the exception message: <img width="1101" height="292" alt="image" src="https://github.com/user-attachments/assets/f18c0e3c-8358-4ec7-a6bb-c2e01b69d27f" /> X-link: pytorch/pytorch#165731 Approved by: https://github.com/Stonepia, https://github.com/chuanqi129, https://github.com/Lucaskabela Reviewed By: seemethere Differential Revision: D84961115 fbshipit-source-id: 2d9834475229bccf00392b2810352d3fbbe16519
1 parent 6c32489 commit fdc0705

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

userbenchmark/dynamo/dynamobench/common.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,9 +2284,11 @@ def record_status(accuracy_status, dynamo_start_stats):
22842284
)
22852285
):
22862286
is_same = False
2287-
except Exception:
2287+
except Exception as e:
22882288
# Sometimes torch.allclose may throw RuntimeError
2289-
is_same = False
2289+
exception_string = str(e)
2290+
accuracy_status = f"fail_exception: {exception_string}"
2291+
return record_status(accuracy_status, dynamo_start_stats=start_stats)
22902292

22912293
if not is_same:
22922294
accuracy_status = "eager_two_runs_differ"
@@ -2403,9 +2405,11 @@ def record_status(accuracy_status, dynamo_start_stats):
24032405
force_max_multiplier=force_max_multiplier,
24042406
):
24052407
is_same = False
2406-
except Exception:
2408+
except Exception as e:
24072409
# Sometimes torch.allclose may throw RuntimeError
2408-
is_same = False
2410+
exception_string = str(e)
2411+
accuracy_status = f"fail_exception: {exception_string}"
2412+
return record_status(accuracy_status, dynamo_start_stats=start_stats)
24092413

24102414
if not is_same:
24112415
if self.args.skip_accuracy_check:

0 commit comments

Comments
 (0)