Datasets:
isimrs
/

Languages:
English
Size:
n<1K
ArXiv:
License:
isimrs Muennighoff commited on
Commit
c5d45c2
·
0 Parent(s):

Duplicate from Muennighoff/mbpp

Browse files

Co-authored-by: Niklas Muennighoff <Muennighoff@users.noreply.huggingface.co>

Files changed (5) hide show
  1. .gitattributes +37 -0
  2. README.md +189 -0
  3. data/mbpp.jsonl +0 -0
  4. data/sanitized-mbpp.json +0 -0
  5. mbpp.py +104 -0
.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
12
+ *.onnx filter=lfs diff=lfs merge=lfs -text
13
+ *.ot filter=lfs diff=lfs merge=lfs -text
14
+ *.parquet filter=lfs diff=lfs merge=lfs -text
15
+ *.pb filter=lfs diff=lfs merge=lfs -text
16
+ *.pt filter=lfs diff=lfs merge=lfs -text
17
+ *.pth filter=lfs diff=lfs merge=lfs -text
18
+ *.rar filter=lfs diff=lfs merge=lfs -text
19
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
20
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
21
+ *.tflite filter=lfs diff=lfs merge=lfs -text
22
+ *.tgz filter=lfs diff=lfs merge=lfs -text
23
+ *.wasm filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ # Audio files - uncompressed
29
+ *.pcm filter=lfs diff=lfs merge=lfs -text
30
+ *.sam filter=lfs diff=lfs merge=lfs -text
31
+ *.raw filter=lfs diff=lfs merge=lfs -text
32
+ # Audio files - compressed
33
+ *.aac filter=lfs diff=lfs merge=lfs -text
34
+ *.flac filter=lfs diff=lfs merge=lfs -text
35
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
36
+ *.ogg filter=lfs diff=lfs merge=lfs -text
37
+ *.wav filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ - expert-generated
5
+ language_creators:
6
+ - crowdsourced
7
+ - expert-generated
8
+ language:
9
+ - en
10
+ license:
11
+ - cc-by-4.0
12
+ multilinguality:
13
+ - monolingual
14
+ size_categories:
15
+ - n<1K
16
+ source_datasets:
17
+ - original
18
+ task_categories:
19
+ - text2text-generation
20
+ task_ids: []
21
+ pretty_name: Mostly Basic Python Problems
22
+ tags:
23
+ - code-generation
24
+ ---
25
+
26
+ # Dataset Card for Mostly Basic Python Problems (mbpp)
27
+
28
+ ## Table of Contents
29
+ - [Dataset Card for Mostly Basic Python Problems (mbpp)](#dataset-card-for-mostly-basic-python-problems-(mbpp))
30
+ - [Table of Contents](#table-of-contents)
31
+ - [Dataset Description](#dataset-description)
32
+ - [Dataset Summary](#dataset-summary)
33
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
34
+ - [Languages](#languages)
35
+ - [Dataset Structure](#dataset-structure)
36
+ - [Data Instances](#data-instances)
37
+ - [Data Fields](#data-fields)
38
+ - [Data Splits](#data-splits)
39
+ - [Dataset Creation](#dataset-creation)
40
+ - [Curation Rationale](#curation-rationale)
41
+ - [Source Data](#source-data)
42
+ - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
43
+ - [Who are the source language producers?](#who-are-the-source-language-producers)
44
+ - [Annotations](#annotations)
45
+ - [Annotation process](#annotation-process)
46
+ - [Who are the annotators?](#who-are-the-annotators)
47
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
48
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
49
+ - [Social Impact of Dataset](#social-impact-of-dataset)
50
+ - [Discussion of Biases](#discussion-of-biases)
51
+ - [Other Known Limitations](#other-known-limitations)
52
+ - [Additional Information](#additional-information)
53
+ - [Dataset Curators](#dataset-curators)
54
+ - [Licensing Information](#licensing-information)
55
+ - [Citation Information](#citation-information)
56
+ - [Contributions](#contributions)
57
+
58
+ ## Dataset Description
59
+ - **Repository:** https://github.com/google-research/google-research/tree/master/mbpp
60
+ - **Paper:** [Program Synthesis with Large Language Models](https://arxiv.org/abs/2108.07732)
61
+
62
+ ### Dataset Summary
63
+ The benchmark consists of around 1,000 crowd-sourced Python programming problems, designed to be solvable by entry level programmers, covering programming fundamentals, standard library functionality, and so on. Each problem consists of a task description, code solution and 3 automated test cases. As described in the paper, a subset of the data has been hand-verified by us.
64
+
65
+ Released [here](https://github.com/google-research/google-research/tree/master/mbpp) as part of [Program Synthesis with Large Language Models, Austin et. al., 2021](https://arxiv.org/abs/2108.07732).
66
+
67
+ ### Supported Tasks and Leaderboards
68
+ This dataset is used to evaluate code generations.
69
+
70
+ ### Languages
71
+ English - Python code
72
+
73
+ ## Dataset Structure
74
+
75
+ ```python
76
+ dataset_full = load_dataset("mbpp")
77
+ DatasetDict({
78
+ test: Dataset({
79
+ features: ['task_id', 'text', 'code', 'test_list', 'test_setup_code', 'challenge_test_list'],
80
+ num_rows: 974
81
+ })
82
+ })
83
+
84
+ dataset_sanitized = load_dataset("mbpp", "sanitized")
85
+ DatasetDict({
86
+ test: Dataset({
87
+ features: ['source_file', 'task_id', 'prompt', 'code', 'test_imports', 'test_list'],
88
+ num_rows: 427
89
+ })
90
+ })
91
+ ```
92
+
93
+ ### Data Instances
94
+
95
+ #### mbpp - full
96
+ ```
97
+ {
98
+ 'task_id': 1,
99
+ '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[][].',
100
+ '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]',
101
+ 'test_list': [
102
+ 'assert min_cost([[1, 2, 3], [4, 8, 2], [1, 5, 3]], 2, 2) == 8',
103
+ 'assert min_cost([[2, 3, 4], [5, 9, 3], [2, 6, 4]], 2, 2) == 12',
104
+ 'assert min_cost([[3, 4, 5], [6, 10, 4], [3, 7, 5]], 2, 2) == 16'],
105
+ 'test_setup_code': '',
106
+ 'challenge_test_list': []
107
+ }
108
+ ```
109
+ #### mbpp - sanitized
110
+ ```
111
+ {
112
+ 'source_file': 'Benchmark Questions Verification V2.ipynb',
113
+ 'task_id': 2,
114
+ 'prompt': 'Write a function to find the shared elements from the given two lists.',
115
+ 'code': 'def similar_elements(test_tup1, test_tup2):\n res = tuple(set(test_tup1) & set(test_tup2))\n return (res) ',
116
+ 'test_imports': [],
117
+ 'test_list': [
118
+ 'assert set(similar_elements((3, 4, 5, 6),(5, 7, 4, 10))) == set((4, 5))',
119
+ 'assert set(similar_elements((1, 2, 3, 4),(5, 4, 3, 7))) == set((3, 4))',
120
+ 'assert set(similar_elements((11, 12, 14, 13),(17, 15, 14, 13))) == set((13, 14))'
121
+ ]
122
+ }
123
+ ```
124
+ ### Data Fields
125
+
126
+ - `source_file`: unknown
127
+ - `text`/`prompt`: description of programming task
128
+ - `code`: solution for programming task
129
+ - `test_setup_code`/`test_imports`: necessary code imports to execute tests
130
+ - `test_list`: list of tests to verify solution
131
+ - `challenge_test_list`: list of more challenging test to further probe solution
132
+
133
+ ### Data Splits
134
+ There are two version of the dataset (full and sanitized) which only one split each (test).
135
+ ## Dataset Creation
136
+ See section 2.1 of original [paper](https://arxiv.org/abs/2108.07732).
137
+
138
+ ### Curation Rationale
139
+ In order to evaluate code generation functions a set of simple programming tasks as well as solutions is necessary which this dataset provides.
140
+
141
+ ### Source Data
142
+
143
+ #### Initial Data Collection and Normalization
144
+ The dataset was manually created from scratch.
145
+
146
+ #### Who are the source language producers?
147
+ The dataset was created with an internal crowdsourcing effort at Google.
148
+
149
+ ### Annotations
150
+
151
+ #### Annotation process
152
+ The full dataset was created first and a subset then underwent a second round to improve the task descriptions.
153
+
154
+ #### Who are the annotators?
155
+ The dataset was created with an internal crowdsourcing effort at Google.
156
+
157
+ ### Personal and Sensitive Information
158
+ None.
159
+
160
+ ## Considerations for Using the Data
161
+ Make sure you execute generated Python code in a safe environment when evauating against this dataset as generated code could be harmful.
162
+
163
+ ### Social Impact of Dataset
164
+ With this dataset code generating models can be better evaluated which leads to fewer issues introduced when using such models.
165
+
166
+ ### Discussion of Biases
167
+
168
+ ### Other Known Limitations
169
+ Since the task descriptions might not be expressive enough to solve the task. The `sanitized` split aims at addressing this issue by having a second round of annotators improve the dataset.
170
+
171
+ ## Additional Information
172
+
173
+ ### Dataset Curators
174
+ Google Research
175
+
176
+ ### Licensing Information
177
+ CC-BY-4.0
178
+
179
+ ### Citation Information
180
+ ```
181
+ @article{austin2021program,
182
+ title={Program Synthesis with Large Language Models},
183
+ author={Austin, Jacob and Odena, Augustus and Nye, Maxwell and Bosma, Maarten and Michalewski, Henryk and Dohan, David and Jiang, Ellen and Cai, Carrie and Terry, Michael and Le, Quoc and others},
184
+ journal={arXiv preprint arXiv:2108.07732},
185
+ year={2021}
186
+ ```
187
+ ### Contributions
188
+ Thanks to [@lvwerra](https://github.com/lvwerra) for adding this dataset.
189
+
data/mbpp.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/sanitized-mbpp.json ADDED
The diff for this file is too large to render. See raw diff
 
mbpp.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ import datasets
4
+
5
+
6
+ _DESCRIPTION = """\
7
+ The MBPP (Mostly Basic Python Problems) dataset consists of around 1,000 crowd-sourced Python
8
+ programming problems, designed to be solvable by entry level programmers, covering programming
9
+ fundamentals, standard library functionality, and so on. Each problem consists of a task
10
+ description, code solution and 3 automated test cases.
11
+ """
12
+
13
+ _URLs = {
14
+ "full": "https://huggingface.co/datasets/Muennighoff/mbpp/resolve/main/data/mbpp.jsonl",
15
+ "sanitized": "https://huggingface.co/datasets/Muennighoff/mbpp/resolve/main/data/sanitized-mbpp.json",
16
+ }
17
+
18
+ _SPLITS = ["full", "sanitized"]
19
+
20
+ _CITATION = """\
21
+ @article{austin2021program,
22
+ title={Program Synthesis with Large Language Models},
23
+ author={Austin, Jacob and Odena, Augustus and Nye, Maxwell and Bosma, Maarten and Michalewski, Henryk and Dohan, David and Jiang, Ellen and Cai, Carrie and Terry, Michael and Le, Quoc and others},
24
+ journal={arXiv preprint arXiv:2108.07732},
25
+ year={2021}
26
+ }"""
27
+
28
+ _HOMEPAGE = "https://github.com/google-research/google-research/tree/master/mbpp"
29
+
30
+ _LICENSE = "CC-BY-4.0"
31
+
32
+
33
+ class MBPP(datasets.GeneratorBasedBuilder):
34
+ """MBPP: Mostly Basic Python Problems Dataset"""
35
+
36
+ VERSION = datasets.Version("1.0.0")
37
+
38
+ BUILDER_CONFIGS = [
39
+ datasets.BuilderConfig(
40
+ name=f"{split}",
41
+ version=datasets.Version("1.0.0"),
42
+ description=_DESCRIPTION,
43
+ )
44
+ for split in _SPLITS
45
+ ]
46
+
47
+ DEFAULT_CONFIG_NAME = "full"
48
+
49
+ def _info(self):
50
+ if self.config.name == "full":
51
+ features = datasets.Features(
52
+ {
53
+ "task_id": datasets.Value("int32"),
54
+ "text": datasets.Value("string"),
55
+ "code": datasets.Value("string"),
56
+ "test_list": datasets.Sequence(datasets.Value("string")),
57
+ "test_setup_code": datasets.Value("string"),
58
+ "challenge_test_list": datasets.Sequence(datasets.Value("string")),
59
+ }
60
+ )
61
+ else:
62
+ features = datasets.Features(
63
+ {
64
+ "source_file": datasets.Value("string"),
65
+ "task_id": datasets.Value("int32"),
66
+ "prompt": datasets.Value("string"),
67
+ "code": datasets.Value("string"),
68
+ "test_imports": datasets.Sequence(datasets.Value("string")),
69
+ "test_list": datasets.Sequence(datasets.Value("string")),
70
+ }
71
+ )
72
+ return datasets.DatasetInfo(
73
+ description=_DESCRIPTION,
74
+ features=features,
75
+ supervised_keys=None,
76
+ homepage=_HOMEPAGE,
77
+ license=_LICENSE,
78
+ citation=_CITATION,
79
+ )
80
+
81
+ def _split_generators(self, dl_manager):
82
+ """Returns SplitGenerators."""
83
+ config_urls = _URLs[self.config.name]
84
+ data_dir = dl_manager.download_and_extract(config_urls)
85
+ return [
86
+ datasets.SplitGenerator(
87
+ name=datasets.Split.TEST,
88
+ gen_kwargs={
89
+ "filepath": data_dir,
90
+ },
91
+ )
92
+ ]
93
+
94
+ def _generate_examples(self, filepath):
95
+ """Yields examples."""
96
+ with open(filepath, encoding="utf-8") as file:
97
+ if self.config.name == "full":
98
+ data = [json.loads(line) for line in file]
99
+ else:
100
+ data = json.load(file)
101
+ id_ = 0
102
+ for sample in data:
103
+ yield id_, sample
104
+ id_ += 1