Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Refactor calc_avg.py to define new tasks and implement task retrieval logic
Browse files- calc_avg.py +42 -1
calc_avg.py
CHANGED
@@ -14,7 +14,48 @@ class Task:
|
|
14 |
type: str
|
15 |
baseline: float = 0.0
|
16 |
|
17 |
-
from src.about import Tasks, get_tasks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
g_tasks, mc_tasks, rag_tasks, all_tasks = get_tasks()
|
20 |
|
|
|
14 |
type: str
|
15 |
baseline: float = 0.0
|
16 |
|
17 |
+
# from src.about import Tasks, get_tasks
|
18 |
+
|
19 |
+
class Tasks(Enum):
|
20 |
+
# task_key in the json file, metric_key in the json file, name to display in the leaderboard
|
21 |
+
# task2 = Task("belebele_pol_Latn", "acc,none", "belebele_pol_Latn", "multiple_choice", 0.279)
|
22 |
+
task3 = Task("polemo2_in", "exact_match,score-first", "polemo2-in_g", "generate_until", 0.416)
|
23 |
+
task4 = Task("polemo2_in_multiple_choice", "acc,none", "polemo2-in_mc", "multiple_choice", 0.416)
|
24 |
+
task5 = Task("polemo2_out", "exact_match,score-first", "polemo2-out_g", "generate_until", 0.368)
|
25 |
+
task6 = Task("polemo2_out_multiple_choice", "acc,none", "polemo2-out_mc", "multiple_choice", 0.368)
|
26 |
+
task7 = Task("polish_8tags_multiple_choice", "acc,none", "8tags_mc", "multiple_choice", 0.143)
|
27 |
+
task8 = Task("polish_8tags_regex", "exact_match,score-first", "8tags_g", "generate_until", 0.143)
|
28 |
+
task9a = Task("polish_belebele_mc", "acc,none", "belebele_mc", "multiple_choice", 0.279)
|
29 |
+
task9 = Task("polish_belebele_regex", "exact_match,score-first", "belebele_g", "generate_until", 0.279)
|
30 |
+
task10 = Task("polish_dyk_multiple_choice", "f1,none", "dyk_mc", "multiple_choice", 0.289)
|
31 |
+
task11 = Task("polish_dyk_regex", "f1,score-first", "dyk_g", "generate_until", 0.289)
|
32 |
+
task12 = Task("polish_ppc_multiple_choice", "acc,none", "ppc_mc", "multiple_choice", 0.419)
|
33 |
+
task13 = Task("polish_ppc_regex", "exact_match,score-first", "ppc_g", "generate_until", 0.419)
|
34 |
+
task14 = Task("polish_psc_multiple_choice", "f1,none", "psc_mc", "multiple_choice", 0.466)
|
35 |
+
task15 = Task("polish_psc_regex", "f1,score-first", "psc_g", "generate_until", 0.466)
|
36 |
+
task16 = Task("polish_cbd_multiple_choice", "f1,none", "cbd_mc", "multiple_choice", 0.149)
|
37 |
+
task17 = Task("polish_cbd_regex", "f1,score-first", "cbd_g", "generate_until", 0.149)
|
38 |
+
task18 = Task("polish_klej_ner_multiple_choice", "acc,none", "klej_ner_mc", "multiple_choice", 0.343)
|
39 |
+
task19 = Task("polish_klej_ner_regex", "exact_match,score-first", "klej_ner_g", "generate_until", 0.343)
|
40 |
+
task21 = Task("polish_polqa_reranking_multiple_choice", "acc,none", "polqa_reranking_mc", "multiple_choice", 0.5335588952710677) # multiple_choice
|
41 |
+
task22 = Task("polish_polqa_open_book", "levenshtein,none", "polqa_open_book_g", "generate_until", 0.0) # generate_until
|
42 |
+
task23 = Task("polish_polqa_closed_book", "levenshtein,none", "polqa_closed_book_g", "generate_until", 0.0) # generate_until
|
43 |
+
task24 = Task("polish_poquad_open_book", "levenshtein,none", "poquad_open_book", "generate_until", 0.0)
|
44 |
+
task25 = Task("polish_eq_bench_first_turn", "first_eqbench,none", "eq_bench_first_turn", "generate_until", 0.0)
|
45 |
+
task26 = Task("polish_eq_bench", "average_eqbench,none", "eq_bench", "other", 0.0)
|
46 |
+
task20 = Task("polish_poleval2018_task3_test_10k", "word_perplexity,none", "poleval2018_task3_test_10k", "other")
|
47 |
+
task27 = Task("polish_poquad_reranking", "acc,none", "poquad_reranking", "other", 0.0)
|
48 |
+
task28 = Task("polish_abstractive_poquad_rag", "levenshtein,none", "abstractive_poquad_rag", "other", 0.0)
|
49 |
+
task29 = Task("polish_abstractive_poquad_open_book", "levenshtein,none", "abstractive_poquad_open_book", "other", 0.0)
|
50 |
+
task30 = Task("polish_pes", "exact_match,score-first", "pes", "other", 0.2)
|
51 |
+
|
52 |
+
|
53 |
+
def get_tasks():
|
54 |
+
g_tasks = [task.value.benchmark for task in Tasks if task.value.type == "generate_until"]
|
55 |
+
mc_tasks = [task.value.benchmark for task in Tasks if task.value.type == "multiple_choice"]
|
56 |
+
rag_tasks = ['polish_polqa_reranking_multiple_choice', 'polish_polqa_open_book', 'polish_poquad_open_book']
|
57 |
+
all_tasks = g_tasks + mc_tasks
|
58 |
+
return g_tasks, mc_tasks, rag_tasks, all_tasks
|
59 |
|
60 |
g_tasks, mc_tasks, rag_tasks, all_tasks = get_tasks()
|
61 |
|