From d4a66d84e9749021f28e269d3b2e137ffedc2c6b Mon Sep 17 00:00:00 2001 From: Pablo Gonzalez Date: Fri, 3 Jan 2025 15:18:47 -0500 Subject: [PATCH] Set json output path when csv not provided --- mlperf_logging/result_summarizer/result_summarizer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlperf_logging/result_summarizer/result_summarizer.py b/mlperf_logging/result_summarizer/result_summarizer.py index 6a453a6..194b636 100644 --- a/mlperf_logging/result_summarizer/result_summarizer.py +++ b/mlperf_logging/result_summarizer/result_summarizer.py @@ -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: