siqa_gen_18632c.py 1.26 KB
Newer Older
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
5
from opencompass.openicl.icl_evaluator import AccEvaluator
from opencompass.utils.text_postprocessors import first_option_postprocess
6
7
8
from opencompass.datasets import siqaDataset_V3

siqa_reader_cfg = dict(
9
10
11
    input_columns=['context', 'question', 'A', 'B', 'C'],
    output_column='answer',
    test_split='validation')
12
13
14
15
16
17
18

siqa_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template=dict(
            round=[
                dict(
19
                    role='HUMAN',
20
                    prompt=
21
                    '{context}\nQuestion: {question}\nA. {A}\nB. {B}\nC. {C}\nAnswer:'
22
23
24
25
26
27
28
29
                )
            ], ),
    ),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=GenInferencer),
)

siqa_eval_cfg = dict(
30
31
            evaluator=dict(type=AccEvaluator),
            pred_postprocessor=dict(type=first_option_postprocess, options='ABC')
32
33
34
35
)

siqa_datasets = [
    dict(
36
        abbr='siqa',
37
38
39
40
41
42
        type=siqaDataset_V3,
        path='./data/siqa',
        reader_cfg=siqa_reader_cfg,
        infer_cfg=siqa_infer_cfg,
        eval_cfg=siqa_eval_cfg)
]