Skip to content

Commit

Permalink
Merge pull request #401 from mlcommons/fix_json_output
Browse files Browse the repository at this point in the history
Set json output path when csv not provided
  • Loading branch information
arjunsuresh authored Jan 7, 2025
2 parents faa29f9 + d4a66d8 commit 16e4d25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mlperf_logging/result_summarizer/result_summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,10 @@ def _print_and_write(summaries, weak_scaling=False, mode='w', power = False):
summaries.groupby(specs_and_notes).apply(lambda x: agg_columns_fn(x, benchmarks)).to_csv(csv, mode=mode)
else:
summaries.to_csv(csv, index=False, mode=mode)
json_path = "summary.json" if args.csv is None else f"""{csv.replace(".csv", ".json")}"""
json_df = summaries.to_json(orient="records")
json_data = json.loads(json_df)
with open(f"""{csv.replace(".csv", ".json")}""", "w") as f:
with open(json_path, "w") as f:
f.write(json.dumps(json_data, indent=2))

if args.xlsx is not None:
Expand Down

0 comments on commit 16e4d25

Please sign in to comment.