parquet-converter
commited on
Commit
•
13e569e
1
Parent(s):
e460461
Update parquet files
Browse files- code-completion-token-py150.zip → code-completion-token-py150/codexglue-test.parquet +2 -2
- code-completion-token-py150/codexglue-train.parquet +3 -0
- code-to-code-trans.zip → code-completion-token-py150/codexglue-validation.parquet +2 -2
- code-to-code-trans/codexglue-test.parquet +3 -0
- code-to-code-trans/codexglue-train.parquet +3 -0
- code-to-code-trans/codexglue-validation.parquet +3 -0
- codexglue.py +0 -211
- dataset_infos.json +0 -1
code-completion-token-py150.zip → code-completion-token-py150/codexglue-test.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4f07baa1817b12ae08d73b420f630503a68bee32f9487b304acd7b37a9d10991
|
3 |
+
size 58763574
|
code-completion-token-py150/codexglue-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b43622e1855b23e7fb0bb9945010fa61307249aaec396aa84dc4d0cdbb780129
|
3 |
+
size 112751107
|
code-to-code-trans.zip → code-completion-token-py150/codexglue-validation.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15963402eedfd471dae4770a7ddaedd2ece8a2abb0d4eab786fd7d1f917f887c
|
3 |
+
size 6889037
|
code-to-code-trans/codexglue-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fb8d08b09a9082d5885977979809e3e4971c665917ff4a172554645c7652dc83
|
3 |
+
size 163062
|
code-to-code-trans/codexglue-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a3844e2b2344563763a053f18627a759f7ee04268980a291f676900e16f40340
|
3 |
+
size 1733754
|
code-to-code-trans/codexglue-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7a71fa1f1af18c405e8c433618aacabe60cf1c5f9dc36c597f94354fe31202e3
|
3 |
+
size 86511
|
codexglue.py
DELETED
@@ -1,211 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 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 |
-
"""Wrapper for datasets in CodeXGLUE benchmark."""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
import json
|
20 |
-
import os
|
21 |
-
|
22 |
-
import datasets
|
23 |
-
|
24 |
-
|
25 |
-
_CITATION = """\
|
26 |
-
@article{Lu2021,
|
27 |
-
author = {Lu, Shuai and Guo, Daya and Ren, Shuo and Huang, Junjie and Svyatkovskiy, Alexey and Blanco, Ambrosio and Clement, Colin B. and Drain, Dawn and Jiang, Daxin and Tang, Duyu and Li, Ge and Zhou, Lidong and Shou, Linjun and Zhou, Long and Tufano, Michele and Gong, Ming and Zhou, Ming and Duan, Nan and Sundaresan, Neel and Deng, Shao Kun and Fu, Shengyu and Liu, Shujie},
|
28 |
-
year = {2021},
|
29 |
-
booktitle = {arXiv},
|
30 |
-
title = {CodeXGLUE - A Machine Learning Benchmark Dataset for Code Understanding and Generation}
|
31 |
-
}
|
32 |
-
"""
|
33 |
-
|
34 |
-
_DESCRIPTION = """\
|
35 |
-
CodeXGLUE is a benchmark dataset to foster machine learning research for program understanding and generation.
|
36 |
-
CodeXGLUE includes a collection of 10 tasks across 14 datasets and a platform for model evaluation and comparison.
|
37 |
-
"""
|
38 |
-
|
39 |
-
_HOMEPAGE = "https://microsoft.github.io/CodeXGLUE/"
|
40 |
-
|
41 |
-
_LICENSE = ""
|
42 |
-
|
43 |
-
# The HuggingFace dataset library don't host the datasets but only point to the original files
|
44 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
45 |
-
_URLs = {
|
46 |
-
'code-to-code-trans': "code-to-code-trans.zip",
|
47 |
-
'code-completion-token-py150': "code-completion-token-py150.zip",
|
48 |
-
}
|
49 |
-
|
50 |
-
|
51 |
-
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
52 |
-
class CodeXGLUE(datasets.GeneratorBasedBuilder):
|
53 |
-
"""TODO: Short description of my dataset."""
|
54 |
-
|
55 |
-
VERSION = datasets.Version("1.0.1")
|
56 |
-
|
57 |
-
# This is an example of a dataset with multiple configurations.
|
58 |
-
# If you don't want/need to define several sub-sets in your dataset,
|
59 |
-
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
60 |
-
|
61 |
-
# If you need to make complex sub-parts in the datasets with configurable options
|
62 |
-
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
63 |
-
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
64 |
-
|
65 |
-
# You will be able to load one or the other configurations in the following list with
|
66 |
-
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
67 |
-
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
68 |
-
BUILDER_CONFIGS = [
|
69 |
-
datasets.BuilderConfig(name="code-to-code-trans", version=VERSION,
|
70 |
-
description="Java to C-sharp translation task."),
|
71 |
-
datasets.BuilderConfig(name="code-completion-token-py150", version=VERSION,
|
72 |
-
description="Token compltetion task for Python"),
|
73 |
-
]
|
74 |
-
|
75 |
-
def _info(self):
|
76 |
-
if self.config.name == "code-to-code-trans": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
77 |
-
features = datasets.Features(
|
78 |
-
{
|
79 |
-
"java_code": datasets.Value("string"),
|
80 |
-
"cs_code": datasets.Value("string")
|
81 |
-
}
|
82 |
-
)
|
83 |
-
elif self.config.name == 'code-completion-token-py150':
|
84 |
-
features = datasets.Features(
|
85 |
-
{
|
86 |
-
"code": datasets.Value("string")
|
87 |
-
}
|
88 |
-
)
|
89 |
-
else: # This is an example to show how to have different features for "first_domain" and "second_domain"
|
90 |
-
features = datasets.Features(
|
91 |
-
{
|
92 |
-
"sentence": datasets.Value("string"),
|
93 |
-
"option2": datasets.Value("string"),
|
94 |
-
"second_domain_answer": datasets.Value("string")
|
95 |
-
# These are the features of your dataset like images, labels ...
|
96 |
-
}
|
97 |
-
)
|
98 |
-
return datasets.DatasetInfo(
|
99 |
-
# This is the description that will appear on the datasets page.
|
100 |
-
description=_DESCRIPTION,
|
101 |
-
# This defines the different columns of the dataset and their types
|
102 |
-
features=features, # Here we define them above because they are different between the two configurations
|
103 |
-
# If there's a common (input, target) tuple from the features,
|
104 |
-
# specify them here. They'll be used if as_supervised=True in
|
105 |
-
# builder.as_dataset.
|
106 |
-
supervised_keys=None,
|
107 |
-
# Homepage of the dataset for documentation
|
108 |
-
homepage=_HOMEPAGE,
|
109 |
-
# License for the dataset if available
|
110 |
-
license=_LICENSE,
|
111 |
-
# Citation for the dataset
|
112 |
-
citation=_CITATION,
|
113 |
-
)
|
114 |
-
|
115 |
-
def _split_generators(self, dl_manager):
|
116 |
-
"""Returns SplitGenerators."""
|
117 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS),
|
118 |
-
# the configuration selected by the user is in self.config.name
|
119 |
-
|
120 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
|
121 |
-
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with
|
122 |
-
# path to local files. By default the archives will be extracted and a path to a cached folder where they are
|
123 |
-
# extracted is returned instead of the archive
|
124 |
-
my_urls = _URLs[self.config.name]
|
125 |
-
data_dir = dl_manager.download_and_extract(my_urls)
|
126 |
-
|
127 |
-
if self.config.name == 'code-to-code-trans':
|
128 |
-
data_dir = os.path.join(data_dir, 'code-to-code-trans')
|
129 |
-
def get_kwargs(split_name: str):
|
130 |
-
return {
|
131 |
-
"data_paths": {
|
132 |
-
"java": os.path.join(data_dir, f'{split_name}.java-cs.txt.java'),
|
133 |
-
"cs": os.path.join(data_dir, f'{split_name}.java-cs.txt.cs'),
|
134 |
-
},
|
135 |
-
"split": split_name
|
136 |
-
}
|
137 |
-
|
138 |
-
return [
|
139 |
-
datasets.SplitGenerator(
|
140 |
-
name=datasets.Split.TRAIN,
|
141 |
-
# These kwargs will be passed to _generate_examples
|
142 |
-
gen_kwargs=get_kwargs('train')
|
143 |
-
),
|
144 |
-
datasets.SplitGenerator(
|
145 |
-
name=datasets.Split.TEST,
|
146 |
-
# These kwargs will be passed to _generate_examples
|
147 |
-
gen_kwargs=get_kwargs('test')
|
148 |
-
),
|
149 |
-
datasets.SplitGenerator(
|
150 |
-
name=datasets.Split.VALIDATION,
|
151 |
-
# These kwargs will be passed to _generate_examples
|
152 |
-
gen_kwargs=get_kwargs('valid')
|
153 |
-
),
|
154 |
-
]
|
155 |
-
elif self.config.name == 'code-completion-token-py150':
|
156 |
-
data_dir = os.path.join(data_dir, self.config.name)
|
157 |
-
|
158 |
-
def get_kwargs(split_name: str):
|
159 |
-
return {
|
160 |
-
"data_paths": {
|
161 |
-
"code": os.path.join(data_dir, f'{split_name}.txt')
|
162 |
-
},
|
163 |
-
"split": split_name
|
164 |
-
}
|
165 |
-
|
166 |
-
return [
|
167 |
-
datasets.SplitGenerator(
|
168 |
-
name=datasets.Split.TRAIN,
|
169 |
-
# These kwargs will be passed to _generate_examples
|
170 |
-
gen_kwargs=get_kwargs('train')
|
171 |
-
),
|
172 |
-
datasets.SplitGenerator(
|
173 |
-
name=datasets.Split.TEST,
|
174 |
-
# These kwargs will be passed to _generate_examples
|
175 |
-
gen_kwargs=get_kwargs('test')
|
176 |
-
),
|
177 |
-
datasets.SplitGenerator(
|
178 |
-
name=datasets.Split.VALIDATION,
|
179 |
-
# These kwargs will be passed to _generate_examples
|
180 |
-
gen_kwargs=get_kwargs('dev')
|
181 |
-
),
|
182 |
-
]
|
183 |
-
|
184 |
-
def _generate_examples(
|
185 |
-
self, data_paths, split
|
186 |
-
):
|
187 |
-
""" Yields examples as (key, example) tuples. """
|
188 |
-
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
189 |
-
# The `key` is here for legacy reason (tfds) and is not important in itself.
|
190 |
-
|
191 |
-
if self.config.name == 'code-to-code-trans':
|
192 |
-
java_path = data_paths['java']
|
193 |
-
cs_path = data_paths['cs']
|
194 |
-
with open(java_path, encoding="utf-8") as java_file:
|
195 |
-
with open(cs_path, encoding="utf-8") as cs_file:
|
196 |
-
java_lines = java_file.readlines()
|
197 |
-
cs_lines = cs_file.readlines()
|
198 |
-
for id_, (java_code, cs_code) in enumerate(zip(java_lines, cs_lines)):
|
199 |
-
java_code = java_code.strip()
|
200 |
-
cs_code = cs_code.strip()
|
201 |
-
yield id_, {
|
202 |
-
'java_code': java_code,
|
203 |
-
'cs_code': cs_code
|
204 |
-
}
|
205 |
-
elif self.config.name == 'code-completion-token-py150':
|
206 |
-
code_path = data_paths['code']
|
207 |
-
with open(code_path, encoding='utf-8') as code_file:
|
208 |
-
for _id, code_line in enumerate(code_file):
|
209 |
-
yield _id, {
|
210 |
-
'code': code_line
|
211 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"code-to-code-trans": {"description": "CodeXGLUE is a benchmark dataset to foster machine learning research for program understanding and generation. \nCodeXGLUE includes a collection of 10 tasks across 14 datasets and a platform for model evaluation and comparison.\n", "citation": "@article{Lu2021,\nauthor = {Lu, Shuai and Guo, Daya and Ren, Shuo and Huang, Junjie and Svyatkovskiy, Alexey and Blanco, Ambrosio and Clement, Colin B. and Drain, Dawn and Jiang, Daxin and Tang, Duyu and Li, Ge and Zhou, Lidong and Shou, Linjun and Zhou, Long and Tufano, Michele and Gong, Ming and Zhou, Ming and Duan, Nan and Sundaresan, Neel and Deng, Shao Kun and Fu, Shengyu and Liu, Shujie},\nyear = {2021},\nbooktitle = {arXiv},\ntitle = {CodeXGLUE - A Machine Learning Benchmark Dataset for Code Understanding and Generation}\n}\n", "homepage": "https://microsoft.github.io/CodeXGLUE/", "license": "", "features": {"java_code": {"dtype": "string", "id": null, "_type": "Value"}, "cs_code": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "code_xglue", "config_name": "code-to-code-trans", "version": {"version_str": "1.0.1", "description": null, "major": 1, "minor": 0, "patch": 1}, "splits": {"train": {"name": "train", "num_bytes": 4306167, "num_examples": 10295, "dataset_name": "code_xglue"}, "test": {"name": "test", "num_bytes": 412372, "num_examples": 1000, "dataset_name": "code_xglue"}, "validation": {"name": "validation", "num_bytes": 221932, "num_examples": 499, "dataset_name": "code_xglue"}}, "download_checksums": {"code-to-code-trans.zip": {"num_bytes": 1169662, "checksum": "91000596399aee3367aab5068452e1560ab131e2c0311f3ea367e692f46fb8ac"}}, "download_size": 1169662, "post_processing_size": null, "dataset_size": 4940471, "size_in_bytes": 6110133}, "code-completion-token-py150": {"description": "CodeXGLUE is a benchmark dataset to foster machine learning research for program understanding and generation. \nCodeXGLUE includes a collection of 10 tasks across 14 datasets and a platform for model evaluation and comparison.\n", "citation": "@article{Lu2021,\nauthor = {Lu, Shuai and Guo, Daya and Ren, Shuo and Huang, Junjie and Svyatkovskiy, Alexey and Blanco, Ambrosio and Clement, Colin B. and Drain, Dawn and Jiang, Daxin and Tang, Duyu and Li, Ge and Zhou, Lidong and Shou, Linjun and Zhou, Long and Tufano, Michele and Gong, Ming and Zhou, Ming and Duan, Nan and Sundaresan, Neel and Deng, Shao Kun and Fu, Shengyu and Liu, Shujie},\nyear = {2021},\nbooktitle = {arXiv},\ntitle = {CodeXGLUE - A Machine Learning Benchmark Dataset for Code Understanding and Generation}\n}\n", "homepage": "https://microsoft.github.io/CodeXGLUE/", "license": "", "features": {"code": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "code_xglue", "config_name": "code-completion-token-py150", "version": {"version_str": "1.0.1", "description": null, "major": 1, "minor": 0, "patch": 1}, "splits": {"train": {"name": "train", "num_bytes": 441358038, "num_examples": 95000, "dataset_name": "code_xglue"}, "test": {"name": "test", "num_bytes": 228741847, "num_examples": 50000, "dataset_name": "code_xglue"}, "validation": {"name": "validation", "num_bytes": 27069231, "num_examples": 5000, "dataset_name": "code_xglue"}}, "download_checksums": {"code-completion-token-py150.zip": {"num_bytes": 102464389, "checksum": "b7a59c977da228400c6d6fec10730b9b70030248325ea325230f56280ccddb8e"}}, "download_size": 102464389, "post_processing_size": null, "dataset_size": 697169116, "size_in_bytes": 799633505}}
|
|
|
|