__init__.py 12.8 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
Jonathan Tow's avatar
Jonathan Tow committed
24
from . import prost
Jonathan Tow's avatar
Jonathan Tow committed
25
from . import mc_taco
26
from . import triviaqa
jeffhsu3's avatar
jeffhsu3 committed
27
from . import pubmedqa
28
from . import sciq
29
from . import webqs
30
from . import qa4mre
&'s avatar
& committed
31
from . import translation
32
33
from . import headqa
from . import mathqa
Leo Gao's avatar
Leo Gao committed
34
from . import hendrycks_ethics
Jon Tow's avatar
Jon Tow committed
35
from . import drop
36
from . import unscramble
37
from . import logiqa
Andy Zou's avatar
Andy Zou committed
38
from . import hendrycks_test
Leo Gao's avatar
Leo Gao committed
39
from . import hendrycks_math
40
from . import cbt
41
from . import lambada_cloze
Jason Phang's avatar
Jason Phang committed
42
from . import pile
Leo Gao's avatar
Leo Gao committed
43
from . import wikitext
sdtblck's avatar
sdtblck committed
44
from . import xquad
sdtblck's avatar
sdtblck committed
45
from . import mlqa
sdtblck's avatar
sdtblck committed
46
from . import lambada_multilingual
Jonathan Tow's avatar
Jonathan Tow committed
47
from . import mutual
48
from . import truthfulqa
Igor Ostrovsky's avatar
Igor Ostrovsky committed
49
from . import blimp
rokosbasilisk's avatar
rokosbasilisk committed
50
from . import asdiv
Jason Phang's avatar
gpt3  
Jason Phang committed
51

&'s avatar
& committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
########################################
# 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
82
TASK_REGISTRY = {
Jason Phang's avatar
multirc  
Jason Phang committed
83
    # GLUE
Jason Phang's avatar
Jason Phang committed
84
85
    "cola": glue.CoLA,
    "mnli": glue.MNLI,
Jason Phang's avatar
Jason Phang committed
86
    "mnli_mismatched": glue.MNLIMismatched,
Jason Phang's avatar
Jason Phang committed
87
88
89
90
    "mrpc": glue.MRPC,
    "rte": glue.RTE,
    "qnli": glue.QNLI,
    "qqp": glue.QQP,
91
    #"stsb": glue.STSB, # not implemented yet
Jason Phang's avatar
Jason Phang committed
92
93
    "sst": glue.SST,
    "wnli": glue.WNLI,
Jason Phang's avatar
multirc  
Jason Phang committed
94
    # SuperGLUE
Jason Phang's avatar
Jason Phang committed
95
    "boolq": superglue.BoolQ,
thefazzer's avatar
thefazzer committed
96
    "cb": superglue.CommitmentBank,
Jason Phang's avatar
Jason Phang committed
97
    "copa": superglue.Copa,
Jason Phang's avatar
multirc  
Jason Phang committed
98
    "multirc": superglue.MultiRC,
Jason Phang's avatar
Jason Phang committed
99
    "record": superglue.ReCoRD,
Jason Phang's avatar
Jason Phang committed
100
    "wic": superglue.WordsInContext,
Jason Phang's avatar
wsc  
Jason Phang committed
101
    "wsc": superglue.SGWinogradSchemaChallenge,
102
    
Jason Phang's avatar
multirc  
Jason Phang committed
103
    # Order by benchmark/genre?
thefazzer's avatar
thefazzer committed
104
    "coqa": coqa.CoQA,
Jon Tow's avatar
Jon Tow committed
105
    "drop": drop.DROP,
Leo Gao's avatar
Leo Gao committed
106
    "lambada": lambada.LAMBADA,
107
    "lambada_cloze": lambada_cloze.LAMBADA_cloze,
sdtblck's avatar
sdtblck committed
108
    
109
    # multilingual lambada
sdtblck's avatar
sdtblck committed
110
    **lambada_multilingual.construct_tasks(),
sdtblck's avatar
sdtblck committed
111

Leo Gao's avatar
Leo Gao committed
112
    "wikitext": wikitext.WikiText,
Leo Gao's avatar
Leo Gao committed
113
114
    # "cbt-cn": cbt.CBTCN, # disabled pending context length fix
    # "cbt-ne": cbt.CBTNE, # disabled pending context length fix
115

Leo Gao's avatar
Leo Gao committed
116
    "piqa": piqa.PiQA,
Jonathan Tow's avatar
Jonathan Tow committed
117
    "prost": prost.PROST,
Jonathan Tow's avatar
Jonathan Tow committed
118
    "mc_taco": mc_taco.MCTACO,
Leo Gao's avatar
Leo Gao committed
119

120
    # Science related
jeffhsu3's avatar
jeffhsu3 committed
121
    "pubmedqa" : pubmedqa.Pubmed_QA,
122
    "sciq" : sciq.SciQ,
123

124
125
126
    "qa4mre_2011" : qa4mre.QA4MRE_2011,
    "qa4mre_2012" : qa4mre.QA4MRE_2012,
    "qa4mre_2013" : qa4mre.QA4MRE_2013,
jeffhsu3's avatar
jeffhsu3 committed
127

Leo Gao's avatar
Leo Gao committed
128
    "triviaqa": triviaqa.TriviaQA,
Jonathan Tow's avatar
Jonathan Tow committed
129
130
    "arc_easy": arc.ARCEasy,
    "arc_challenge": arc.ARCChallenge,
131
    # "quac": quac.QuAC, # not implemented yet
132
    "logiqa": logiqa.LogiQA,
Leo Gao's avatar
Leo Gao committed
133
    "hellaswag": hellaswag.HellaSwag,
Jon Tow's avatar
Jon Tow committed
134
    "openbookqa": openbookqa.OpenBookQA,
135
    # "sat": sat.SATAnalogies, # not implemented yet
Leo Gao's avatar
Leo Gao committed
136
    "squad2": squad.SQuAD2,
sdtblck's avatar
sdtblck committed
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

    # xquad tasks
    "xquad_ar": xquad.XQuADAr,
    "xquad_de": xquad.XQuADDe,
    "xquad_zh": xquad.XQuADZh,
    "xquad_vi": xquad.XQuADVi,
    "xquad_en": xquad.XQuADEn,
    "xquad_es": xquad.XQuADEs,
    "xquad_hi": xquad.XQuADHi,
    "xquad_el": xquad.XQuADEl,
    "xquad_th": xquad.XQuADTh,
    "xquad_tr": xquad.XQuADTr,
    "xquad_ru": xquad.XQuADRu,
    "xquad_ro": xquad.XQuADRo,

sdtblck's avatar
sdtblck committed
152
153
154
    # MLQA tasks
    **mlqa.construct_tasks(),

Jon Tow's avatar
Jon Tow committed
155
    "race": race.RACE,
156
    # "naturalqs": naturalqs.NaturalQs, # not implemented yet
157
    "headqa": headqa.HeadQAEsDeprecated, # for backwards compat - headqa used to default to es
158
159
    "headqa_es": headqa.HeadQAEs,
    "headqa_en": headqa.HeadQAEn,
160
    "mathqa": mathqa.MathQA,
161
    "webqs": webqs.WebQs,
162
    "wsc273": wsc273.WinogradSchemaChallenge273,
163
    "winogrande": winogrande.Winogrande,
Jonathan Tow's avatar
Jonathan Tow committed
164
165
166
    "anli_r1": anli.ANLIRound1,
    "anli_r2": anli.ANLIRound2,
    "anli_r3": anli.ANLIRound3,
Muennighoff's avatar
Muennighoff committed
167

Leo Gao's avatar
Leo Gao committed
168
169
170
171
172
173
    "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
174

175
176
     "truthfulqa_mc": truthfulqa.TruthfulQAMultipleChoice,
     "truthfulqa_gen": truthfulqa.TruthfulQAGeneration,
Jonathan Tow's avatar
Jonathan Tow committed
177

Jonathan Tow's avatar
Jonathan Tow committed
178
179
180
181
    # dialogue
    "mutual": mutual.MuTual,
    "mutual_plus": mutual.MuTualPlus,

Eric Tang's avatar
Eric Tang committed
182
    # math
Leo Gao's avatar
Leo Gao committed
183
184
185
186
187
188
189
    "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,
rokosbasilisk's avatar
rokosbasilisk committed
190
    "math_asdiv": asdiv.Asdiv,
Eric Tang's avatar
Eric Tang committed
191

192
193
194
195
196
197
198
199
200
201
202
    # 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
203
204
    # TODO Perhaps make these groups of tasks
    #   e.g. anli, arithmetic, openai_translations, harness_translations
&'s avatar
...  
& committed
205

Andy Zou's avatar
Andy Zou committed
206
    # hendrycksTest (57 tasks)
Andy Zou's avatar
Andy Zou committed
207
    **hendrycks_test.create_all_tasks(),
Andy Zou's avatar
Andy Zou committed
208

&'s avatar
...  
& committed
209
    # e.g. wmt14-fr-en
&'s avatar
& committed
210
211
212
    **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
213
214

    # Word Scrambling and Manipulation Tasks
215
216
217
218
219
    "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
220
221

    # Pile
Leo Gao's avatar
Leo Gao committed
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
    "pile_arxiv": pile.PileArxiv,
    "pile_books3": pile.PileBooks3,
    "pile_bookcorpus2": pile.PileBookCorpus2,
    "pile_dm-mathematics": pile.PileDmMathematics,
    "pile_enron": pile.PileEnron,
    "pile_europarl": pile.PileEuroparl,
    "pile_freelaw": pile.PileFreeLaw,
    "pile_github": pile.PileGithub,
    "pile_gutenberg": pile.PileGutenberg,
    "pile_hackernews": pile.PileHackernews,
    "pile_nih-exporter": pile.PileNIHExporter,
    "pile_opensubtitles": pile.PileOpenSubtitles,
    "pile_openwebtext2": pile.PileOpenWebText2,
    "pile_philpapers": pile.PilePhilPapers,
    "pile_pile-cc": pile.PilePileCc,
    "pile_pubmed-abstracts": pile.PilePubmedAbstracts,
    "pile_pubmed-central": pile.PilePubmedCentral,
    "pile_stackexchange": pile.PileStackExchange,
    "pile_uspto": pile.PileUspto,
    "pile_ubuntu-irc": pile.PileUbuntuIrc,
    "pile_wikipedia": pile.PileWikipedia,
    "pile_youtubesubtitles": pile.PileYoutubeSubtitles,
sdtblck's avatar
sdtblck committed
244
    
Igor Ostrovsky's avatar
Igor Ostrovsky committed
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
    # BLiMP
    "blimp_adjunct_island": blimp.BlimpAdjunctIsland,
    "blimp_anaphor_gender_agreement": blimp.BlimpAnaphorGenderAgreement,
    "blimp_anaphor_number_agreement": blimp.BlimpAnaphorNumberAgreement,
    "blimp_animate_subject_passive": blimp.BlimpAnimateSubjectPassive,
    "blimp_animate_subject_trans": blimp.BlimpAnimateSubjectTrans,
    "blimp_causative": blimp.BlimpCausative,
    "blimp_complex_NP_island": blimp.BlimpComplex_NPIsland,
    "blimp_coordinate_structure_constraint_complex_left_branch": blimp.BlimpCoordinateStructureConstraintComplexLeftBranch,
    "blimp_coordinate_structure_constraint_object_extraction": blimp.BlimpCoordinateStructureConstraintObjectExtraction,
    "blimp_determiner_noun_agreement_1": blimp.BlimpDeterminerNounAgreement_1,
    "blimp_determiner_noun_agreement_2": blimp.BlimpDeterminerNounAgreement_2,
    "blimp_determiner_noun_agreement_irregular_1": blimp.BlimpDeterminerNounAgreementIrregular_1,
    "blimp_determiner_noun_agreement_irregular_2": blimp.BlimpDeterminerNounAgreementIrregular_2,
    "blimp_determiner_noun_agreement_with_adj_2": blimp.BlimpDeterminerNounAgreementWithAdj_2,
    "blimp_determiner_noun_agreement_with_adj_irregular_1": blimp.BlimpDeterminerNounAgreementWithAdjIrregular_1,
    "blimp_determiner_noun_agreement_with_adj_irregular_2": blimp.BlimpDeterminerNounAgreementWithAdjIrregular_2,
    "blimp_determiner_noun_agreement_with_adjective_1": blimp.BlimpDeterminerNounAgreementWithAdjective_1,
    "blimp_distractor_agreement_relational_noun": blimp.BlimpDistractorAgreementRelationalNoun,
    "blimp_distractor_agreement_relative_clause": blimp.BlimpDistractorAgreementRelativeClause,
    "blimp_drop_argument": blimp.BlimpDropArgument,
    "blimp_ellipsis_n_bar_1": blimp.BlimpEllipsisNBar_1,
    "blimp_ellipsis_n_bar_2": blimp.BlimpEllipsisNBar_2,
    "blimp_existential_there_object_raising": blimp.BlimpExistentialThereObjectRaising,
    "blimp_existential_there_quantifiers_1": blimp.BlimpExistentialThereQuantifiers_1,
    "blimp_existential_there_quantifiers_2": blimp.BlimpExistentialThereQuantifiers_2,
    "blimp_existential_there_subject_raising": blimp.BlimpExistentialThereSubjectRaising,
    "blimp_expletive_it_object_raising": blimp.BlimpExpletiveItObjectRaising,
    "blimp_inchoative": blimp.BlimpInchoative,
    "blimp_intransitive": blimp.BlimpIntransitive,
    "blimp_irregular_past_participle_adjectives": blimp.BlimpIrregularPastParticipleAdjectives,
    "blimp_irregular_past_participle_verbs": blimp.BlimpIrregularPastParticipleVerbs,
    "blimp_irregular_plural_subject_verb_agreement_1": blimp.BlimpIrregularPluralSubjectVerbAgreement_1,
    "blimp_irregular_plural_subject_verb_agreement_2": blimp.BlimpIrregularPluralSubjectVerbAgreement_2,
    "blimp_left_branch_island_echo_question": blimp.BlimpLeftBranchIslandEchoQuestion,
    "blimp_left_branch_island_simple_question": blimp.BlimpLeftBranchIslandSimpleQuestion,
    "blimp_matrix_question_npi_licensor_present": blimp.BlimpMatrixQuestionNpiLicensorPresent,
    "blimp_npi_present_1": blimp.BlimpNpiPresent_1,
    "blimp_npi_present_2": blimp.BlimpNpiPresent_2,
    "blimp_only_npi_licensor_present": blimp.BlimpOnlyNpiLicensorPresent,
    "blimp_only_npi_scope": blimp.BlimpOnlyNpiScope,
    "blimp_passive_1": blimp.BlimpPassive_1,
    "blimp_passive_2": blimp.BlimpPassive_2,
    "blimp_principle_A_c_command": blimp.BlimpPrinciple_ACCommand,
    "blimp_principle_A_case_1": blimp.BlimpPrinciple_ACase_1,
    "blimp_principle_A_case_2": blimp.BlimpPrinciple_ACase_2,
    "blimp_principle_A_domain_1": blimp.BlimpPrinciple_ADomain_1,
    "blimp_principle_A_domain_2": blimp.BlimpPrinciple_ADomain_2,
    "blimp_principle_A_domain_3": blimp.BlimpPrinciple_ADomain_3,
    "blimp_principle_A_reconstruction": blimp.BlimpPrinciple_AReconstruction,
    "blimp_regular_plural_subject_verb_agreement_1": blimp.BlimpRegularPluralSubjectVerbAgreement_1,
    "blimp_regular_plural_subject_verb_agreement_2": blimp.BlimpRegularPluralSubjectVerbAgreement_2,
    "blimp_sentential_negation_npi_licensor_present": blimp.BlimpSententialNegationNpiLicensorPresent,
    "blimp_sentential_negation_npi_scope": blimp.BlimpSententialNegationNpiScope,
    "blimp_sentential_subject_island": blimp.BlimpSententialSubjectIsland,
    "blimp_superlative_quantifiers_1": blimp.BlimpSuperlativeQuantifiers_1,
    "blimp_superlative_quantifiers_2": blimp.BlimpSuperlativeQuantifiers_2,
    "blimp_tough_vs_raising_1": blimp.BlimpToughVsRaising_1,
    "blimp_tough_vs_raising_2": blimp.BlimpToughVsRaising_2,
    "blimp_transitive": blimp.BlimpTransitive,
    "blimp_wh_island": blimp.BlimpWhIsland,
    "blimp_wh_questions_object_gap": blimp.BlimpWhQuestionsObjectGap,
    "blimp_wh_questions_subject_gap": blimp.BlimpWhQuestionsSubjectGap,
    "blimp_wh_questions_subject_gap_long_distance": blimp.BlimpWhQuestionsSubjectGapLongDistance,
    "blimp_wh_vs_that_no_gap": blimp.BlimpWhVsThatNoGap,
    "blimp_wh_vs_that_no_gap_long_distance": blimp.BlimpWhVsThatNoGapLongDistance,
    "blimp_wh_vs_that_with_gap": blimp.BlimpWhVsThatWithGap,
    "blimp_wh_vs_that_with_gap_long_distance": blimp.BlimpWhVsThatWithGapLongDistance,
Jason Phang's avatar
Jason Phang committed
313
}
Jason Phang's avatar
gpt3  
Jason Phang committed
314
315


Jason Phang's avatar
Jason Phang committed
316
ALL_TASKS = sorted(list(TASK_REGISTRY))
Jason Phang's avatar
Jason Phang committed
317
318


Jason Phang's avatar
cleanup  
Jason Phang committed
319
def get_task(task_name):
&'s avatar
& committed
320
321
322
323
324
325
    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
326
327
328
329
330
331
332


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