SuperGLUE_RTE_ppl_66caf3.py 1.54 KB
Newer Older
gaotongxiao's avatar
gaotongxiao committed
1
2
3
4
5
6
7
from opencompass.openicl.icl_prompt_template import PromptTemplate
from opencompass.openicl.icl_retriever import ZeroRetriever
from opencompass.openicl.icl_inferencer import PPLInferencer
from opencompass.openicl.icl_evaluator import AccEvaluator
from opencompass.datasets import HFDataset

RTE_reader_cfg = dict(
8
9
10
    input_columns=['hypothesis', 'premise'],
    output_column='label',
    test_split='train')
gaotongxiao's avatar
gaotongxiao committed
11
12
13
14
15

RTE_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template={
16
            'entailment':
gaotongxiao's avatar
gaotongxiao committed
17
18
            dict(round=[
                dict(
19
                    role='HUMAN',
gaotongxiao's avatar
gaotongxiao committed
20
                    prompt=
21
                    '{premise}\n{hypothesis}\nIs the sentence below entailed by the sentence above?'
gaotongxiao's avatar
gaotongxiao committed
22
                ),
23
                dict(role='BOT', prompt='Yes'),
gaotongxiao's avatar
gaotongxiao committed
24
            ]),
25
            'not_entailment':
gaotongxiao's avatar
gaotongxiao committed
26
27
            dict(round=[
                dict(
28
                    role='HUMAN',
gaotongxiao's avatar
gaotongxiao committed
29
                    prompt=
30
                    '{premise}\n{hypothesis}\nIs the sentence below entailed by the sentence above?'
gaotongxiao's avatar
gaotongxiao committed
31
                ),
32
                dict(role='BOT', prompt='No'),
gaotongxiao's avatar
gaotongxiao committed
33
34
35
36
37
38
39
40
41
42
43
44
            ])
        },
    ),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=PPLInferencer),
)

RTE_eval_cfg = dict(evaluator=dict(type=AccEvaluator))

RTE_datasets = [
    dict(
        type=HFDataset,
45
46
47
48
        abbr='RTE',
        path='json',
        data_files='./data/SuperGLUE/RTE/val.jsonl',
        split='train',
gaotongxiao's avatar
gaotongxiao committed
49
50
51
52
53
        reader_cfg=RTE_reader_cfg,
        infer_cfg=RTE_infer_cfg,
        eval_cfg=RTE_eval_cfg,
    )
]