__init__.py 5.54 KB
Newer Older
&'s avatar
& committed
1
2
from pprint import pprint

&'s avatar
& committed
3
4
import sacrebleu

Jason Phang's avatar
Jason Phang committed
5
6
from . import superglue
from . import glue
Leo Gao's avatar
Leo Gao committed
7
from . import arc
thefazzer's avatar
thefazzer committed
8
from . import coqa
Leo Gao's avatar
Leo Gao committed
9
from . import race
Leo Gao's avatar
Leo Gao committed
10
from . import webqs
Leo Gao's avatar
Leo Gao committed
11
from . import anli
12
from . import wsc273
Charles Foster's avatar
Charles Foster committed
13
from . import winogrande
Charles Foster's avatar
Charles Foster committed
14
from . import quac
Charles Foster's avatar
Charles Foster committed
15
from . import hellaswag
Charles Foster's avatar
Charles Foster committed
16
from . import openbookqa
Charles Foster's avatar
Charles Foster committed
17
from . import squad
18
from . import naturalqs
19
from . import sat
20
from . import arithmetic
Leo Gao's avatar
Leo Gao committed
21
from . import lambada
Jon Tow's avatar
Jon Tow committed
22
from . import race
Leo Gao's avatar
Leo Gao committed
23
from . import piqa
24
from . import triviaqa
jeffhsu3's avatar
jeffhsu3 committed
25
from . import pubmedqa
26
from . import sciq
27
from . import webqs
28
from . import qa4mre
&'s avatar
& committed
29
from . import translation
30
31
from . import headqa
from . import mathqa
Leo Gao's avatar
Leo Gao committed
32
from . import hendrycks_ethics
Jon Tow's avatar
Jon Tow committed
33
from . import drop
34
from . import unscramble
35
from . import logiqa
Andy Zou's avatar
Andy Zou committed
36
from . import hendrycks_test
Leo Gao's avatar
Leo Gao committed
37
from . import hendrycks_math
38
from . import cbt
39
from . import lambada_cloze
Jason Phang's avatar
gpt3  
Jason Phang committed
40

&'s avatar
& committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
########################################
# Translation tasks
########################################

# 6 total
gpt3_translation_benchmarks = {
    "wmt14": ['en-fr', 'fr-en'],  # French
    "wmt16": ['en-ro', 'ro-en', 'de-en', 'en-de'],  # German, Romanian
}


# 28 total
selected_translation_benchmarks = {
    **gpt3_translation_benchmarks,
    "wmt20": sacrebleu.get_langpairs_for_testset("wmt20"),
    "iwslt17": ['en-ar', 'ar-en']  # Arabic
}

# 319 total
all_translation_benchmarks = {
    ts: sacrebleu.get_langpairs_for_testset(ts)
    for ts in sacrebleu.get_available_testsets()
}


########################################
# All tasks
########################################


Jason Phang's avatar
Jason Phang committed
71
TASK_REGISTRY = {
Jason Phang's avatar
multirc  
Jason Phang committed
72
    # GLUE
Jason Phang's avatar
Jason Phang committed
73
74
    "cola": glue.CoLA,
    "mnli": glue.MNLI,
Jason Phang's avatar
Jason Phang committed
75
    "mnli_mismatched": glue.MNLIMismatched,
Jason Phang's avatar
Jason Phang committed
76
77
78
79
    "mrpc": glue.MRPC,
    "rte": glue.RTE,
    "qnli": glue.QNLI,
    "qqp": glue.QQP,
80
    #"stsb": glue.STSB, # not implemented yet
Jason Phang's avatar
Jason Phang committed
81
82
    "sst": glue.SST,
    "wnli": glue.WNLI,
Jason Phang's avatar
multirc  
Jason Phang committed
83
    # SuperGLUE
Jason Phang's avatar
Jason Phang committed
84
    "boolq": superglue.BoolQ,
thefazzer's avatar
thefazzer committed
85
    "cb": superglue.CommitmentBank,
Jason Phang's avatar
Jason Phang committed
86
    "copa": superglue.Copa,
Jason Phang's avatar
multirc  
Jason Phang committed
87
    "multirc": superglue.MultiRC,
Jason Phang's avatar
Jason Phang committed
88
    "record": superglue.ReCoRD,
Jason Phang's avatar
Jason Phang committed
89
    "wic": superglue.WordsInContext,
Jason Phang's avatar
wsc  
Jason Phang committed
90
    "wsc": superglue.SGWinogradSchemaChallenge,
91
    
Jason Phang's avatar
multirc  
Jason Phang committed
92
    # Order by benchmark/genre?
thefazzer's avatar
thefazzer committed
93
    "coqa": coqa.CoQA,
Jon Tow's avatar
Jon Tow committed
94
    "drop": drop.DROP,
Leo Gao's avatar
Leo Gao committed
95
    "lambada": lambada.LAMBADA,
96
    "lambada_cloze": lambada_cloze.LAMBADA_cloze,
97
98
    "cbt-cn": cbt.CBTCN,
    "cbt-ne": cbt.CBTNE,
99

Leo Gao's avatar
Leo Gao committed
100
    "piqa": piqa.PiQA,
Leo Gao's avatar
Leo Gao committed
101

102
    # Science related
jeffhsu3's avatar
jeffhsu3 committed
103
    "pubmedqa" : pubmedqa.Pubmed_QA,
104
    "sciq" : sciq.SciQ,
105
106
107
108
    #"qa4mre" : qa4mre.QA4MRE,
    "qa4mre_2011" : qa4mre.QA4MRE_2011,
    "qa4mre_2012" : qa4mre.QA4MRE_2012,
    "qa4mre_2013" : qa4mre.QA4MRE_2013,
jeffhsu3's avatar
jeffhsu3 committed
109

110
    "triviaqa": triviaqa.TriviaQA,
Jonathan Tow's avatar
Jonathan Tow committed
111
112
    "arc_easy": arc.ARCEasy,
    "arc_challenge": arc.ARCChallenge,
113
    # "quac": quac.QuAC, # not implemented yet
114
    "logiqa": logiqa.LogiQA,
115
    "hellaswag": hellaswag.HellaSwag, # not implemented yet
Jon Tow's avatar
Jon Tow committed
116
    "openbookqa": openbookqa.OpenBookQA,
117
    # "sat": sat.SATAnalogies, # not implemented yet
Leo Gao's avatar
Leo Gao committed
118
    "squad2": squad.SQuAD2,
Jon Tow's avatar
Jon Tow committed
119
    "race": race.RACE,
120
    # "naturalqs": naturalqs.NaturalQs, # not implemented yet
121
122
    "headqa": headqa.HeadQA,
    "mathqa": mathqa.MathQA,
123
    "webqs": webqs.WebQs,
124
    "wsc273": wsc273.WinogradSchemaChallenge273,
125
    "winogrande": winogrande.Winogrande,
Jonathan Tow's avatar
Jonathan Tow committed
126
127
128
    "anli_r1": anli.ANLIRound1,
    "anli_r2": anli.ANLIRound2,
    "anli_r3": anli.ANLIRound3,
Muennighoff's avatar
Muennighoff committed
129

Leo Gao's avatar
Leo Gao committed
130
131
132
133
134
135
    "ethics_cm": hendrycks_ethics.EthicsCM,
    "ethics_deontology": hendrycks_ethics.EthicsDeontology,
    "ethics_justice": hendrycks_ethics.EthicsJustice,
    "ethics_utilitarianism_original": hendrycks_ethics.EthicsUtilitarianismOriginal,
    "ethics_utilitarianism": hendrycks_ethics.EthicsUtilitarianism,
    "ethics_virtue": hendrycks_ethics.EthicsVirtue,
Muennighoff's avatar
Muennighoff committed
136

Eric Tang's avatar
Eric Tang committed
137
    # math
Leo Gao's avatar
Leo Gao committed
138
139
140
141
142
143
144
    "math_algebra": hendrycks_math.MathAlgebra,
    "math_counting_and_prob": hendrycks_math.MathCountingAndProbability,
    "math_geometry": hendrycks_math.MathGeometry,
    "math_intermediate_algebra": hendrycks_math.MathIntermediateAlgebra,
    "math_num_theory": hendrycks_math.MathNumberTheory,
    "math_prealgebra": hendrycks_math.MathPrealgebra,
    "math_precalc": hendrycks_math.MathPrecalculus,
Eric Tang's avatar
Eric Tang committed
145

146
147
148
149
150
151
152
153
154
155
156
    # arithmetic
    "arithmetic_2da": arithmetic.Arithmetic2DPlus,
    "arithmetic_2ds": arithmetic.Arithmetic2DMinus,
    "arithmetic_3da": arithmetic.Arithmetic3DPlus,
    "arithmetic_3ds": arithmetic.Arithmetic3DMinus,
    "arithmetic_4da": arithmetic.Arithmetic4DPlus,
    "arithmetic_4ds": arithmetic.Arithmetic4DMinus,
    "arithmetic_5da": arithmetic.Arithmetic5DPlus,
    "arithmetic_5ds": arithmetic.Arithmetic5DMinus,
    "arithmetic_2dm": arithmetic.Arithmetic2DMultiplication,
    "arithmetic_1dc": arithmetic.Arithmetic1DComposite,
&'s avatar
& committed
157
158
    # TODO Perhaps make these groups of tasks
    #   e.g. anli, arithmetic, openai_translations, harness_translations
&'s avatar
...  
& committed
159

Andy Zou's avatar
Andy Zou committed
160
    # hendrycksTest (57 tasks)
Andy Zou's avatar
Andy Zou committed
161
    **hendrycks_test.create_all_tasks(),
Andy Zou's avatar
Andy Zou committed
162

&'s avatar
...  
& committed
163
    # e.g. wmt14-fr-en
&'s avatar
& committed
164
165
166
    **translation.create_tasks_from_benchmarks(gpt3_translation_benchmarks),
    # chef's selection, mostly wmt20
    **translation.create_tasks_from_benchmarks(selected_translation_benchmarks),
Jon Tow's avatar
Jon Tow committed
167
168

    # Word Scrambling and Manipulation Tasks
169
170
171
172
173
    "anagrams1": unscramble.Anagrams1,
    "anagrams2": unscramble.Anagrams2,
    "cycle_letters": unscramble.CycleLetters,
    "random_insertion": unscramble.RandomInsertion,
    "reversed_words": unscramble.ReversedWords,
Jason Phang's avatar
Jason Phang committed
174
}
Jason Phang's avatar
gpt3  
Jason Phang committed
175
176


Jason Phang's avatar
Jason Phang committed
177
ALL_TASKS = sorted(list(TASK_REGISTRY))
Jason Phang's avatar
Jason Phang committed
178
179


Jason Phang's avatar
cleanup  
Jason Phang committed
180
def get_task(task_name):
&'s avatar
& committed
181
182
183
184
185
186
    try:
        return TASK_REGISTRY[task_name]
    except KeyError as e:
        print("Available tasks:")
        pprint(TASK_REGISTRY)
        raise KeyError(f"Missing task {task_name}")
Jason Phang's avatar
cleanup  
Jason Phang committed
187
188
189
190
191
192
193


def get_task_dict(task_name_list):
    return {
        task_name: get_task(task_name)()
        for task_name in task_name_list
    }