"ts/nni_manager/training_service/reusable/commandChannel.ts" did not exist on "93f96d4f747f03ef3a84ee9d39fa61251418ec3b"
winogrande_gen_a9ede5.py 1.31 KB
Newer Older
gaotongxiao's avatar
gaotongxiao committed
1
2
3
4
5
from opencompass.openicl.icl_prompt_template import PromptTemplate
from opencompass.openicl.icl_retriever import ZeroRetriever
from opencompass.openicl.icl_inferencer import GenInferencer
from opencompass.openicl.icl_evaluator import AccEvaluator
from opencompass.datasets import winograndeDataset_V2
6
from opencompass.utils.text_postprocessors import first_option_postprocess
gaotongxiao's avatar
gaotongxiao committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

winogrande_reader_cfg = dict(
    input_columns=["opt1", "opt2"],
    output_column="label",
    test_split="validation")

winogrande_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template=dict(round=[
            dict(
                role="HUMAN",
                prompt=
                "Which of the following is a good sentence:\nA. {opt1}\nB. {opt2}\nAnswer:"
            ),
        ]),
    ),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=GenInferencer),
)

winogrande_eval_cfg = dict(
    evaluator=dict(type=AccEvaluator),
    pred_role="BOT",
31
    pred_postprocessor=dict(type=first_option_postprocess, options='AB'),
gaotongxiao's avatar
gaotongxiao committed
32
33
34
35
36
37
38
39
40
41
42
43
44
)

winogrande_datasets = [
    dict(
        abbr="winogrande",
        type=winograndeDataset_V2,
        path="winogrande",
        name="winogrande_xs",
        reader_cfg=winogrande_reader_cfg,
        infer_cfg=winogrande_infer_cfg,
        eval_cfg=winogrande_eval_cfg,
    )
]