"tests/test_data/test_datasets/test_kitti_dataset.py" did not exist on "0a7fb9c7803a29795c6f04ed894736c199d3612c"
deprecated_mbpp_gen_caa7ab.py 3.18 KB
Newer Older
Fengzhe Zhou's avatar
Fengzhe Zhou committed
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, MBPPEvaluator

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

mbpp_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template=dict(
            round=[
13
14
                dict(role='HUMAN', prompt='You are an expert Python programmer, and here is your task: Write a function to find the similar elements from the given two tuple lists. Your code should pass these tests:\n\n assert similar_elements((3, 4, 5, 6),(5, 7, 4, 10)) == (4, 5)\n assert similar_elements((1, 2, 3, 4),(5, 4, 3, 7)) == (3, 4) \n assert similar_elements((11, 12, 14, 13),(17, 15, 14, 13)) == (13, 14) \n\nYour code should start with a [BEGIN] tag and end with a [DONE] tag.\n'),
                dict(role='BOT', prompt='[BEGIN]\ndef similar_elements(test_tup1, test_tup2):\r\n  res = tuple(set(test_tup1) & set(test_tup2))\r\n  return (res)\n[DONE] \n\n '),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
15

16
17
                dict(role='HUMAN', prompt='You are an expert Python programmer, and here is your task: Write a python function to identify non-prime numbers. Your code should pass these tests:\n\n assert is_not_prime(2) == False \n assert is_not_prime(10) == True \n assert is_not_prime(35) == True \n\nYour code should start with a [BEGIN] tag and end with a [DONE] tag.\n'),
                dict(role='BOT', prompt='[BEGIN]\nimport math\r\ndef is_not_prime(n):\r\n    result = False\r\n    for i in range(2,int(math.sqrt(n)) + 1):\r\n        if n % i == 0:\r\n            result = True\r\n    return result\n[DONE] \n\n '),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
18

19
20
                dict(role='HUMAN', prompt='You are an expert Python programmer, and here is your task: Write a function to find the largest integers from a given list of numbers using heap queue algorithm. Your code should pass these tests:\n\n assert heap_queue_largest( [25, 35, 22, 85, 14, 65, 75, 22, 58],3)==[85, 75, 65] \n assert heap_queue_largest( [25, 35, 22, 85, 14, 65, 75, 22, 58],2)==[85, 75] \n assert heap_queue_largest( [25, 35, 22, 85, 14, 65, 75, 22, 58],5)==[85, 75, 65, 58, 35] \n\nYour code should start with a [BEGIN] tag and end with a [DONE] tag.\n'),
                dict(role='BOT', prompt='[BEGIN]\nimport heapq as hq\r\ndef heap_queue_largest(nums,n):\r\n  largest_nums = hq.nlargest(n, nums)\r\n  return largest_nums\n[DONE] \n\n '),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
21

22
23
                dict(role='HUMAN', prompt='You are an expert Python programmer, and here is your task: {text} Your code should pass these tests:\n\n {test_list}  \n\nYour code should start with a [BEGIN] tag and end with a [DONE] tag.\n'),
                dict(role='BOT', prompt='[BEGIN]\n'),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
24
25
26
            ],
        ),
    ),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
27
    retriever=dict(type=ZeroRetriever),
Fengzhe Zhou's avatar
Fengzhe Zhou committed
28
29
    inferencer=dict(type=GenInferencer, max_out_len=512),
)
Fengzhe Zhou's avatar
Fengzhe Zhou committed
30

31
mbpp_eval_cfg = dict(evaluator=dict(type=MBPPEvaluator), pred_role='BOT')
Fengzhe Zhou's avatar
Fengzhe Zhou committed
32
33
34
35

mbpp_datasets = [
    dict(
        type=MBPPDataset,
36
37
        abbr='mbpp',
        path='./data/mbpp/mbpp.jsonl',
Fengzhe Zhou's avatar
Fengzhe Zhou committed
38
39
        reader_cfg=mbpp_reader_cfg,
        infer_cfg=mbpp_infer_cfg,
Fengzhe Zhou's avatar
Fengzhe Zhou committed
40
41
        eval_cfg=mbpp_eval_cfg,
    )
Fengzhe Zhou's avatar
Fengzhe Zhou committed
42
]