2024-04-09 17:50:23 +08:00
|
|
|
from opencompass.openicl.icl_prompt_template import PromptTemplate
|
|
|
|
from opencompass.openicl.icl_retriever import ZeroRetriever
|
|
|
|
from opencompass.openicl.icl_inferencer import GenInferencer
|
|
|
|
from opencompass.datasets import GSM8KDataset, gsm8k_postprocess, gsm8k_dataset_postprocess, Gsm8kEvaluator
|
|
|
|
|
2024-05-14 15:35:58 +08:00
|
|
|
gsm8k_reader_cfg = dict(input_columns=['question'], output_column='answer')
|
2024-04-09 17:50:23 +08:00
|
|
|
|
|
|
|
gsm8k_infer_cfg = dict(
|
|
|
|
prompt_template=dict(
|
|
|
|
type=PromptTemplate,
|
|
|
|
template=dict(
|
|
|
|
round=[
|
2024-05-14 15:35:58 +08:00
|
|
|
dict(role='HUMAN', prompt='{question}\nPlease reason step by step, and put your final answer within \\boxed{}.'),
|
2024-04-09 17:50:23 +08:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
retriever=dict(type=ZeroRetriever),
|
|
|
|
inferencer=dict(type=GenInferencer, max_out_len=512),
|
|
|
|
)
|
|
|
|
|
|
|
|
gsm8k_eval_cfg = dict(
|
|
|
|
evaluator=dict(type=Gsm8kEvaluator),
|
|
|
|
pred_postprocessor=dict(type=gsm8k_postprocess),
|
|
|
|
dataset_postprocessor=dict(type=gsm8k_dataset_postprocess),
|
|
|
|
)
|
|
|
|
|
|
|
|
gsm8k_datasets = [
|
|
|
|
dict(
|
2024-05-14 15:35:58 +08:00
|
|
|
abbr='gsm8k',
|
2024-04-09 17:50:23 +08:00
|
|
|
type=GSM8KDataset,
|
2024-05-14 15:35:58 +08:00
|
|
|
path='./data/gsm8k',
|
2024-04-09 17:50:23 +08:00
|
|
|
reader_cfg=gsm8k_reader_cfg,
|
|
|
|
infer_cfg=gsm8k_infer_cfg,
|
|
|
|
eval_cfg=gsm8k_eval_cfg,
|
|
|
|
)
|
|
|
|
]
|