2023-09-06 17:52:35 +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 MBPPDataset, MBPPEvaluator2
|
|
|
|
|
2024-03-04 14:42:36 +08:00
|
|
|
mbpp_reader_cfg = dict(input_columns=["text", "test_list"], output_column="test_list_2")
|
2023-09-06 17:52:35 +08:00
|
|
|
|
|
|
|
# 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,
|
2024-03-04 14:42:36 +08:00
|
|
|
template=dict(
|
|
|
|
round=[
|
|
|
|
dict(
|
|
|
|
role="HUMAN",
|
|
|
|
prompt="""Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
2023-09-06 17:52:35 +08:00
|
|
|
|
|
|
|
### Instruction:
|
|
|
|
Create a Python script for this problem:
|
|
|
|
|
|
|
|
{text}
|
|
|
|
Test examples:
|
|
|
|
{test_list}
|
|
|
|
|
2024-03-04 14:42:36 +08:00
|
|
|
### Response:""",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
2023-09-06 17:52:35 +08:00
|
|
|
retriever=dict(type=ZeroRetriever),
|
2024-03-04 14:42:36 +08:00
|
|
|
inferencer=dict(type=GenInferencer, max_out_len=512),
|
|
|
|
)
|
2023-09-06 17:52:35 +08:00
|
|
|
|
|
|
|
mbpp_eval_cfg = dict(evaluator=dict(type=MBPPEvaluator2), pred_role="BOT")
|
|
|
|
|
|
|
|
mbpp_datasets = [
|
|
|
|
dict(
|
|
|
|
type=MBPPDataset,
|
2024-03-04 14:42:36 +08:00
|
|
|
abbr="mbpp",
|
|
|
|
path="./data/mbpp/mbpp.jsonl",
|
2023-09-06 17:52:35 +08:00
|
|
|
reader_cfg=mbpp_reader_cfg,
|
|
|
|
infer_cfg=mbpp_infer_cfg,
|
2024-03-04 14:42:36 +08:00
|
|
|
eval_cfg=mbpp_eval_cfg,
|
|
|
|
)
|
2023-09-06 17:52:35 +08:00
|
|
|
]
|