Jae-Won Chung commited on
Commit
176e245
1 Parent(s): 94f739f

Do not makedir when there is no dir

Browse files
Files changed (1) hide show
  1. scripts/compute_metrics.py +2 -1
scripts/compute_metrics.py CHANGED
@@ -10,7 +10,8 @@ def main(data_dir: str, out_file: str) -> None:
10
  model_names = os.listdir(data_dir)
11
  print(f"{model_names=}")
12
 
13
- os.makedirs(os.path.dirname(out_file), exist_ok=True)
 
14
  out_csv = csv.writer(open(out_file, "w", newline=""))
15
  metrics = ["throughput", "response_length", "latency", "energy"]
16
  out_csv.writerow(["model"] + metrics)
 
10
  model_names = os.listdir(data_dir)
11
  print(f"{model_names=}")
12
 
13
+ if dirname := os.path.dirname(out_file):
14
+ os.makedirs(dirname, exist_ok=True)
15
  out_csv = csv.writer(open(out_file, "w", newline=""))
16
  metrics = ["throughput", "response_length", "latency", "energy"]
17
  out_csv.writerow(["model"] + metrics)