Skip to content

Commit

Permalink
Fix a missing write_csv_when_exception problem (#115370)
Browse files Browse the repository at this point in the history
Summary:
Fix a problem shown in https://github.com/pytorch/pytorch/actions/runs/7124839624/job/19400589129 when a model times out.

X-link: pytorch/pytorch#115370
Approved by: https://github.com/eellison

Reviewed By: atalman

Differential Revision: D51999570

Pulled By: desertfire

fbshipit-source-id: 77d4cc1ccce63f8d3409914094478e93964e61d4
  • Loading branch information
desertfire authored and facebook-github-bot committed Dec 10, 2023
1 parent 4dbc55b commit fd78d61
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions userbenchmark/dynamo/dynamobench/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3145,6 +3145,24 @@ def main(runner, original_dir=None, args=None):
process_entry(0, runner, original_dir, args)


def write_csv_when_exception(name: str, status: str, device=None):
print(status)
placeholder_batch_size = 0
devices = [device] if device is not None else args.devices
if args.accuracy:
headers = ["dev", "name", "batch_size", "accuracy"]
rows = [[device, name, placeholder_batch_size, status] for device in devices]
elif args.performance:
headers = ["dev", "name", "batch_size", "speedup", "abs_latency"]
rows = [[device, name, placeholder_batch_size, 0.0, 0.0] for device in devices]
else:
headers = []
rows = [[device, name, placeholder_batch_size, 0.0] for device in devices]

for row in rows:
output_csv(output_filename, headers, row)


def run(runner, args, original_dir=None):
# Pass the parsed args object to benchmark runner object
runner.args = args
Expand Down Expand Up @@ -3500,31 +3518,6 @@ def run(runner, args, original_dir=None):
# Go back to main branch
repo.git.checkout(main_branch)
elif args.only:

def write_csv_when_exception(name: str, status: str, device=None):
print(status)
placeholder_batch_size = 0
devices = [device] if device is not None else args.devices
if args.accuracy:
headers = ["dev", "name", "batch_size", "accuracy"]
rows = [
[device, name, placeholder_batch_size, status] for device in devices
]
elif args.performance:
headers = ["dev", "name", "batch_size", "speedup", "abs_latency"]
rows = [
[device, name, placeholder_batch_size, 0.0, 0.0]
for device in devices
]
else:
headers = []
rows = [
[device, name, placeholder_batch_size, 0.0] for device in devices
]

for row in rows:
output_csv(output_filename, headers, row)

model_name = args.only
for device in args.devices:
batch_size = args.batch_size
Expand Down

0 comments on commit fd78d61

Please sign in to comment.