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
from opencompass.datasets import siqaDataset_V2

siqa_reader_cfg = dict(
8
9
10
    input_columns=['context', 'question', 'answerA', 'answerB', 'answerC'],
    output_column='all_labels',
    test_split='validation')
yingfhu's avatar
yingfhu committed
11
12
13
14
15
16
17

siqa_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template=dict(
            round=[
                dict(
18
                    role='HUMAN',
yingfhu's avatar
yingfhu committed
19
                    prompt=
20
                    '{context}\nQuestion: {question}\nA. {answerA}\nB. {answerB}\nC. {answerC}\nAnswer:'
yingfhu's avatar
yingfhu committed
21
22
23
24
25
26
27
28
                )
            ], ),
    ),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=GenInferencer),
)

siqa_eval_cfg = dict(
29
    evaluator=dict(type=EDAccEvaluator),
30
    pred_role='BOT',
yingfhu's avatar
yingfhu committed
31
32
33
34
)

siqa_datasets = [
    dict(
35
        abbr='siqa',
yingfhu's avatar
yingfhu committed
36
        type=siqaDataset_V2,
37
        path='./data/siqa',
yingfhu's avatar
yingfhu committed
38
39
40
41
        reader_cfg=siqa_reader_cfg,
        infer_cfg=siqa_infer_cfg,
        eval_cfg=siqa_eval_cfg)
]