Convert dataset to Parquet

#3
by albertvillanova HF staff - opened
README.md CHANGED
@@ -20,6 +20,13 @@ task_categories:
20
  task_ids:
21
  - slot-filling
22
  pretty_name: CodeXGlueCcClozeTestingAll
 
 
 
 
 
 
 
23
  dataset_info:
24
  - config_name: go
25
  features:
@@ -33,10 +40,10 @@ dataset_info:
33
  sequence: string
34
  splits:
35
  - name: train
36
- num_bytes: 22409765
37
  num_examples: 25282
38
- download_size: 32578836
39
- dataset_size: 22409765
40
  - config_name: java
41
  features:
42
  - name: id
@@ -49,10 +56,10 @@ dataset_info:
49
  sequence: string
50
  splits:
51
  - name: train
52
- num_bytes: 40392965
53
  num_examples: 40492
54
- download_size: 56468936
55
- dataset_size: 40392965
56
  - config_name: javascript
57
  features:
58
  - name: id
@@ -65,10 +72,10 @@ dataset_info:
65
  sequence: string
66
  splits:
67
  - name: train
68
- num_bytes: 16090182
69
  num_examples: 13837
70
- download_size: 22665666
71
- dataset_size: 16090182
72
  - config_name: php
73
  features:
74
  - name: id
@@ -81,10 +88,10 @@ dataset_info:
81
  sequence: string
82
  splits:
83
  - name: train
84
- num_bytes: 51328988
85
  num_examples: 51930
86
- download_size: 73115225
87
- dataset_size: 51328988
88
  - config_name: python
89
  features:
90
  - name: id
@@ -97,10 +104,10 @@ dataset_info:
97
  sequence: string
98
  splits:
99
  - name: train
100
- num_bytes: 40631213
101
  num_examples: 40137
102
- download_size: 56766288
103
- dataset_size: 40631213
104
  - config_name: ruby
105
  features:
106
  - name: id
@@ -113,17 +120,35 @@ dataset_info:
113
  sequence: string
114
  splits:
115
  - name: train
116
- num_bytes: 3454904
117
  num_examples: 4437
118
- download_size: 4825752
119
- dataset_size: 3454904
120
- config_names:
121
- - go
122
- - java
123
- - javascript
124
- - php
125
- - python
126
- - ruby
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  ---
128
  # Dataset Card for "code_x_glue_cc_cloze_testing_all"
129
 
 
20
  task_ids:
21
  - slot-filling
22
  pretty_name: CodeXGlueCcClozeTestingAll
23
+ config_names:
24
+ - go
25
+ - java
26
+ - javascript
27
+ - php
28
+ - python
29
+ - ruby
30
  dataset_info:
31
  - config_name: go
32
  features:
 
40
  sequence: string
41
  splits:
42
  - name: train
43
+ num_bytes: 22409705
44
  num_examples: 25282
45
+ download_size: 7317578
46
+ dataset_size: 22409705
47
  - config_name: java
48
  features:
49
  - name: id
 
56
  sequence: string
57
  splits:
58
  - name: train
59
+ num_bytes: 40392865
60
  num_examples: 40492
61
+ download_size: 13540081
62
+ dataset_size: 40392865
63
  - config_name: javascript
64
  features:
65
  - name: id
 
72
  sequence: string
73
  splits:
74
  - name: train
75
+ num_bytes: 16090142
76
  num_examples: 13837
77
+ download_size: 5380631
78
+ dataset_size: 16090142
79
  - config_name: php
80
  features:
81
  - name: id
 
88
  sequence: string
89
  splits:
90
  - name: train
91
+ num_bytes: 51328868
92
  num_examples: 51930
93
+ download_size: 16553882
94
+ dataset_size: 51328868
95
  - config_name: python
96
  features:
97
  - name: id
 
104
  sequence: string
105
  splits:
106
  - name: train
107
+ num_bytes: 40631113
108
  num_examples: 40137
109
+ download_size: 15081309
110
+ dataset_size: 40631113
111
  - config_name: ruby
112
  features:
113
  - name: id
 
120
  sequence: string
121
  splits:
122
  - name: train
123
+ num_bytes: 3454884
124
  num_examples: 4437
125
+ download_size: 1301455
126
+ dataset_size: 3454884
127
+ configs:
128
+ - config_name: go
129
+ data_files:
130
+ - split: train
131
+ path: go/train-*
132
+ - config_name: java
133
+ data_files:
134
+ - split: train
135
+ path: java/train-*
136
+ - config_name: javascript
137
+ data_files:
138
+ - split: train
139
+ path: javascript/train-*
140
+ - config_name: php
141
+ data_files:
142
+ - split: train
143
+ path: php/train-*
144
+ - config_name: python
145
+ data_files:
146
+ - split: train
147
+ path: python/train-*
148
+ - config_name: ruby
149
+ data_files:
150
+ - split: train
151
+ path: ruby/train-*
152
  ---
153
  # Dataset Card for "code_x_glue_cc_cloze_testing_all"
154
 
code_x_glue_cc_cloze_testing_all.py DELETED
@@ -1,83 +0,0 @@
1
- import json
2
- from typing import List
3
-
4
- import datasets
5
-
6
- from .common import Child
7
- from .generated_definitions import DEFINITIONS
8
-
9
-
10
- _DESCRIPTION = """Cloze tests are widely adopted in Natural Languages Processing to evaluate the performance of the trained language models. The task is aimed to predict the answers for the blank with the context of the blank, which can be formulated as a multi-choice classification problem.
11
- Here we present the two cloze testing datasets in code domain with six different programming languages: ClozeTest-maxmin and ClozeTest-all. Each instance in the dataset contains a masked code function, its docstring and the target word.
12
- The only difference between ClozeTest-maxmin and ClozeTest-all is their selected words sets, where ClozeTest-maxmin only contains two words while ClozeTest-all contains 930 words."""
13
-
14
- _CITATION = """@article{CodeXGLUE,
15
- title={CodeXGLUE: An Open Challenge for Code Intelligence},
16
- journal={arXiv},
17
- year={2020},
18
- }
19
- @article{feng2020codebert,
20
- title={CodeBERT: A Pre-Trained Model for Programming and Natural Languages},
21
- author={Feng, Zhangyin and Guo, Daya and Tang, Duyu and Duan, Nan and Feng, Xiaocheng and Gong, Ming and Shou, Linjun and Qin, Bing and Liu, Ting and Jiang, Daxin and others},
22
- journal={arXiv preprint arXiv:2002.08155},
23
- year={2020}
24
- }
25
- @article{husain2019codesearchnet,
26
- title={CodeSearchNet Challenge: Evaluating the State of Semantic Code Search},
27
- author={Husain, Hamel and Wu, Ho-Hsiang and Gazit, Tiferet and Allamanis, Miltiadis and Brockschmidt, Marc},
28
- journal={arXiv preprint arXiv:1909.09436},
29
- year={2019}
30
- }"""
31
-
32
-
33
- class CodeXGlueCcClozeTestingImpl(Child):
34
- _DESCRIPTION = _DESCRIPTION
35
- _CITATION = _CITATION
36
-
37
- _FEATURES = {
38
- "id": datasets.Value("int32"), # Index of the sample
39
- "idx": datasets.Value("string"), # Original index in the dataset
40
- "nl_tokens": datasets.features.Sequence(datasets.Value("string")), # Natural language tokens
41
- "pl_tokens": datasets.features.Sequence(datasets.Value("string")), # Programming language tokens
42
- }
43
-
44
- def generate_urls(self, split_name):
45
- yield "data", "clozeTest.json"
46
-
47
- def _generate_examples(self, split_name, file_paths):
48
- with open(file_paths["data"], encoding="utf-8") as f:
49
- j = json.load(f)
50
- index = 0
51
- for entry in j:
52
- yield index, dict(
53
- id=index, idx=entry["idx"], nl_tokens=entry["nl_tokens"], pl_tokens=entry["pl_tokens"]
54
- )
55
- index += 1
56
-
57
-
58
- CLASS_MAPPING = {
59
- "CodeXGlueCcClozeTestingAll": CodeXGlueCcClozeTestingImpl,
60
- }
61
-
62
-
63
- class CodeXGlueCcClozeTestingAll(datasets.GeneratorBasedBuilder):
64
- BUILDER_CONFIG_CLASS = datasets.BuilderConfig
65
- BUILDER_CONFIGS = [
66
- datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
67
- ]
68
-
69
- def _info(self):
70
- name = self.config.name
71
- info = DEFINITIONS[name]
72
- if info["class_name"] in CLASS_MAPPING:
73
- self.child = CLASS_MAPPING[info["class_name"]](info)
74
- else:
75
- raise RuntimeError(f"Unknown python class for dataset configuration {name}")
76
- ret = self.child._info()
77
- return ret
78
-
79
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
80
- return self.child._split_generators(dl_manager=dl_manager)
81
-
82
- def _generate_examples(self, split_name, file_paths):
83
- return self.child._generate_examples(split_name, file_paths)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
common.py DELETED
@@ -1,75 +0,0 @@
1
- from typing import List
2
-
3
- import datasets
4
-
5
-
6
- # Citation, taken from https://github.com/microsoft/CodeXGLUE
7
- _DEFAULT_CITATION = """@article{CodeXGLUE,
8
- title={CodeXGLUE: A Benchmark Dataset and Open Challenge for Code Intelligence},
9
- year={2020},}"""
10
-
11
-
12
- class Child:
13
- _DESCRIPTION = None
14
- _FEATURES = None
15
- _CITATION = None
16
- SPLITS = {"train": datasets.Split.TRAIN}
17
- _SUPERVISED_KEYS = None
18
-
19
- def __init__(self, info):
20
- self.info = info
21
-
22
- def homepage(self):
23
- return self.info["project_url"]
24
-
25
- def _info(self):
26
- # This is the description that will appear on the datasets page.
27
- return datasets.DatasetInfo(
28
- description=self.info["description"] + "\n\n" + self._DESCRIPTION,
29
- features=datasets.Features(self._FEATURES),
30
- homepage=self.homepage(),
31
- citation=self._CITATION or _DEFAULT_CITATION,
32
- supervised_keys=self._SUPERVISED_KEYS,
33
- )
34
-
35
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
36
- SPLITS = self.SPLITS
37
- _URL = self.info["raw_url"]
38
- urls_to_download = {}
39
- for split in SPLITS:
40
- if split not in urls_to_download:
41
- urls_to_download[split] = {}
42
-
43
- for key, url in self.generate_urls(split):
44
- if not url.startswith("http"):
45
- url = _URL + "/" + url
46
- urls_to_download[split][key] = url
47
-
48
- downloaded_files = {}
49
- for k, v in urls_to_download.items():
50
- downloaded_files[k] = dl_manager.download_and_extract(v)
51
-
52
- return [
53
- datasets.SplitGenerator(
54
- name=SPLITS[k],
55
- gen_kwargs={"split_name": k, "file_paths": downloaded_files[k]},
56
- )
57
- for k in SPLITS
58
- ]
59
-
60
- def check_empty(self, entries):
61
- all_empty = all([v == "" for v in entries.values()])
62
- all_non_empty = all([v != "" for v in entries.values()])
63
-
64
- if not all_non_empty and not all_empty:
65
- raise RuntimeError("Parallel data files should have the same number of lines.")
66
-
67
- return all_empty
68
-
69
-
70
- class TrainValidTestChild(Child):
71
- SPLITS = {
72
- "train": datasets.Split.TRAIN,
73
- "valid": datasets.Split.VALIDATION,
74
- "test": datasets.Split.TEST,
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
generated_definitions.py DELETED
@@ -1,68 +0,0 @@
1
- DEFINITIONS = {
2
- "go": {
3
- "class_name": "CodeXGlueCcClozeTestingAll",
4
- "dataset_type": "Code-Code",
5
- "description": "CodeXGLUE ClozeTesting-all dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
6
- "dir_name": "ClozeTesting-all",
7
- "name": "go",
8
- "parameters": {"language": "go"},
9
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
10
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-all/data/cloze-all/go",
11
- "sizes": {"train": 25282},
12
- },
13
- "java": {
14
- "class_name": "CodeXGlueCcClozeTestingAll",
15
- "dataset_type": "Code-Code",
16
- "description": "CodeXGLUE ClozeTesting-all dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
17
- "dir_name": "ClozeTesting-all",
18
- "name": "java",
19
- "parameters": {"language": "java"},
20
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
21
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-all/data/cloze-all/java",
22
- "sizes": {"train": 40492},
23
- },
24
- "javascript": {
25
- "class_name": "CodeXGlueCcClozeTestingAll",
26
- "dataset_type": "Code-Code",
27
- "description": "CodeXGLUE ClozeTesting-all dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
28
- "dir_name": "ClozeTesting-all",
29
- "name": "javascript",
30
- "parameters": {"language": "javascript"},
31
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
32
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-all/data/cloze-all/javascript",
33
- "sizes": {"train": 13837},
34
- },
35
- "php": {
36
- "class_name": "CodeXGlueCcClozeTestingAll",
37
- "dataset_type": "Code-Code",
38
- "description": "CodeXGLUE ClozeTesting-all dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
39
- "dir_name": "ClozeTesting-all",
40
- "name": "php",
41
- "parameters": {"language": "php"},
42
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
43
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-all/data/cloze-all/php",
44
- "sizes": {"train": 51930},
45
- },
46
- "python": {
47
- "class_name": "CodeXGlueCcClozeTestingAll",
48
- "dataset_type": "Code-Code",
49
- "description": "CodeXGLUE ClozeTesting-all dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
50
- "dir_name": "ClozeTesting-all",
51
- "name": "python",
52
- "parameters": {"language": "python"},
53
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
54
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-all/data/cloze-all/python",
55
- "sizes": {"train": 40137},
56
- },
57
- "ruby": {
58
- "class_name": "CodeXGlueCcClozeTestingAll",
59
- "dataset_type": "Code-Code",
60
- "description": "CodeXGLUE ClozeTesting-all dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
61
- "dir_name": "ClozeTesting-all",
62
- "name": "ruby",
63
- "parameters": {"language": "ruby"},
64
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-all",
65
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-all/data/cloze-all/ruby",
66
- "sizes": {"train": 4437},
67
- },
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
go/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b48bb7da5a8b45b485c3f853de6aead556406e7d40c0bddd3137c3d15429a9b
3
+ size 7317578
java/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:036d18c10c011f68f17f8c40bf0e401140b3dd64169e51df7383d70f3a0e7e8e
3
+ size 13540081
javascript/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f2aea05d14d935e9c967f6a0f04a18e44f332c03463803d81b341091c4d48e5
3
+ size 5380631
php/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f206191eda466ab06b1dc543a392d5c2be7ec402786fb6615650b438b6c5586c
3
+ size 16553882
python/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b574e890abf99793a9b61c7c582f8ae589dd9b5c2a2d11de9d76e4354b1a486c
3
+ size 15081309
ruby/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40e329981f9b28e4320219fe28692503fcd9eecd77c7170c34fd29c636748301
3
+ size 1301455