albertvillanova HF staff commited on
Commit
706a9c9
1 Parent(s): 2cc7b8f

Convert dataset to Parquet (#3)

Browse files

- Convert dataset to Parquet (07ecd480fd82c5ed63432a5acfe5a1ed0965d0e2)
- Delete loading script (55824d81f085d0f456dd6ebc9702d37af02425ef)
- Delete loading script auxiliary file (35e27b7c70ba03996789a7a74edbb6489e195c1c)
- Delete loading script auxiliary file (5070ee2a98326313e2e257747c8d2326388d721a)

README.md CHANGED
@@ -34,16 +34,25 @@ dataset_info:
34
  dtype: bool
35
  splits:
36
  - name: train
37
- num_bytes: 2888035757
38
  num_examples: 901028
39
  - name: validation
40
- num_bytes: 1371399694
41
  num_examples: 415416
42
  - name: test
43
- num_bytes: 1220662901
44
  num_examples: 415416
45
- download_size: 47955874
46
- dataset_size: 5480098352
 
 
 
 
 
 
 
 
 
47
  ---
48
  # Dataset Card for "code_x_glue_cc_clone_detection_big_clone_bench"
49
 
 
34
  dtype: bool
35
  splits:
36
  - name: train
37
+ num_bytes: 2888035029
38
  num_examples: 901028
39
  - name: validation
40
+ num_bytes: 1371399358
41
  num_examples: 415416
42
  - name: test
43
+ num_bytes: 1220662565
44
  num_examples: 415416
45
+ download_size: 1279275281
46
+ dataset_size: 5480096952
47
+ configs:
48
+ - config_name: default
49
+ data_files:
50
+ - split: train
51
+ path: data/train-*
52
+ - split: validation
53
+ path: data/validation-*
54
+ - split: test
55
+ path: data/test-*
56
  ---
57
  # Dataset Card for "code_x_glue_cc_clone_detection_big_clone_bench"
58
 
code_x_glue_cc_clone_detection_big_clone_bench.py DELETED
@@ -1,95 +0,0 @@
1
- from typing import List
2
-
3
- import datasets
4
-
5
- from .common import TrainValidTestChild
6
- from .generated_definitions import DEFINITIONS
7
-
8
-
9
- _DESCRIPTION = """Given two codes as the input, the task is to do binary classification (0/1), where 1 stands for semantic equivalence and 0 for others. Models are evaluated by F1 score.
10
- The dataset we use is BigCloneBench and filtered following the paper Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree."""
11
-
12
- _CITATION = """@inproceedings{svajlenko2014towards,
13
- title={Towards a big data curated benchmark of inter-project code clones},
14
- author={Svajlenko, Jeffrey and Islam, Judith F and Keivanloo, Iman and Roy, Chanchal K and Mia, Mohammad Mamun},
15
- booktitle={2014 IEEE International Conference on Software Maintenance and Evolution},
16
- pages={476--480},
17
- year={2014},
18
- organization={IEEE}
19
- }
20
-
21
- @inproceedings{wang2020detecting,
22
- title={Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree},
23
- author={Wang, Wenhan and Li, Ge and Ma, Bo and Xia, Xin and Jin, Zhi},
24
- booktitle={2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER)},
25
- pages={261--271},
26
- year={2020},
27
- organization={IEEE}
28
- }"""
29
-
30
-
31
- class CodeXGlueCcCloneDetectionBigCloneBenchImpl(TrainValidTestChild):
32
- _DESCRIPTION = _DESCRIPTION
33
- _CITATION = _CITATION
34
-
35
- _FEATURES = {
36
- "id": datasets.Value("int32"), # Index of the sample
37
- "id1": datasets.Value("int32"), # The first function id
38
- "id2": datasets.Value("int32"), # The second function id
39
- "func1": datasets.Value("string"), # The full text of the first function
40
- "func2": datasets.Value("string"), # The full text of the second function
41
- "label": datasets.Value("bool"), # 1 is the functions are not equivalent, 0 otherwise
42
- }
43
-
44
- _SUPERVISED_KEYS = ["label"]
45
-
46
- def generate_urls(self, split_name):
47
- yield "index", f"{split_name}.txt"
48
- yield "data", "data.jsonl"
49
-
50
- def _generate_examples(self, split_name, file_paths):
51
- import json
52
-
53
- js_all = {}
54
-
55
- with open(file_paths["data"], encoding="utf-8") as f:
56
- for idx, line in enumerate(f):
57
- entry = json.loads(line)
58
- js_all[int(entry["idx"])] = entry["func"]
59
-
60
- with open(file_paths["index"], encoding="utf-8") as f:
61
- for idx, line in enumerate(f):
62
- line = line.strip()
63
- idx1, idx2, label = [int(i) for i in line.split("\t")]
64
- func1 = js_all[idx1]
65
- func2 = js_all[idx2]
66
-
67
- yield idx, dict(id=idx, id1=idx1, id2=idx2, func1=func1, func2=func2, label=(label == 1))
68
-
69
-
70
- CLASS_MAPPING = {
71
- "CodeXGlueCcCloneDetectionBigCloneBench": CodeXGlueCcCloneDetectionBigCloneBenchImpl,
72
- }
73
-
74
-
75
- class CodeXGlueCcCloneDetectionBigCloneBench(datasets.GeneratorBasedBuilder):
76
- BUILDER_CONFIG_CLASS = datasets.BuilderConfig
77
- BUILDER_CONFIGS = [
78
- datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
79
- ]
80
-
81
- def _info(self):
82
- name = self.config.name
83
- info = DEFINITIONS[name]
84
- if info["class_name"] in CLASS_MAPPING:
85
- self.child = CLASS_MAPPING[info["class_name"]](info)
86
- else:
87
- raise RuntimeError(f"Unknown python class for dataset configuration {name}")
88
- ret = self.child._info()
89
- return ret
90
-
91
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
92
- return self.child._split_generators(dl_manager=dl_manager)
93
-
94
- def _generate_examples(self, split_name, file_paths):
95
- 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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/test-00000-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa6070bbcf222e8820ffd54394c58fd7415a3047b53a8600c26f13fcc2d3e237
3
+ size 73274624
data/test-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3041c74294df1cf3dedef1f1e8cd48ec8b5fac4f9f8ce3f2cf23fa89b8c0e22f
3
+ size 73531556
data/test-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cabaa1a2baec5704465960dbac045ef6a1e9ea321b1282cc00d1d239c2e434d5
3
+ size 73451480
data/train-00000-of-00006.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e697520aa623001cdead968ea33dbedc151eab09a799edc9a97e8f41737d97c2
3
+ size 135781192
data/train-00001-of-00006.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14d12e9a8d668c3653fb40a315a05dc125e21d5a4bcda877784d6948efa8a308
3
+ size 141782535
data/train-00002-of-00006.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25fc34400a381b530c9aa5e018c1b376116a31fb6d957e67c07eb29499391700
3
+ size 136258214
data/train-00003-of-00006.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9628497bef6e09c95ebec0b1c1420ef26975aa97c544607fb2cc424fc889a54
3
+ size 135629068
data/train-00004-of-00006.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1f9e30aa06db2a4bc38b2f27e087c930d1339c276890927f66ea860f2619735
3
+ size 135570525
data/train-00005-of-00006.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0987845a65b404e24b5f872a0d317f7dea05ff348494fec1f70facd6cad5107f
3
+ size 135937619
data/validation-00000-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78977bd996d61415ba5a264d48df3cb7f37217ebbdc133c1135a570c88e84fe8
3
+ size 79253146
data/validation-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80d7d626a51e55aafd30f52a2ca3d5d3421f9659dbaa9f89516044e9ce7fbf67
3
+ size 79386757
data/validation-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc34145b23539b34f86d05c62119d123287f128933217c7c4f3e92be1a0b3f92
3
+ size 79418565
generated_definitions.py DELETED
@@ -1,12 +0,0 @@
1
- DEFINITIONS = {
2
- "default": {
3
- "class_name": "CodeXGlueCcCloneDetectionBigCloneBench",
4
- "dataset_type": "Code-Code",
5
- "description": "CodeXGLUE Clone-detection-BigCloneBench dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench",
6
- "dir_name": "Clone-detection-BigCloneBench",
7
- "name": "default",
8
- "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench",
9
- "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-BigCloneBench/dataset",
10
- "sizes": {"test": 415416, "train": 901028, "validation": 415416},
11
- }
12
- }