-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluate_all.py
54 lines (42 loc) · 1.75 KB
/
evaluate_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import subprocess
from constants import ALL_MODEL_NAMES, EVALUATION_NAME_TO_FILEPATH
def main():
for index, model_name in enumerate(ALL_MODEL_NAMES):
print(f"\n\nWorking on model {index+1}/{len(ALL_MODEL_NAMES)} [{model_name}].")
for evaluation_name in EVALUATION_NAME_TO_FILEPATH.keys():
if evaluation_name in ("drop_test", "tatqa_test"):
print(f"Skipping {evaluation_name} as it needs to be evaluated on the leaderboard.")
continue
model_with_data_name = model_name
model_with_data_name += "-"
model_with_data_name += (
evaluation_name.replace("_dev", "").replace("_test", "").replace(
"_cs", ""
).replace("_bpb", "").replace("_", "-")
)
prediction_file_path = os.path.join(
"predictions", model_with_data_name + "__" + evaluation_name + ".jsonl"
)
output_file_path = os.path.join(
"evaluations", model_with_data_name + "__" + evaluation_name + ".json"
)
if not os.path.exists(prediction_file_path):
print(
f"The prediction file path {prediction_file_path} doesn't exist yet. "
f"So skipping evaluation for now."
)
continue
command = " ".join(
[
"python",
"evaluate.py",
prediction_file_path,
evaluation_name,
f"--output_file_path {output_file_path}"
]
)
print(command)
subprocess.call(command.split())
if __name__ == "__main__":
main()