"official/nlp/modeling/layers/reuse_attention.py" did not exist on "a241b9ae1320152b9eba2ceda1c362fab4f213fc"
prost.py 1.96 KB
Newer Older
Jonathan Tow's avatar
Jonathan Tow committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
PROST: Physical Reasoning about Objects Through Space and Time
https://arxiv.org/pdf/2106.03634.pdf

NOTE: PROST is limited to the zero-shot setting to adhere to authors' intentions
as discussed in section 7 of the paper: "We hope that the community will use
this dataset in the intended way: in a zero-shot setting to probe models which
have been trained on data not specifically collected to succeed on PROST."

# TODO: Update citation when it is made available at https://github.com/nala-cub/prost.
@misc{arocaouellette2021prost,
      title={PROST: Physical Reasoning of Objects through Space and Time}, 
      author={Stéphane Aroca-Ouellette and Cory Paik and Alessandro Roncone and Katharina Kann},
      year={2021},
      eprint={2106.03634},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
"""

from lm_eval.base import MultipleChoiceTask
from . common import HFTask
23
from lm_eval.mctask_experimental import MultipleChoiceDoc
Jonathan Tow's avatar
Jonathan Tow committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39


class PROST(HFTask, MultipleChoiceTask):
    VERSION = 0
    DATASET_PATH = "corypaik/prost"
    DATASET_NAME = None

    def has_training_docs(self):
        return False

    def has_validation_docs(self):
        return False

    def has_test_docs(self):
        return True

40
    def fewshot_context(self, doc, num_fewshot, provide_description=None, rnd=None, description=None):
Jonathan Tow's avatar
Jonathan Tow committed
41
        assert num_fewshot == 0, 'PROST is designed to probe models in a zero-shot fashion only.'
42
43
44
45
46
47
        return super().fewshot_context(
            doc=doc,
            num_fewshot=num_fewshot,
            rnd=rnd,
            description=description
        )
Jonathan Tow's avatar
Jonathan Tow committed
48
49

    def _convert_standard(self, doc):
50
51
52
53
54
55
56
57
58
59
60
61
        question = doc['ex_question']
        options = [doc['A'], doc['B'], doc['C'], doc['D']]
        gold = doc["label"]
        keys = ["A","B","C","D"]
        context = doc['context']
        return MultipleChoiceDoc(
            question=question,
            options=options,
            gold=gold,
            keys=keys,
            context=context
        )