Martin Mirchev commited on
Commit
3c44231
1 Parent(s): 2e23e12

First iteration of the MBPP dataset

Browse files
Files changed (4) hide show
  1. README.md +14 -0
  2. convert.ipynb +76 -0
  3. mbpp.csv +0 -0
  4. mbpp.jsonl +0 -0
README.md CHANGED
@@ -1,3 +1,17 @@
1
  ---
 
 
2
  license: mit
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
1
  ---
2
+ ---
3
+ pretty_name: MBPP
4
  license: mit
5
+ description: A formatted version of MBPP.
6
+ configs:
7
+ - config_name: default
8
+ data_files:
9
+ - split: train
10
+ path: mbpp.csv
11
+
12
+ ---
13
  ---
14
+
15
+ # Information
16
+
17
+ This is a reformatted version of the [HumanEval dataset](https://github.com/openai/human-eval)
convert.ipynb ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import json\n",
10
+ "import os\n",
11
+ "import pandas as pd\n",
12
+ "\n",
13
+ "x = open(\"./mbpp.jsonl\")\n",
14
+ "entries = []\n",
15
+ "for line in x:\n",
16
+ " contents = json.loads(line)\n",
17
+ " entries.append(contents)\n",
18
+ "x.close()"
19
+ ]
20
+ },
21
+ {
22
+ "cell_type": "code",
23
+ "execution_count": 2,
24
+ "metadata": {},
25
+ "outputs": [
26
+ {
27
+ "name": "stdout",
28
+ "output_type": "stream",
29
+ "text": [
30
+ "{'text': 'Write a function to find the minimum cost path to reach (m, n) from (0, 0) for the given cost matrix cost[][] and a position (m, n) in cost[][].', 'code': 'R = 3\\r\\nC = 3\\r\\ndef min_cost(cost, m, n): \\r\\n\\ttc = [[0 for x in range(C)] for x in range(R)] \\r\\n\\ttc[0][0] = cost[0][0] \\r\\n\\tfor i in range(1, m+1): \\r\\n\\t\\ttc[i][0] = tc[i-1][0] + cost[i][0] \\r\\n\\tfor j in range(1, n+1): \\r\\n\\t\\ttc[0][j] = tc[0][j-1] + cost[0][j] \\r\\n\\tfor i in range(1, m+1): \\r\\n\\t\\tfor j in range(1, n+1): \\r\\n\\t\\t\\ttc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] \\r\\n\\treturn tc[m][n]', 'task_id': 1, 'test_setup_code': '', 'test_list': ['assert min_cost([[1, 2, 3], [4, 8, 2], [1, 5, 3]], 2, 2) == 8', 'assert min_cost([[2, 3, 4], [5, 9, 3], [2, 6, 4]], 2, 2) == 12', 'assert min_cost([[3, 4, 5], [6, 10, 4], [3, 7, 5]], 2, 2) == 16'], 'challenge_test_list': []}\n"
31
+ ]
32
+ }
33
+ ],
34
+ "source": [
35
+ "print(entries[0])"
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "execution_count": null,
41
+ "metadata": {},
42
+ "outputs": [],
43
+ "source": [
44
+ "data = {\"source\": [], \"target\": [], \"program_id\": []}\n",
45
+ "\n",
46
+ "for i,entry in enumerate(entries):\n",
47
+ " data[\"source\"].append(entry[\"text\"])\n",
48
+ " data[\"target\"].append(entry[\"code\"])\n",
49
+ " data[\"program_id\"].append(\"MBPP_\"+str(i))\n",
50
+ "\n",
51
+ "pd.DataFrame(data=data).to_csv(\"./mbpp.csv\")"
52
+ ]
53
+ }
54
+ ],
55
+ "metadata": {
56
+ "kernelspec": {
57
+ "display_name": "Python 3",
58
+ "language": "python",
59
+ "name": "python3"
60
+ },
61
+ "language_info": {
62
+ "codemirror_mode": {
63
+ "name": "ipython",
64
+ "version": 3
65
+ },
66
+ "file_extension": ".py",
67
+ "mimetype": "text/x-python",
68
+ "name": "python",
69
+ "nbconvert_exporter": "python",
70
+ "pygments_lexer": "ipython3",
71
+ "version": "3.11.6"
72
+ }
73
+ },
74
+ "nbformat": 4,
75
+ "nbformat_minor": 2
76
+ }
mbpp.csv ADDED
The diff for this file is too large to render. See raw diff
 
mbpp.jsonl ADDED
The diff for this file is too large to render. See raw diff