taco_gen_c7893a.py 1.06 KB
Newer Older
Connor-Shen's avatar
Connor-Shen committed
1
2
3
4
5
6
7
8
9
10
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 TACODataset, TACOEvaluator

TACO_reader_cfg = dict(input_columns=["question", "starter"], output_column="problem_id", train_split='test')

TACO_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
Connor-Shen's avatar
Connor-Shen committed
11
        template="Please write a python program to address the following QUESTION. Your ANSWER should be in a code block format like this: ```python # Write your code here ```. \nQUESTION:\n{question} {starter}\nANSWER:\n"),
Connor-Shen's avatar
Connor-Shen committed
12
13
14
15
16
17
18
19
20
21
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=GenInferencer, max_out_len=512),
)

TACO_eval_cfg = dict(evaluator=dict(type=TACOEvaluator), pred_role="BOT")

TACO_datasets = [
    dict(
        type=TACODataset,
        abbr="TACO",
Fengzhe Zhou's avatar
Fengzhe Zhou committed
22
        path='./data/BAAI-TACO',
Connor-Shen's avatar
Connor-Shen committed
23
24
25
26
27
28
        num_repeats = 1,
        reader_cfg=TACO_reader_cfg,
        infer_cfg=TACO_infer_cfg,
        eval_cfg=TACO_eval_cfg,
    )
]