arc.py 829 Bytes
Newer Older
1
from . common import HFTask
Leo Gao's avatar
Leo Gao committed
2

3
class ARCEasy(HFTask):
Leo Gao's avatar
Leo Gao committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    NLP_PATH = "ai2_arc"
    NLP_NAME = "ARC-Easy"

    def has_training_docs(self):
        return True

    def has_validation_docs(self):
        return True

    def has_test_docs(self):
        return True

    def fewshot_description(self):
        # TODO: figure out description
        return ""

    def doc_to_text(self, doc, include_target=True):
        q = "Question: " + doc['question'] + '\n'
Leo Gao's avatar
Leo Gao committed
22
        a = "Answer:" + ((" " + doc['choices']['text'][doc['choices']['label'].index(doc['answerKey'])]) if include_target else "")
Leo Gao's avatar
Leo Gao committed
23
24
25
26
27
28
29
30
31
        return q + a

    def evaluate(self, docs, lm, provide_description, num_fewshot):
        # TODO: implement
        raise NotImplementedError()

class ARCChallenge(ARCEasy):
    NLP_PATH = "ai2_arc"
    NLP_NAME = "ARC-Challenge"