siqa_gen_e78df3.py 1.17 KB
Newer Older
yingfhu's avatar
yingfhu committed
1
2
3
from opencompass.openicl.icl_prompt_template import PromptTemplate
from opencompass.openicl.icl_retriever import ZeroRetriever
from opencompass.openicl.icl_inferencer import GenInferencer
4
from opencompass.openicl.icl_evaluator import EDAccEvaluator
yingfhu's avatar
yingfhu committed
5
6
7
8
from opencompass.datasets import siqaDataset_V2

siqa_reader_cfg = dict(
    input_columns=["context", "question", "answerA", "answerB", "answerC"],
9
    output_column="all_labels",
yingfhu's avatar
yingfhu committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    test_split="validation")

siqa_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template=dict(
            round=[
                dict(
                    role="HUMAN",
                    prompt=
                    "{context}\nQuestion: {question}\nA. {answerA}\nB. {answerB}\nC. {answerC}\nAnswer:"
                )
            ], ),
    ),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=GenInferencer),
)

siqa_eval_cfg = dict(
29
    evaluator=dict(type=EDAccEvaluator),
yingfhu's avatar
yingfhu committed
30
31
32
33
34
35
36
37
38
39
40
41
    pred_role="BOT",
)

siqa_datasets = [
    dict(
        abbr="siqa",
        type=siqaDataset_V2,
        path="social_i_qa",
        reader_cfg=siqa_reader_cfg,
        infer_cfg=siqa_infer_cfg,
        eval_cfg=siqa_eval_cfg)
]