Skip to content

Commit e8f8062

Browse files
authored
Support dumping of json summary for result summarizer (#399)
1 parent 0f8e59c commit e8f8062

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mlperf_logging/result_summarizer/result_summarizer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,11 @@ def _print_and_write(summaries, weak_scaling=False, mode='w', power = False):
960960
summaries.groupby(specs_and_notes).apply(lambda x: agg_columns_fn(x, benchmarks)).to_csv(csv, mode=mode)
961961
else:
962962
summaries.to_csv(csv, index=False, mode=mode)
963-
963+
json_df = summaries.to_json(orient="records")
964+
json_data = json.loads(json_df)
965+
with open(f"""{csv.replace(".csv", ".json")}""", "w") as f:
966+
f.write(json.dumps(json_data, indent=2))
967+
964968
if args.xlsx is not None:
965969
_summaries_to_xlsx(summaries, args.xlsx, args.ruleset[:3])
966970

0 commit comments

Comments
 (0)