Spaces:
Sleeping
Sleeping
XufengDuan
commited on
Commit
·
9271c65
1
Parent(s):
fe9c47e
update scripts
Browse files
src/leaderboard/read_evals.py
CHANGED
@@ -77,8 +77,23 @@ class EvalResult:
|
|
77 |
if isinstance(task.metric, str):
|
78 |
# accs = np.array([v.get(task.metric, None) for k, v in data["results"].items() if
|
79 |
# task.benchmark == k and isinstance(v, dict)])
|
80 |
-
accs = np.array([np.around(v*100, decimals=0) for k, v in data["results"].items() if task.benchmark == k])
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
# 过滤掉 None 值,确保 accs 只包含有效的数值
|
83 |
accs = accs[accs != None]
|
84 |
|
|
|
77 |
if isinstance(task.metric, str):
|
78 |
# accs = np.array([v.get(task.metric, None) for k, v in data["results"].items() if
|
79 |
# task.benchmark == k and isinstance(v, dict)])
|
80 |
+
# accs = np.array([np.around(v*100, decimals=0) for k, v in data["results"].items() if task.benchmark == k])
|
81 |
+
accs = []
|
82 |
+
import math
|
83 |
+
for k, v in data["results"].items():
|
84 |
+
if task.benchmark == k:
|
85 |
+
if isinstance(v, (int, float)) and not math.isnan(v):
|
86 |
+
accs.append(np.around(v * 100, decimals=0))
|
87 |
+
elif isinstance(v, list):
|
88 |
+
# 处理列表中的每个数值
|
89 |
+
accs.extend([np.around(x * 100, decimals=0) for x in v if
|
90 |
+
isinstance(x, (int, float)) and not math.isnan(x)])
|
91 |
+
else:
|
92 |
+
# 跳过 NaN 或不符合条件的值
|
93 |
+
accs.append(None)
|
94 |
+
|
95 |
+
# 去掉 None 值(如果有)
|
96 |
+
accs = np.array([x for x in accs if x is not None])
|
97 |
# 过滤掉 None 值,确保 accs 只包含有效的数值
|
98 |
accs = accs[accs != None]
|
99 |
|