system HF staff commited on
Commit
e890641
0 Parent(s):

Update files from the datasets library (from 1.8.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.8.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - found
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ - code
9
+ licenses:
10
+ - other-C-UDA
11
+ multilinguality:
12
+ - other-programming-languages
13
+ size_categories:
14
+ - 100K<n<1M
15
+ source_datasets:
16
+ - original
17
+ task_categories:
18
+ - conditional-text-generation
19
+ task_ids:
20
+ - machine-translation
21
+ ---
22
+ # Dataset Card for "code_x_glue_tc_text_to_code"
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks and Leaderboards](#supported-tasks)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-fields)
32
+ - [Data Splits](#data-splits-sample-size)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+ - [Contributions](#contributions)
47
+
48
+ ## Dataset Description
49
+
50
+ - **Homepage:** https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code
51
+
52
+ ### Dataset Summary
53
+
54
+ CodeXGLUE text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code
55
+
56
+ The dataset we use is crawled and filtered from Microsoft Documentation, whose document located at https://github.com/MicrosoftDocs/.
57
+
58
+ ### Supported Tasks and Leaderboards
59
+
60
+ - `machine-translation`: The dataset can be used to train a model for generating Java code from an **English** natural language description.
61
+
62
+ ### Languages
63
+
64
+ - Java **programming** language
65
+
66
+ ## Dataset Structure
67
+
68
+ ### Data Instances
69
+
70
+ An example of 'train' looks as follows.
71
+ ```
72
+ {
73
+ "code": "boolean function ( ) { return isParsed ; }",
74
+ "id": 0,
75
+ "nl": "check if details are parsed . concode_field_sep Container parent concode_elem_sep boolean isParsed concode_elem_sep long offset concode_elem_sep long contentStartPosition concode_elem_sep ByteBuffer deadBytes concode_elem_sep boolean isRead concode_elem_sep long memMapSize concode_elem_sep Logger LOG concode_elem_sep byte[] userType concode_elem_sep String type concode_elem_sep ByteBuffer content concode_elem_sep FileChannel fileChannel concode_field_sep Container getParent concode_elem_sep byte[] getUserType concode_elem_sep void readContent concode_elem_sep long getOffset concode_elem_sep long getContentSize concode_elem_sep void getContent concode_elem_sep void setDeadBytes concode_elem_sep void parse concode_elem_sep void getHeader concode_elem_sep long getSize concode_elem_sep void parseDetails concode_elem_sep String getType concode_elem_sep void _parseDetails concode_elem_sep String getPath concode_elem_sep boolean verify concode_elem_sep void setParent concode_elem_sep void getBox concode_elem_sep boolean isSmallBox"
76
+ }
77
+ ```
78
+
79
+ ### Data Fields
80
+
81
+ In the following each data field in go is explained for each config. The data fields are the same among all splits.
82
+
83
+ #### default
84
+
85
+ |field name| type | description |
86
+ |----------|------|---------------------------------------------|
87
+ |id |int32 | Index of the sample |
88
+ |nl |string| The natural language description of the task|
89
+ |code |string| The programming source code for the task |
90
+
91
+ ### Data Splits
92
+
93
+ | name |train |validation|test|
94
+ |-------|-----:|---------:|---:|
95
+ |default|100000| 2000|2000|
96
+
97
+ ## Dataset Creation
98
+
99
+ ### Curation Rationale
100
+
101
+ [More Information Needed]
102
+
103
+ ### Source Data
104
+
105
+ #### Initial Data Collection and Normalization
106
+
107
+ [More Information Needed]
108
+
109
+ #### Who are the source language producers?
110
+
111
+ [More Information Needed]
112
+
113
+ ### Annotations
114
+
115
+ #### Annotation process
116
+
117
+ [More Information Needed]
118
+
119
+ #### Who are the annotators?
120
+
121
+ [More Information Needed]
122
+
123
+ ### Personal and Sensitive Information
124
+
125
+ [More Information Needed]
126
+
127
+ ## Considerations for Using the Data
128
+
129
+ ### Social Impact of Dataset
130
+
131
+ [More Information Needed]
132
+
133
+ ### Discussion of Biases
134
+
135
+ [More Information Needed]
136
+
137
+ ### Other Known Limitations
138
+
139
+ [More Information Needed]
140
+
141
+ ## Additional Information
142
+
143
+ ### Dataset Curators
144
+
145
+ https://github.com/microsoft, https://github.com/madlag
146
+
147
+ ### Licensing Information
148
+
149
+ Computational Use of Data Agreement (C-UDA) License.
150
+
151
+ ### Citation Information
152
+
153
+ ```
154
+ @article{iyer2018mapping,
155
+ title={Mapping language to code in programmatic context},
156
+ author={Iyer, Srinivasan and Konstas, Ioannis and Cheung, Alvin and Zettlemoyer, Luke},
157
+ journal={arXiv preprint arXiv:1808.09588},
158
+ year={2018}
159
+ }
160
+ ```
161
+
162
+ ### Contributions
163
+
164
+ Thanks to @madlag (and partly also @ncoop57) for adding this dataset.
code_x_glue_tc_text_to_code.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = """We use concode dataset which is a widely used code generation dataset from Iyer's EMNLP 2018 paper Mapping Language to Code in Programmatic Context. See paper for details."""
11
+ _CITATION = """@article{iyer2018mapping,
12
+ title={Mapping language to code in programmatic context},
13
+ author={Iyer, Srinivasan and Konstas, Ioannis and Cheung, Alvin and Zettlemoyer, Luke},
14
+ journal={arXiv preprint arXiv:1808.09588},
15
+ year={2018}
16
+ }"""
17
+
18
+
19
+ class CodeXGlueTcTextToCodeImpl(Child):
20
+ _DESCRIPTION = _DESCRIPTION
21
+ _CITATION = _CITATION
22
+
23
+ _FEATURES = {
24
+ "id": datasets.Value("int32"), # Index of the sample
25
+ "nl": datasets.Value("string"), # The natural language description of the task
26
+ "code": datasets.Value("string"), # The programming source code for the task
27
+ }
28
+
29
+ _SUPERVISED_KEYS = ["code"]
30
+
31
+ SPLITS = {"train": datasets.Split.TRAIN, "dev": datasets.Split.VALIDATION, "test": datasets.Split.TEST}
32
+
33
+ def generate_urls(self, split_name):
34
+ yield "data", f"concode/{split_name}.json"
35
+
36
+ def _generate_examples(self, split_name, file_paths):
37
+ with open(file_paths["data"], encoding="utf-8") as f:
38
+ for idx, line in enumerate(f):
39
+ entry = json.loads(line)
40
+ entry["id"] = idx
41
+ yield idx, entry
42
+
43
+
44
+ CLASS_MAPPING = {
45
+ "CodeXGlueTcTextToCode": CodeXGlueTcTextToCodeImpl,
46
+ }
47
+
48
+
49
+ class CodeXGlueTcTextToCode(datasets.GeneratorBasedBuilder):
50
+ BUILDER_CONFIG_CLASS = datasets.BuilderConfig
51
+ BUILDER_CONFIGS = [
52
+ datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
53
+ ]
54
+
55
+ def _info(self):
56
+ name = self.config.name
57
+ info = DEFINITIONS[name]
58
+ if info["class_name"] in CLASS_MAPPING:
59
+ self.child = CLASS_MAPPING[info["class_name"]](info)
60
+ else:
61
+ raise RuntimeError(f"Unknown python class for dataset configuration {name}")
62
+ ret = self.child._info()
63
+ return ret
64
+
65
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
66
+ return self.child._split_generators(dl_manager=dl_manager)
67
+
68
+ def _generate_examples(self, split_name, file_paths):
69
+ return self.child._generate_examples(split_name, file_paths)
common.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"default": {"description": "CodeXGLUE text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code\n\nWe use concode dataset which is a widely used code generation dataset from Iyer's EMNLP 2018 paper Mapping Language to Code in Programmatic Context. See paper for details.", "citation": "@article{iyer2018mapping,\ntitle={Mapping language to code in programmatic context},\nauthor={Iyer, Srinivasan and Konstas, Ioannis and Cheung, Alvin and Zettlemoyer, Luke},\njournal={arXiv preprint arXiv:1808.09588},\nyear={2018}\n}", "homepage": "https://github.com/madlag/CodeXGLUE/tree/main/Text-Code/text-to-code", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "nl": {"dtype": "string", "id": null, "_type": "Value"}, "code": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "code", "output": ""}, "task_templates": null, "builder_name": "code_x_glue_tc_text_to_code", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 96225611, "num_examples": 100000, "dataset_name": "code_x_glue_tc_text_to_code"}, "validation": {"name": "validation", "num_bytes": 1749751, "num_examples": 2000, "dataset_name": "code_x_glue_tc_text_to_code"}, "test": {"name": "test", "num_bytes": 1609306, "num_examples": 2000, "dataset_name": "code_x_glue_tc_text_to_code"}}, "download_checksums": {"https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset/concode/train.json": {"num_bytes": 97365680, "checksum": "a130f375c415932ffe0188e76b3c8aaef92b1b52d228e342328657b9ae97f17f"}, "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset/concode/dev.json": {"num_bytes": 1772646, "checksum": "cd4f91cfaa12a886a1d7acaf92eaf8ab066845c37a9221e56634d345958c922a"}, "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset/concode/test.json": {"num_bytes": 1631312, "checksum": "3323b1d723c2183a0ef4693413d25ef5a6b988b50b37b2f401de6c2c5c55159f"}}, "download_size": 100769638, "post_processing_size": null, "dataset_size": 99584668, "size_in_bytes": 200354306}}
dummy/default/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7b0dd38ceaf2e9e89360ef81492a730865ddde60823af5b9b95380a32db20de
3
+ size 4674
generated_definitions.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DEFINITIONS = {
2
+ "default": {
3
+ "class_name": "CodeXGlueTcTextToCode",
4
+ "dataset_type": "Text-Code",
5
+ "description": "CodeXGLUE text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code",
6
+ "dir_name": "text-to-code",
7
+ "name": "default",
8
+ "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Text-Code/text-to-code",
9
+ "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset",
10
+ "sizes": {"test": 2000, "train": 100000, "validation": 2000},
11
+ }
12
+ }