Spaces:
Running
Running
Jae-Won Chung
commited on
Commit
•
93263f1
1
Parent(s):
82141cb
Add print_results.py
Browse files- scripts/print_results.py +22 -0
scripts/print_results.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import json
|
3 |
+
from contextlib import suppress
|
4 |
+
|
5 |
+
import tyro
|
6 |
+
|
7 |
+
|
8 |
+
def main(data_dir: str) -> None:
|
9 |
+
"""Summarize the results collected for all models in the given directory."""
|
10 |
+
model_names = os.listdir(data_dir)
|
11 |
+
print(len(model_names), "models found")
|
12 |
+
|
13 |
+
for i, model_name in enumerate(model_names):
|
14 |
+
try:
|
15 |
+
benchmark = json.load(open(f"{data_dir}/{model_name}/benchmark.json"))
|
16 |
+
print(f"[{i:2d}] {len(benchmark):5d} results found for", model_name)
|
17 |
+
except json.JSONDecodeError:
|
18 |
+
print(f"[{i:2d}] [ERR] results founds for {model_name}")
|
19 |
+
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
tyro.cli(main)
|