Nan is not captured properly

#315
by sieu-n - opened
Files changed (1) hide show
  1. src/display_models/read_results.py +2 -1
src/display_models/read_results.py CHANGED
@@ -1,4 +1,5 @@
1
  import json
 
2
  import os
3
  from dataclasses import dataclass
4
  from typing import Dict, List, Tuple
@@ -96,7 +97,7 @@ def parse_eval_result(json_filepath: str) -> Tuple[str, list[dict]]:
96
  eval_results = []
97
  for benchmark, metric in zip(BENCHMARKS, METRICS):
98
  accs = np.array([v.get(metric, None) for k, v in data["results"].items() if benchmark in k])
99
- if accs.size == 0 or any([acc is None for acc in accs]):
100
  continue
101
  mean_acc = np.mean(accs) * 100.0
102
  eval_results.append(
 
1
  import json
2
+ import math
3
  import os
4
  from dataclasses import dataclass
5
  from typing import Dict, List, Tuple
 
97
  eval_results = []
98
  for benchmark, metric in zip(BENCHMARKS, METRICS):
99
  accs = np.array([v.get(metric, None) for k, v in data["results"].items() if benchmark in k])
100
+ if accs.size == 0 or any([acc is None or math.isnan(acc) for acc in accs]):
101
  continue
102
  mean_acc = np.mean(accs) * 100.0
103
  eval_results.append(