albertvillanova HF staff commited on
Commit
b4f5252
1 Parent(s): 53a1654

Delete loading script

Browse files
code_x_glue_cc_code_completion_line.py DELETED
@@ -1,80 +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 = """Complete the unfinished line given previous context. Models are evaluated by exact match and edit similarity.
11
- We propose line completion task to test model's ability to autocomplete a line. Majority code completion systems behave well in token level completion, but fail in completing an unfinished line like a method call with specific parameters, a function signature, a loop condition, a variable definition and so on. When a software develop finish one or more tokens of the current line, the line level completion model is expected to generate the entire line of syntactically correct code.
12
- Line level code completion task shares the train/dev dataset with token level completion. After training a model on CodeCompletion-token, you could directly use it to test on line-level completion."""
13
-
14
- _CITATION = """@article{raychev2016probabilistic,
15
- title={Probabilistic Model for Code with Decision Trees},
16
- author={Raychev, Veselin and Bielik, Pavol and Vechev, Martin},
17
- journal={ACM SIGPLAN Notices},
18
- pages={731--747},
19
- year={2016},
20
- publisher={ACM New York, NY, USA}
21
- }
22
- @inproceedings{allamanis2013mining,
23
- title={Mining Source Code Repositories at Massive Scale using Language Modeling},
24
- author={Allamanis, Miltiadis and Sutton, Charles},
25
- booktitle={2013 10th Working Conference on Mining Software Repositories (MSR)},
26
- pages={207--216},
27
- year={2013},
28
- organization={IEEE}
29
- }"""
30
-
31
-
32
- class CodeXGlueCcCodeCompletionLineImpl(Child):
33
- _DESCRIPTION = _DESCRIPTION
34
- _CITATION = _CITATION
35
-
36
- _FEATURES = {
37
- "id": datasets.Value("int32"), # Index of the sample
38
- "input": datasets.Value("string"), # Input code string
39
- "gt": datasets.Value("string"), # Code string to be predicted
40
- }
41
-
42
- _SUPERVISED_KEYS = ["gt"]
43
-
44
- def generate_urls(self, split_name):
45
- yield "data", "test.json"
46
-
47
- def _generate_examples(self, split_name, file_paths):
48
- with open(file_paths["data"], encoding="utf-8") as f:
49
- for idx, line in enumerate(f):
50
- entry = json.loads(line)
51
- entry["id"] = idx
52
- yield idx, entry
53
-
54
-
55
- CLASS_MAPPING = {
56
- "CodeXGlueCcCodeCompletionLine": CodeXGlueCcCodeCompletionLineImpl,
57
- }
58
-
59
-
60
- class CodeXGlueCcCodeCompletionLine(datasets.GeneratorBasedBuilder):
61
- BUILDER_CONFIG_CLASS = datasets.BuilderConfig
62
- BUILDER_CONFIGS = [
63
- datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
64
- ]
65
-
66
- def _info(self):
67
- name = self.config.name
68
- info = DEFINITIONS[name]
69
- if info["class_name"] in CLASS_MAPPING:
70
- self.child = CLASS_MAPPING[info["class_name"]](info)
71
- else:
72
- raise RuntimeError(f"Unknown python class for dataset configuration {name}")
73
- ret = self.child._info()
74
- return ret
75
-
76
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
77
- return self.child._split_generators(dl_manager=dl_manager)
78
-
79
- def _generate_examples(self, split_name, file_paths):
80
- return self.child._generate_examples(split_name, file_paths)