Datasets:
DONG19
/

Modalities:
Text
Formats:
parquet
Languages:
code
ArXiv:
Tags:
code
License:
DONG19 bowen92 commited on
Commit
5285acb
·
0 Parent(s):

Duplicate from BAAI/TACO

Browse files

Co-authored-by: bowenzhang <bowen92@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pickle filter=lfs diff=lfs merge=lfs -text
22
+ *.pkl filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar filter=lfs diff=lfs merge=lfs -text
30
+ *.tflite filter=lfs diff=lfs merge=lfs -text
31
+ *.tgz filter=lfs diff=lfs merge=lfs -text
32
+ *.wasm filter=lfs diff=lfs merge=lfs -text
33
+ *.xz filter=lfs diff=lfs merge=lfs -text
34
+ *.zip filter=lfs diff=lfs merge=lfs -text
35
+ *.zst filter=lfs diff=lfs merge=lfs -text
36
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
37
+ # Audio files - uncompressed
38
+ *.pcm filter=lfs diff=lfs merge=lfs -text
39
+ *.sam filter=lfs diff=lfs merge=lfs -text
40
+ *.raw filter=lfs diff=lfs merge=lfs -text
41
+ # Audio files - compressed
42
+ *.aac filter=lfs diff=lfs merge=lfs -text
43
+ *.flac filter=lfs diff=lfs merge=lfs -text
44
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
45
+ *.ogg filter=lfs diff=lfs merge=lfs -text
46
+ *.wav filter=lfs diff=lfs merge=lfs -text
47
+ # Image files - uncompressed
48
+ *.bmp filter=lfs diff=lfs merge=lfs -text
49
+ *.gif filter=lfs diff=lfs merge=lfs -text
50
+ *.png filter=lfs diff=lfs merge=lfs -text
51
+ *.tiff filter=lfs diff=lfs merge=lfs -text
52
+ # Image files - compressed
53
+ *.jpg filter=lfs diff=lfs merge=lfs -text
54
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
55
+ *.webp filter=lfs diff=lfs merge=lfs -text
ALL/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d99adc603500c05751aff9f61bed7bbd54a9ad5ea569d108b645346655aae44
3
+ size 245784461
ALL/train-00000-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bee336c14dda183b1f700d54a149173418c7b3def295666159dd72c32aa8b326
3
+ size 286917870
ALL/train-00001-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1934cd4c4e8784bfc231b0294326a308dc2b7abf5e3c7f17622ece10ae8d8b56
3
+ size 327223660
ALL/train-00002-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ad70829b190935c6cbded92d013b9b1fc10cd154dc0814c929716a1ea9ad1ae
3
+ size 177530416
ALL/train-00003-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:934953c5693650a58ede19966db7ec1322f721e9c91b4d62e90a67dced86121d
3
+ size 179463335
ALL/train-00004-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d634726c27b85171494f7d38abfcd31d773a205002f9218bb54bc2cba49c99d4
3
+ size 205709320
ALL/train-00005-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c604f98dc0d1568939372f78fc6ed654c31b34ed3e0302636efcc8547802439c
3
+ size 271713449
ALL/train-00006-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6ebb62153e93828e631f985d29466d7819262a6811a49b00a23a3cdb1904a11
3
+ size 213807578
ALL/train-00007-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3dfc9a787b2234fbb25f31a7d15fad734c518c5fb6fc62a71616dae69944aef
3
+ size 260118596
ALL/train-00008-of-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16d88e9c6d4ddb5d28805dc6e03f2fb349ccf858436b86191f4c2b97170c1304
3
+ size 251576257
README.md ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators: []
3
+ language_creators:
4
+ - crowdsourced
5
+ - expert-generated
6
+ language:
7
+ - code
8
+ license: apache-2.0
9
+ multilinguality:
10
+ - monolingual
11
+ size_categories:
12
+ - 10K<n<100K
13
+ source_datasets: []
14
+ task_categories:
15
+ - text-generation
16
+ task_ids:
17
+ - language-modeling
18
+ paperswithcode_id: taco-topics-in-algorithmic-code-generation
19
+ pretty_name: TACO
20
+ tags:
21
+ - code
22
+ dataset_info:
23
+ config_name: ALL
24
+ features:
25
+ - name: question
26
+ dtype: string
27
+ - name: solutions
28
+ dtype: string
29
+ - name: starter_code
30
+ dtype: string
31
+ - name: input_output
32
+ dtype: string
33
+ - name: difficulty
34
+ dtype: string
35
+ - name: raw_tags
36
+ dtype: string
37
+ - name: name
38
+ dtype: string
39
+ - name: source
40
+ dtype: string
41
+ - name: tags
42
+ dtype: string
43
+ - name: skill_types
44
+ dtype: string
45
+ - name: url
46
+ dtype: string
47
+ - name: Expected Auxiliary Space
48
+ dtype: string
49
+ - name: time_limit
50
+ dtype: string
51
+ - name: date
52
+ dtype: string
53
+ - name: picture_num
54
+ dtype: string
55
+ - name: memory_limit
56
+ dtype: string
57
+ - name: Expected Time Complexity
58
+ dtype: string
59
+ splits:
60
+ - name: train
61
+ num_bytes: 4239311973
62
+ num_examples: 25443
63
+ - name: test
64
+ num_bytes: 481480755
65
+ num_examples: 1000
66
+ download_size: 2419844942
67
+ dataset_size: 4720792728
68
+ configs:
69
+ - config_name: ALL
70
+ data_files:
71
+ - split: train
72
+ path: ALL/train-*
73
+ - split: test
74
+ path: ALL/test-*
75
+ ---
76
+
77
+ # TACO Dataset
78
+
79
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/6335113375bed9932474315e/rMxdXcC56S3FEh37oRa2s.png" width="200" height="200">
80
+
81
+ [TACO](https://github.com/FlagOpen/TACO) is a benchmark for code generation with 26443 problems. It can be used to evaluate the ability of language models to generate code from natural language specifications.
82
+
83
+ ## Key Update:
84
+ We remove and modified some test cases in test set. Please update to use the newest version.
85
+
86
+ ## Dataset Description
87
+
88
+ - **Repository:** https://github.com/FlagOpen/TACO/
89
+ - **Paper:** [TACO: Topics in Algorithmic COde generation dataset](https://arxiv.org/abs/2312.14852)
90
+ - **Leaderboard:** [Code Generation on CodeContests](https://paperswithcode.com/sota/code-generation-on-taco-code)
91
+ - **Point of Contact:** [Bo-Wen Zhang](mailto:bwzhang@baai.ac.cn)
92
+
93
+ ## Languages
94
+
95
+ The dataset contains questions in English and code solutions in Python.
96
+
97
+ ## Dataset Structure
98
+
99
+ ```python
100
+ from datasets import load_dataset
101
+ load_dataset("BAAI/TACO")
102
+
103
+ DatasetDict({
104
+ train: Dataset({
105
+ features: ['question', 'solutions', 'starter_code', 'input_output', 'difficulty', 'raw_tags', 'name', 'source', 'tags', 'skill_types', 'url', 'Expected Auxiliary Space', 'time_limit', 'date', 'picture_num', 'memory_limit', 'Expected Time Complexity'],
106
+ num_rows: 25443
107
+ })
108
+ test: Dataset({
109
+ features: ['question', 'solutions', 'starter_code', 'input_output', 'difficulty', 'raw_tags', 'name', 'source', 'tags', 'skill_types', 'url', 'Expected Auxiliary Space', 'time_limit', 'date', 'picture_num', 'memory_limit', 'Expected Time Complexity'],
110
+ num_rows: 1000
111
+ })
112
+ })
113
+ ```
114
+
115
+ ### How to use it
116
+
117
+ You can load and iterate through the dataset with the following two lines of code for the train split:
118
+
119
+ ```python
120
+ from datasets import load_dataset
121
+ import json
122
+
123
+ ds = load_dataset("BAAI/TACO", split="train")
124
+ sample = next(iter(ds))
125
+ # non-empty solutions and input_output features can be parsed from text format this way:
126
+ sample["solutions"] = json.loads(sample["solutions"])
127
+ sample["input_output"] = json.loads(sample["input_output"])
128
+ sample["raw_tags"] = eval(sample["raw_tags"])
129
+ sample["tags"] = eval(sample["tags"])
130
+ sample["skill_types"] = eval(sample["skill_types"])
131
+ print(sample)
132
+
133
+ #OUTPUT:
134
+ {
135
+ "question": "You have a deck of $n$ cards, and you'd like to reorder it to a new one.\n\nEach card has a value between $1$ and $n$ equal to $p_i$. ...",
136
+ "solutions": [
137
+ "import heapq\nfrom math import sqrt\nimport operator\nimport sys\ninf_var = 0\nif inf_var == 1:\n\tinf = open('input.txt', 'r')\nelse:\n\tinf = sys.stdin\n ...",
138
+ "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tp = list(map(int, input().split()))\n\tans = []\n\tp1 = [-1] * (n + 1)\n\tfor i in range(n):\n\t\tp1[p[i]] = i\n\ti = n\n\twhile i:\n\t\twhile i > 0 and p1[i] == -1:\n\t\t\ti -= 1\n\t\telse:\n\t\t\tif i:\n\t\t\t\tk = 0\n\t\t\t\tfor j in range(p1[i], n):\n\t\t\t\t\tans.append(p[j])\n\t\t\t\t\tp1[p[j]] = -1\n\t\t\t\t\tk += 1\n\t\t\t\tn -= k\n\t\t\t\ti -= 1\n\t\t\telse:\n\t\t\t\tbreak\n\tprint(*ans)\n",
139
+ "import sys\n\ndef get_ints():\n\treturn map(int, sys.stdin.readline().strip().split())\n\ndef get_list():\n\treturn list(map(int, sys.stdin.readline().strip().split()))\n\ndef get_list_string():\n\treturn list(map(str, sys.stdin.readline().strip().split()))\n\ndef get_string():\n\treturn sys.stdin.readline().strip()\n\ndef get_int():\n\treturn int(sys.stdin.readline().strip())\n\ndef get_print_int(x):\n\tsys.stdout.write(str(x) + '\\n')\n\ndef get_print(x):\n\tsys.stdout.write(x + '\\n')\n\ndef get_print_int_same(x):\n\tsys.stdout.write(str(x) + ' ')\n\ndef get_print_same(x):\n\tsys.stdout.write(x + ' ')\nfrom sys import maxsize\n\ndef solve():\n\tfor _ in range(get_int()):\n\t\tn = get_int()\n\t\tarr = get_list()\n\t\ti = n - 1\n\t\tj = n - 1\n\t\ttemp = sorted(arr)\n\t\tvis = [False] * n\n\t\tans = []\n\t\twhile j >= 0:\n\t\t\tt = j\n\t\t\ttt = []\n\t\t\twhile t >= 0 and arr[t] != temp[i]:\n\t\t\t\tvis[arr[t] - 1] = True\n\t\t\t\ttt.append(arr[t])\n\t\t\t\tt -= 1\n\t\t\tvis[arr[t] - 1] = True\n\t\t\ttt.append(arr[t])\n\t\t\ttt = tt[::-1]\n\t\t\tfor k in tt:\n\t\t\t\tans.append(k)\n\t\t\tj = t - 1\n\t\t\twhile i >= 0 and vis[i]:\n\t\t\t\ti -= 1\n\t\tget_print(' '.join(map(str, ans)))\nsolve()\n",
140
+ ...
141
+ ],
142
+ "starter_code": "",
143
+ "input_output": {
144
+ "inputs": [
145
+ "4\n4\n1 2 3 4\n5\n1 5 2 4 3\n6\n4 2 5 3 6 1\n1\n1\n",
146
+ "4\n4\n2 1 3 4\n5\n1 5 2 4 3\n6\n4 2 5 3 6 1\n1\n1\n",
147
+ "4\n4\n2 1 3 4\n5\n1 5 2 4 3\n6\n2 4 5 3 6 1\n1\n1\n",
148
+ "4\n4\n1 2 3 4\n5\n1 5 2 4 3\n6\n4 2 5 3 6 1\n1\n1\n"
149
+ ],
150
+ "outputs": [
151
+ "4 3 2 1\n5 2 4 3 1\n6 1 5 3 4 2\n1\n",
152
+ "4 3 2 1\n5 2 4 3 1\n6 1 5 3 4 2\n1\n",
153
+ "4 3 2 1\n5 2 4 3 1\n6 1 5 3 4 2\n1\n",
154
+ "\n4 3 2 1\n5 2 4 3 1\n6 1 5 3 4 2\n1\n"
155
+ ]
156
+ },
157
+ "difficulty": "EASY",
158
+ "raw_tags": [
159
+ "data structures",
160
+ "greedy",
161
+ "math"
162
+ ],
163
+ "name": null,
164
+ "source": "codeforces",
165
+ "tags": [
166
+ "Data structures",
167
+ "Mathematics",
168
+ "Greedy algorithms"
169
+ ],
170
+ "skill_types": [
171
+ "Data structures",
172
+ "Greedy algorithms"
173
+ ],
174
+ "url": "https://codeforces.com/problemset/problem/1492/B",
175
+ "Expected Auxiliary Space": null,
176
+ "time_limit": "1 second",
177
+ "date": "2021-02-23",
178
+ "picture_num": "0",
179
+ "memory_limit": "512 megabytes",
180
+ "Expected Time Complexity": null
181
+ }
182
+ ```
183
+ Each sample consists of a programming problem formulation in English, some ground truth Python solutions, test cases that are defined by their inputs and outputs and function name if provided, as well as some metadata regarding the difficulty level (difficulty), topics of task (raw tags), algorithms (tags) as well as required programming skill types (skill_types) of the problem and its source.
184
+
185
+ If a sample has non empty `input_output` feature, you can read it as a dictionary with keys `inputs` and `outputs` and `fn_name` if it exists, and similarily you can parse the solutions into a list of solutions as shown in the code above.
186
+
187
+ You can also filter the dataset for the difficulty level: EASY, MEDIUM, MEDIUM_HARD, HARD and VERY_HARD, or filter the programming skill types: Amortized analysis, Bit manipulation, Complete search, Data structures, Dynamic programming, Greedy algorithms, Range queries, Sorting. Just pass the list of difficulties or skills as a list. E.g. if you want the most challenging problems, you need to select the VERY_HARD level:
188
+
189
+ ```python
190
+ ds = load_dataset("BAAI/TACO", split="train", difficulties=["VERY_HARD"])
191
+ print(next(iter(ds))["question"])
192
+ ```
193
+ ```
194
+ #OUTPUT:
195
+ """Let S(n) denote the number that represents the digits of n in sorted order. For example, S(1) = 1, S(5) = 5, S(50394) = 3459, S(353535) = 333555.
196
+ Given a number X, compute <image> modulo 109 + 7.
197
+
198
+ Input
199
+ The first line of input will contain the integer X (1 ≤ X ≤ 10700).
200
+
201
+ Output
202
+ Print a single integer, the answer to the question.
203
+
204
+ Examples
205
+
206
+ Input
207
+ 21
208
+
209
+ Output
210
+ 195
211
+
212
+ Input
213
+ 345342
214
+
215
+ Output
216
+ 390548434
217
+
218
+ Note
219
+
220
+ The first few values of S are 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 12. The sum of these values is 195.
221
+ ```
222
+ Or if you want the problems invovled with Range queries and Sorting, you need to select the skills Range queries and Sorting:
223
+
224
+ ```python
225
+ ds = load_dataset("BAAI/TACO", split="train", skills=["Range queries", "Sorting"])
226
+ ```
227
+
228
+ ### Data Fields
229
+
230
+ |Field|Type|Description|
231
+ |---|---|---|
232
+ |question|string|problem description|
233
+ |solutions|string|some python solutions|
234
+ |input_output|string|Json string with "inputs" and "outputs" of the test cases, might also include "fn_name" the name of the function|
235
+ |difficulty|string|difficulty level of the problem|
236
+ |picture_num|string|the number of pictures in the problem|
237
+ |source|string|the source of the problem|
238
+ |url|string|url of the source of the problem|
239
+ |date|string|the date of the problem|
240
+ |starter_code|string|starter code to include in prompts|
241
+ |time_limit|string|the time consumption limit to solve the problem|
242
+ |memory_limit|string|the memory consumption limit to solve the problem|
243
+ |Expected Auxiliary Space|string|the extra auxiliary space expected to solve the problem|
244
+ |Expected Time Complexity|string|the time complexity expected to solve the problem|
245
+ |raw_tags|string|the topics of the programming task|
246
+ |tags|string|the manually annoatated algorithms needed to solve the problem|
247
+ |skill_types|string|the mapped programming skill types to solve the problem|
248
+
249
+
250
+
251
+ ### Data Splits
252
+
253
+ The dataset contains a train with 25443 samples and test splits with 1000 samples.
254
+
255
+ ### Dataset Statistics
256
+ * 26443 coding problems
257
+ * 1.55M verified solutions
258
+ * for tests split, the average number of test cases is 202.3
259
+ * all files have ground-truth solutions in the test split
260
+
261
+ ## Dataset Creation
262
+
263
+ To create the TACO dataset, the authors manually curated problems from open-access sites where programmers share problems with each other, including Aizu
264
+ AtCoder, CodeChef, Codeforces, CodeWars, GeeksforGeeks, HackerEarth, HackerRank, Katti and LeetCode. For more details please refer to the original paper.
265
+
266
+ ## License
267
+ The TACO dataset that is authored by BAAI, Shandong Normal University and Peking University is released under an [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). However, the data also includes content licensed under other permissive licenses such as MIT License, or web-crawled data which is used under the terms of the CC BY 4.0 license ([Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/legalcode)).
268
+
269
+ We gratefully acknowledge the contributions of the following:
270
+ * some AtCoder, Codeforces, CodeWars, Kattis, LeetCode material curated from APPS dataset (https://github.com/hendrycks/apps)
271
+ * some Aizu, AtCoder, CodeChef, Codeforces material curated from CodeContest dataset (https://github.com/google-deepmind/code_contests)
272
+ * Codeforces materials are sourced from http://codeforces.com.
273
+ * CodeChef materials are sourced from https://www.codechef.com.
274
+ * GeekforGeeks materials are sourced from https://www.geeksforgeeks.org
275
+ * HackerEarth materials are curated from:
276
+ [Description2Code Dataset](https://github.com/ethancaballero/description2code),
277
+ licensed under the
278
+ [MIT open source license](https://opensource.org/licenses/MIT), copyright
279
+ not specified.
280
+ * HackerRank materials are sourced from https://www.hackerrank.com. We don't know what the legal rights or data licenses of HackerRank. Please contact us if there is data license.
281
+ ## Citation Information
282
+
283
+ If you find our data, or code helpful, please cite [the original paper](https://arxiv.org/abs/2312.14852):
284
+
285
+ ```
286
+ @article{li2023taco,
287
+ title={TACO: Topics in Algorithmic COde generation dataset},
288
+ author={Rongao Li and Jie Fu and Bo-Wen Zhang and Tao Huang and Zhihong Sun and Chen Lyu and Guang Liu and Zhi Jin and Ge Li},
289
+ journal={arXiv preprint arXiv:2312.14852},
290
+ year={2023}
291
+ }
292
+ ```
TACO.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2023 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """TACO dataset."""
16
+
17
+ import json
18
+ import datasets
19
+
20
+
21
+ _REPO_NAME = "BAAI/TACO"
22
+
23
+ _CITATION = """
24
+ """
25
+
26
+ _DESCRIPTION = """
27
+ TACO is a benchmark for Python code generation, it includes 25443 problems and 1000 problems for train and test splits.
28
+ """
29
+
30
+ _HOMEPAGE = "https://github.com/FlagOpen/TACO"
31
+ _DIFFICULTY = ["EASY", "MEDIUM", "MEDIUM_HARD", "HARD", "VERY_HARD"]
32
+ _DIFFICULTY_CONFIGS = ["ALL"] + _DIFFICULTY
33
+ _SKILL = ['Data structures', 'Sorting', 'Range queries', 'Complete search', 'Amortized analysis', 'Dynamic programming', 'Bit manipulation', 'Greedy algorithms']
34
+ _SKILL_CONFIGS = ["ALL"] + _SKILL
35
+ _URLS = {
36
+ "train": ['train/data-00000-of-00009.arrow', 'train/data-00001-of-00009.arrow', 'train/data-00002-of-00009.arrow', 'train/data-00003-of-00009.arrow', 'train/data-00004-of-00009.arrow', 'train/data-00005-of-00009.arrow', 'train/data-00006-of-00009.arrow', 'train/data-00007-of-00009.arrow', 'train/data-00008-of-00009.arrow'],
37
+ "test": ['test/data-00000-of-00001.arrow'],
38
+ }
39
+
40
+
41
+ class TACOConfig(datasets.BuilderConfig):
42
+ """BuilderConfig for the TACO dataset."""
43
+
44
+ def __init__(self, *args, difficulties=["ALL"], skills=["ALL"], **kwargs):
45
+ """BuilderConfig for the APPS Code dataset.
46
+
47
+ Args:
48
+ difficulties (:obj:`List[str]`): List of problem difficulty levels to load.
49
+ skills (:obj:`List[str]`): List of algorithm skills of problems to load.
50
+ **kwargs: keyword arguments forwarded to super.
51
+ """
52
+ if "ALL" in difficulties:
53
+ assert len(difficulties) == 1
54
+ self.filter_difficulties = False
55
+ else:
56
+ self.filter_difficulties = True
57
+ if "ALL" in skills:
58
+ assert len(skills) == 1
59
+ self.filter_skills = False
60
+ else:
61
+ self.filter_skills = True
62
+
63
+ if self.filter_difficulties:
64
+ subset_name = '+'.join(sorted(difficulties))
65
+ assert not self.filter_skills, "Not supported to filter difficulties and skills together."
66
+ elif self.filter_skills:
67
+ subset_name = '+'.join(sorted(skills))
68
+ else:
69
+ subset_name = 'ALL'
70
+
71
+ super().__init__(
72
+ *args,
73
+ name=subset_name,
74
+ **kwargs,
75
+ )
76
+
77
+ self.subsets = {"difficulties": difficulties, "skills": skills}
78
+
79
+
80
+ class TACO(datasets.GeneratorBasedBuilder):
81
+ """TACO dataset."""
82
+
83
+ VERSION = datasets.Version("1.0.0")
84
+
85
+ BUILDER_CONFIG_CLASS = TACOConfig
86
+ BUILDER_CONFIGS = [
87
+ TACOConfig(difficulties=[level]) for level in _DIFFICULTY_CONFIGS
88
+ ] + [
89
+ TACOConfig(skills=[skill]) for skill in _SKILL_CONFIGS if skill!='ALL'
90
+ ]
91
+ DEFAULT_CONFIG_NAME = "ALL"
92
+
93
+ def _info(self):
94
+ return datasets.DatasetInfo(
95
+ description=_DESCRIPTION,
96
+ features=datasets.Features({
97
+ 'question': datasets.Value(dtype='string', id=None),
98
+ 'solutions': datasets.Value(dtype='string', id=None),
99
+ 'starter_code': datasets.Value(dtype='string', id=None),
100
+ 'input_output': datasets.Value(dtype='string', id=None),
101
+ 'difficulty': datasets.Value(dtype='string', id=None),
102
+ 'raw_tags': datasets.Value(dtype='string', id=None),
103
+ 'name': datasets.Value(dtype='string', id=None),
104
+ 'source': datasets.Value(dtype='string', id=None),
105
+ 'tags': datasets.Value(dtype='string', id=None),
106
+ 'skill_types': datasets.Value(dtype='string', id=None),
107
+ 'url': datasets.Value(dtype='string', id=None),
108
+ 'Expected Auxiliary Space': datasets.Value(dtype='string', id=None),
109
+ 'time_limit': datasets.Value(dtype='string', id=None),
110
+ 'date': datasets.Value(dtype='string', id=None),
111
+ 'picture_num': datasets.Value(dtype='string', id=None),
112
+ 'memory_limit': datasets.Value(dtype='string', id=None),
113
+ 'Expected Time Complexity': datasets.Value(dtype='string', id=None),
114
+ }),
115
+ supervised_keys=None,
116
+ citation=_CITATION,
117
+ homepage=_HOMEPAGE,
118
+ license="MIT License",
119
+
120
+ )
121
+
122
+ def _split_generators(self, dl_manager):
123
+
124
+ downloaded_files = dl_manager.download_and_extract(_URLS)
125
+
126
+ return [
127
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
128
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
129
+ ]
130
+
131
+ def _generate_examples(self, filepath):
132
+ key = 0
133
+ dataset = datasets.concatenate_datasets([datasets.Dataset.from_file(file) for file in filepath])
134
+ for idx, data in enumerate(dataset):
135
+ difficulty = data['difficulty']
136
+ skills = eval(data['skill_types'])
137
+ if self.config.filter_difficulties and not difficulty in self.config.subsets['difficulties']:
138
+ continue
139
+ if self.config.filter_skills:
140
+ valid_skills = self.config.subsets['skills']
141
+ if not bool(set(valid_skills) & set(skills)):
142
+ continue
143
+
144
+ yield key, data
145
+ key += 1
test/data-00000-of-00001.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39e312a5096f88929cbdd7324f06da41b1315d1b32f0d803dbe66dc1957c58fe
3
+ size 496140888
train/data-00000-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6d3c6c29f97e0ee4bbbe4ab577b851e7aa055905d6a935146128a0190cffa72
3
+ size 529629000
train/data-00001-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:613f9a94291a262cffe3a5fe0c51096d5a5617f84b19c5cda832e7bc23942be2
3
+ size 612948760
train/data-00002-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3af79af93fbad8a1e9d0a5ac37abf5c756719ab266a4b18c2db760377ff6e9fe
3
+ size 335200528
train/data-00003-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:629425025b6a006b220ffb3c3adf519fb99ec466308b2c943c59a4450ced733e
3
+ size 402713728
train/data-00004-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df8ba934fd73c9b0c928c0487cd2798ac5fd7a366e51043814ef3add1efbba64
3
+ size 417029960
train/data-00005-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e680fa3a2ea09465578478f6e051841986b9fdcdc24f2fa0777018629db4d5a
3
+ size 503103112
train/data-00006-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f2cc58103ab1ba44edb41109470e28787a3b68edc6deb543ba81ad8d7057fa2
3
+ size 447486992
train/data-00007-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:016c69cedd62ecbf853a9c83cf9ae40ae745cba6da6d6e8eb39cfb63c993a4c1
3
+ size 525654488
train/data-00008-of-00009.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e014ee60203819c59be1c08b1dec79eb71b1127373f2baba968f0aab7aba8e9
3
+ size 465600648