SuperGLUE_WSC_ppl_d0f531.py 1.47 KB
Newer Older
yingfhu's avatar
yingfhu 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 WSCDataset_V2

WSC_reader_cfg = dict(
8
9
    input_columns=['span1', 'span2', 'text'],
    output_column='label',
yingfhu's avatar
yingfhu committed
10
11
12
13
14
15
16
17
18
)

WSC_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template={
            'A':
            dict(round=[
                dict(
19
                    role='HUMAN',
yingfhu's avatar
yingfhu committed
20
21
22
23
24
25
26
27
                    prompt=
                    "{text}\nIs '{span1}' and '{span2}' refers to the same entity in the above sentence?"
                ),
                dict(role='BOT', prompt='Yes'),
            ]),
            'B':
            dict(round=[
                dict(
28
                    role='HUMAN',
yingfhu's avatar
yingfhu committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
                    prompt=
                    "{text}\nIs '{span1}' and '{span2}' refers to the same entity in the above sentence?"
                ),
                dict(role='BOT', prompt='No'),
            ]),
        },
    ),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=PPLInferencer),
)

WSC_eval_cfg = dict(evaluator=dict(type=AccEvaluator), )

WSC_datasets = [
    dict(
44
        abbr='WSC',
yingfhu's avatar
yingfhu committed
45
        type=WSCDataset_V2,
46
        path='./data/SuperGLUE/WSC/val.jsonl',
yingfhu's avatar
yingfhu committed
47
48
49
50
51
        reader_cfg=WSC_reader_cfg,
        infer_cfg=WSC_infer_cfg,
        eval_cfg=WSC_eval_cfg,
    )
]