albertvillanova HF staff commited on
Commit
30c54fb
1 Parent(s): 2412e45

Convert dataset to Parquet (#2)

Browse files

- Convert dataset to Parquet (e982b9682c4f84119f8ba220762c9d4909393b93)
- Add java data files (1e6aefe959af940ea675618e450d8825f2bbab0c)
- Add javascript data files (cb1e762ab2ae2dd00d228239c41c16f3bfd79ab0)
- Add php data files (fb2aefe974412675027b8d4c534428f4e16d2dd8)
- Add python data files (2beda6cc04e5980bf00bfe23da0a65905c0fd57f)
- Add ruby data files (3e39f7b17767132addd75a89b6f4007755b34175)
- Delete loading script (d83003bda752b63bb119b4fb0771aec63e90a147)
- Delete loading script auxiliary file (348604f11de74ba21a2dac80f21e0d6097bc78fa)
- Delete loading script auxiliary file (ae0ebeaac670237e8dd0ad00c50e745afab42a87)

README.md CHANGED
@@ -20,6 +20,13 @@ task_categories:
20
  task_ids:
21
  - slot-filling
22
  pretty_name: CodeXGlueCcClozeTestingMaxmin
 
 
 
 
 
 
 
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: 204997
37
  num_examples: 152
38
- download_size: 298893
39
- dataset_size: 204997
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: 785754
53
  num_examples: 482
54
- download_size: 1097733
55
- dataset_size: 785754
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: 594347
69
  num_examples: 272
70
- download_size: 836112
71
- dataset_size: 594347
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: 705477
85
  num_examples: 407
86
- download_size: 1010305
87
- dataset_size: 705477
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: 2566353
101
  num_examples: 1264
102
- download_size: 3577929
103
- dataset_size: 2566353
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: 48946
117
  num_examples: 38
118
- download_size: 67675
119
- dataset_size: 48946
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_maxmin"
129
 
20
  task_ids:
21
  - slot-filling
22
  pretty_name: CodeXGlueCcClozeTestingMaxmin
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: 204977
44
  num_examples: 152
45
+ download_size: 68965
46
+ dataset_size: 204977
47
  - config_name: java
48
  features:
49
  - name: id
56
  sequence: string
57
  splits:
58
  - name: train
59
+ num_bytes: 785734
60
  num_examples: 482
61
+ download_size: 250672
62
+ dataset_size: 785734
63
  - config_name: javascript
64
  features:
65
  - name: id
72
  sequence: string
73
  splits:
74
  - name: train
75
+ num_bytes: 594327
76
  num_examples: 272
77
+ download_size: 188271
78
+ dataset_size: 594327
79
  - config_name: php
80
  features:
81
  - name: id
88
  sequence: string
89
  splits:
90
  - name: train
91
+ num_bytes: 705457
92
  num_examples: 407
93
+ download_size: 211107
94
+ dataset_size: 705457
95
  - config_name: python
96
  features:
97
  - name: id
104
  sequence: string
105
  splits:
106
  - name: train
107
+ num_bytes: 2566333
108
  num_examples: 1264
109
+ download_size: 885488
110
+ dataset_size: 2566333
111
  - config_name: ruby
112
  features:
113
  - name: id
120
  sequence: string
121
  splits:
122
  - name: train
123
+ num_bytes: 48926
124
  num_examples: 38
125
+ download_size: 22528
126
+ dataset_size: 48926
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_maxmin"
154
 
code_x_glue_cc_cloze_testing_maxmin.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
- "CodeXGlueCcClozeTestingMaxmin": CodeXGlueCcClozeTestingImpl,
60
- }
61
-
62
-
63
- class CodeXGlueCcClozeTestingMaxmin(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": "CodeXGlueCcClozeTestingMaxmin",
4
- "dataset_type": "Code-Code",
5
- "description": "CodeXGLUE ClozeTesting-maxmin dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
6
- "dir_name": "ClozeTesting-maxmin",
7
- "name": "go",
8
- "parameters": {"language": "go"},
9
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
10
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-maxmin/data/cloze-maxmin/go",
11
- "sizes": {"train": 152},
12
- },
13
- "java": {
14
- "class_name": "CodeXGlueCcClozeTestingMaxmin",
15
- "dataset_type": "Code-Code",
16
- "description": "CodeXGLUE ClozeTesting-maxmin dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
17
- "dir_name": "ClozeTesting-maxmin",
18
- "name": "java",
19
- "parameters": {"language": "java"},
20
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
21
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-maxmin/data/cloze-maxmin/java",
22
- "sizes": {"train": 482},
23
- },
24
- "javascript": {
25
- "class_name": "CodeXGlueCcClozeTestingMaxmin",
26
- "dataset_type": "Code-Code",
27
- "description": "CodeXGLUE ClozeTesting-maxmin dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
28
- "dir_name": "ClozeTesting-maxmin",
29
- "name": "javascript",
30
- "parameters": {"language": "javascript"},
31
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
32
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-maxmin/data/cloze-maxmin/javascript",
33
- "sizes": {"train": 272},
34
- },
35
- "php": {
36
- "class_name": "CodeXGlueCcClozeTestingMaxmin",
37
- "dataset_type": "Code-Code",
38
- "description": "CodeXGLUE ClozeTesting-maxmin dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
39
- "dir_name": "ClozeTesting-maxmin",
40
- "name": "php",
41
- "parameters": {"language": "php"},
42
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
43
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-maxmin/data/cloze-maxmin/php",
44
- "sizes": {"train": 407},
45
- },
46
- "python": {
47
- "class_name": "CodeXGlueCcClozeTestingMaxmin",
48
- "dataset_type": "Code-Code",
49
- "description": "CodeXGLUE ClozeTesting-maxmin dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
50
- "dir_name": "ClozeTesting-maxmin",
51
- "name": "python",
52
- "parameters": {"language": "python"},
53
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
54
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-maxmin/data/cloze-maxmin/python",
55
- "sizes": {"train": 1264},
56
- },
57
- "ruby": {
58
- "class_name": "CodeXGlueCcClozeTestingMaxmin",
59
- "dataset_type": "Code-Code",
60
- "description": "CodeXGLUE ClozeTesting-maxmin dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
61
- "dir_name": "ClozeTesting-maxmin",
62
- "name": "ruby",
63
- "parameters": {"language": "ruby"},
64
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/ClozeTesting-maxmin",
65
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/ClozeTesting-maxmin/data/cloze-maxmin/ruby",
66
- "sizes": {"train": 38},
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:cf8765045260eee29183365baa6da5d18aded91b711aaba89208cd0d9d50f7f6
3
+ size 68965
java/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe4c876b680edb4d5091bec3738545ce6304313bb46598641e2f6511fb065a83
3
+ size 250672
javascript/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8df5849c7da7a844103d2089c55958c786d1cb52736dc8e94aef50d5b6a81501
3
+ size 188271
php/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c722363179a83e4d8ad2943fefe2c76ef899e99c781f295ca071462e15a2ef3
3
+ size 211107
python/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a6995187154d7c85f41a6bececd2d83f32fabf3e9fc8f9de0aeafe5b79e094f
3
+ size 885488
ruby/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2d4166f5c7006597aafb40a07a1b549c503b69f1fc08b487afba39b4976de64
3
+ size 22528