2024-01-17 13:48:12 +08:00
|
|
|
from opencompass.openicl.icl_prompt_template import PromptTemplate
|
|
|
|
from opencompass.openicl.icl_retriever import ZeroRetriever
|
|
|
|
from opencompass.openicl.icl_inferencer import GenInferencer
|
2024-02-05 23:29:10 +08:00
|
|
|
from opencompass.openicl.icl_evaluator import AccEvaluator
|
|
|
|
from opencompass.utils.text_postprocessors import first_option_postprocess
|
2024-01-17 13:48:12 +08:00
|
|
|
from opencompass.datasets import siqaDataset_V3
|
|
|
|
|
|
|
|
siqa_reader_cfg = dict(
|
2024-05-14 15:35:58 +08:00
|
|
|
input_columns=['context', 'question', 'A', 'B', 'C'],
|
|
|
|
output_column='answer',
|
|
|
|
test_split='validation')
|
2024-01-17 13:48:12 +08:00
|
|
|
|
|
|
|
siqa_infer_cfg = dict(
|
|
|
|
prompt_template=dict(
|
|
|
|
type=PromptTemplate,
|
|
|
|
template=dict(
|
|
|
|
round=[
|
|
|
|
dict(
|
2024-05-14 15:35:58 +08:00
|
|
|
role='HUMAN',
|
2024-01-17 13:48:12 +08:00
|
|
|
prompt=
|
2024-05-14 15:35:58 +08:00
|
|
|
'{context}\nQuestion: {question}\nA. {A}\nB. {B}\nC. {C}\nAnswer:'
|
2024-01-17 13:48:12 +08:00
|
|
|
)
|
|
|
|
], ),
|
|
|
|
),
|
|
|
|
retriever=dict(type=ZeroRetriever),
|
|
|
|
inferencer=dict(type=GenInferencer),
|
|
|
|
)
|
|
|
|
|
|
|
|
siqa_eval_cfg = dict(
|
2024-02-05 23:29:10 +08:00
|
|
|
evaluator=dict(type=AccEvaluator),
|
|
|
|
pred_postprocessor=dict(type=first_option_postprocess, options='ABC')
|
2024-01-17 13:48:12 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
siqa_datasets = [
|
|
|
|
dict(
|
2024-05-14 15:35:58 +08:00
|
|
|
abbr='siqa',
|
2024-01-17 13:48:12 +08:00
|
|
|
type=siqaDataset_V3,
|
|
|
|
path='./data/siqa',
|
|
|
|
reader_cfg=siqa_reader_cfg,
|
|
|
|
infer_cfg=siqa_infer_cfg,
|
|
|
|
eval_cfg=siqa_eval_cfg)
|
|
|
|
]
|