arc.py 931 Bytes
Newer Older
Leo Gao's avatar
Leo Gao committed
1
2
# REMINDER: this code needs to be rewritten for the new framework. Remove this comment when the code is fully converted.

3
from . common import HFTask
Leo Gao's avatar
Leo Gao committed
4

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

    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 ""

22
23
24
25
26
    def doc_to_text(self, doc):
        return "Question: " + doc['question'] + '\nAnswer:'

    def doc_to_target(self, doc):
        return " " + doc['choices']['text'][doc['choices']['label'].index(doc['answerKey'])]
Leo Gao's avatar
Leo Gao committed
27
28
29
30
31
32

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

class ARCChallenge(ARCEasy):
Leo Gao's avatar
Leo Gao committed
33
34
    DATASET_PATH = "ai2_arc"
    DATASET_NAME = "ARC-Challenge"