mbpp_gen_5d6316.py 1.29 KB
Newer Older
1
2
3
4
5
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 MBPPDataset, MBPPEvaluator2

Fengzhe Zhou's avatar
Fengzhe Zhou committed
6
mbpp_reader_cfg = dict(input_columns=["text", "test_list"], output_column="test_list_2")
7
8
9
10
11
12

# This prompt is used for WizardLMCode series
# You can use other config file for basic 3-shot generation
mbpp_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
Fengzhe Zhou's avatar
Fengzhe Zhou committed
13
14
15
16
17
        template=dict(
            round=[
                dict(
                    role="HUMAN",
                    prompt="""Below is an instruction that describes a task. Write a response that appropriately completes the request.
18
19
20
21
22
23
24
25

### Instruction:
Create a Python script for this problem:

{text}
Test examples:
{test_list}

Fengzhe Zhou's avatar
Fengzhe Zhou committed
26
27
28
29
30
### Response:""",
                ),
            ]
        ),
    ),
31
    retriever=dict(type=ZeroRetriever),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
32
33
    inferencer=dict(type=GenInferencer, max_out_len=512),
)
34
35
36
37
38
39

mbpp_eval_cfg = dict(evaluator=dict(type=MBPPEvaluator2), pred_role="BOT")

mbpp_datasets = [
    dict(
        type=MBPPDataset,
Fengzhe Zhou's avatar
Fengzhe Zhou committed
40
41
        abbr="mbpp",
        path="./data/mbpp/mbpp.jsonl",
42
43
        reader_cfg=mbpp_reader_cfg,
        infer_cfg=mbpp_infer_cfg,
Fengzhe Zhou's avatar
Fengzhe Zhou committed
44
45
        eval_cfg=mbpp_eval_cfg,
    )
46
]