"ml/nn/rope/options.go" did not exist on "bb71654ebe846d97df306b163c086167239431e5"
winogrande_5shot_gen_6447e6.py 1.41 KB
Newer Older
Fengzhe Zhou's avatar
Fengzhe Zhou committed
1
2
3
4
5
6
7
8
from opencompass.openicl.icl_prompt_template import PromptTemplate
from opencompass.openicl.icl_retriever import FixKRetriever
from opencompass.openicl.icl_inferencer import GenInferencer
from opencompass.openicl.icl_evaluator import AccEvaluator
from opencompass.datasets import winograndeDataset_V3
from opencompass.utils.text_postprocessors import first_option_postprocess

winogrande_reader_cfg = dict(
9
10
11
12
    input_columns=['opt1', 'opt2'],
    output_column='answer',
    train_split='train_xs',
    test_split='dev',
Fengzhe Zhou's avatar
Fengzhe Zhou committed
13
14
15
16
17
18
)

winogrande_infer_cfg = dict(
    ice_template=dict(
        type=PromptTemplate,
        template=dict(
19
            begin='</E>',
Fengzhe Zhou's avatar
Fengzhe Zhou committed
20
            round=[
21
22
                dict(role='HUMAN', prompt='Which of the following is a good sentence:\nA. {opt1}\nB. {opt2}\nAnswer:'),
                dict(role='BOT', prompt='{answer}'),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
23
24
            ]
        ),
25
        ice_token='</E>',
Fengzhe Zhou's avatar
Fengzhe Zhou committed
26
27
28
29
30
31
32
    ),
    retriever=dict(type=FixKRetriever, fix_id_list=[0, 2, 4, 6, 8]),
    inferencer=dict(type=GenInferencer),
)

winogrande_eval_cfg = dict(
    evaluator=dict(type=AccEvaluator),
33
34
    pred_role='BOT',
    pred_postprocessor=dict(type=first_option_postprocess, options='AB'),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
35
36
37
38
)

winogrande_datasets = [
    dict(
39
        abbr='winogrande',
Fengzhe Zhou's avatar
Fengzhe Zhou committed
40
        type=winograndeDataset_V3,
41
        path='./data/winogrande',
Fengzhe Zhou's avatar
Fengzhe Zhou committed
42
43
44
45
46
        reader_cfg=winogrande_reader_cfg,
        infer_cfg=winogrande_infer_cfg,
        eval_cfg=winogrande_eval_cfg,
    )
]