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

Jason Phang's avatar
Jason Phang committed
3
4
from . import superglue
from . import glue
Leo Gao's avatar
Leo Gao committed
5
from . import arc
thefazzer's avatar
thefazzer committed
6
from . import coqa
Leo Gao's avatar
Leo Gao committed
7
from . import race
Leo Gao's avatar
Leo Gao committed
8
from . import webqs
Leo Gao's avatar
Leo Gao committed
9
from . import anli
10
from . import wsc273
Charles Foster's avatar
Charles Foster committed
11
from . import winogrande
Charles Foster's avatar
Charles Foster committed
12
from . import quac
Charles Foster's avatar
Charles Foster committed
13
from . import hellaswag
Charles Foster's avatar
Charles Foster committed
14
from . import openbookqa
Charles Foster's avatar
Charles Foster committed
15
from . import squad
16
from . import naturalqs
17
from . import sat
18
from . import arithmetic
Leo Gao's avatar
Leo Gao committed
19
from . import lambada
Jon Tow's avatar
Jon Tow committed
20
from . import race 
Leo Gao's avatar
Leo Gao committed
21
from . import piqa
22
from . import triviaqa
jeffhsu3's avatar
jeffhsu3 committed
23
from . import pubmedqa
24
from . import sciq
25
from . import webqs
26
from . import qa4mre
&'s avatar
& committed
27
from . import translation
28
29
from . import headqa
from . import mathqa
Jason Phang's avatar
gpt3  
Jason Phang committed
30

Jason Phang's avatar
Jason Phang committed
31
TASK_REGISTRY = {
Jason Phang's avatar
multirc  
Jason Phang committed
32
    # GLUE
Jason Phang's avatar
Jason Phang committed
33
34
    "cola": glue.CoLA,
    "mnli": glue.MNLI,
Jason Phang's avatar
Jason Phang committed
35
    "mnli_mismatched": glue.MNLIMismatched,
Jason Phang's avatar
Jason Phang committed
36
37
38
39
    "mrpc": glue.MRPC,
    "rte": glue.RTE,
    "qnli": glue.QNLI,
    "qqp": glue.QQP,
40
    #"stsb": glue.STSB, # not implemented yet
Jason Phang's avatar
Jason Phang committed
41
42
    "sst": glue.SST,
    "wnli": glue.WNLI,
Jason Phang's avatar
multirc  
Jason Phang committed
43
    # SuperGLUE
Jason Phang's avatar
Jason Phang committed
44
    "boolq": superglue.BoolQ,
thefazzer's avatar
thefazzer committed
45
    "cb": superglue.CommitmentBank,
Jason Phang's avatar
Jason Phang committed
46
    "copa": superglue.Copa,
Jason Phang's avatar
multirc  
Jason Phang committed
47
    "multirc": superglue.MultiRC,
Leo Gao's avatar
Leo Gao committed
48
    #"record": superglue.ReCoRD,
Jason Phang's avatar
Jason Phang committed
49
    "wic": superglue.WordsInContext,
Jason Phang's avatar
wsc  
Jason Phang committed
50
    "wsc": superglue.SGWinogradSchemaChallenge,
51
    
Jason Phang's avatar
multirc  
Jason Phang committed
52
    # Order by benchmark/genre?
thefazzer's avatar
thefazzer committed
53
    "coqa": coqa.CoQA,
Leo Gao's avatar
Leo Gao committed
54
    "lambada": lambada.LAMBADA,
Leo Gao's avatar
Leo Gao committed
55
    "piqa": piqa.PiQA,
Leo Gao's avatar
Leo Gao committed
56

57
    # Science related
jeffhsu3's avatar
jeffhsu3 committed
58
    "pubmedqa" : pubmedqa.Pubmed_QA,
59
    "sciq" : sciq.SciQ,
60
61
62
63
    #"qa4mre" : qa4mre.QA4MRE,
    "qa4mre_2011" : qa4mre.QA4MRE_2011,
    "qa4mre_2012" : qa4mre.QA4MRE_2012,
    "qa4mre_2013" : qa4mre.QA4MRE_2013,
jeffhsu3's avatar
jeffhsu3 committed
64

Leo Gao's avatar
Leo Gao committed
65
    #"triviaqa": triviaqa.TriviaQA,
Jonathan Tow's avatar
Jonathan Tow committed
66
67
    "arc_easy": arc.ARCEasy,
    "arc_challenge": arc.ARCChallenge,
68
    # "quac": quac.QuAC, # not implemented yet
69
    "hellaswag": hellaswag.HellaSwag, # not implemented yet
Jon Tow's avatar
Jon Tow committed
70
    "openbookqa": openbookqa.OpenBookQA,
71
72
    # "sat": sat.SATAnalogies, # not implemented yet
    # "squad": squad.SQuAD, # not implemented yet
Jon Tow's avatar
Jon Tow committed
73
    "race": race.RACE,
74
    # "naturalqs": naturalqs.NaturalQs, # not implemented yet
75
76
    "headqa": headqa.HeadQA,
    "mathqa": mathqa.MathQA,
77
    "webqs": webqs.WebQs,
78
    "wsc273": wsc273.WinogradSchemaChallenge273,
79
    "winogrande": winogrande.Winogrande,
Jonathan Tow's avatar
Jonathan Tow committed
80
81
82
    "anli_r1": anli.ANLIRound1,
    "anli_r2": anli.ANLIRound2,
    "anli_r3": anli.ANLIRound3,
83
84
85
86
87
88
89
90
91
92
93
94
    # 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
95
96
    # TODO Perhaps make these groups of tasks
    #   e.g. anli, arithmetic, openai_translations, harness_translations
&'s avatar
...  
& committed
97
98

    # e.g. wmt14-fr-en
&'s avatar
& committed
99
    **translation.create_tasks_from_benchmarks(translation.selected_benchmarks)
Jason Phang's avatar
Jason Phang committed
100
}
Jason Phang's avatar
gpt3  
Jason Phang committed
101
102


Jason Phang's avatar
Jason Phang committed
103
ALL_TASKS = sorted(list(TASK_REGISTRY))
Jason Phang's avatar
Jason Phang committed
104
105


Jason Phang's avatar
cleanup  
Jason Phang committed
106
def get_task(task_name):
&'s avatar
& committed
107
108
109
110
111
112
    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
113
114
115
116
117
118
119


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