Commit
6ec9bc5
·
verified ·
0 Parent(s):

Duplicate from google-research-datasets/eth_py150_open

Browse files

Co-authored-by: Parquet-converter (BOT) <parquet-converter@users.noreply.huggingface.co>

Files changed (3) hide show
  1. .gitattributes +27 -0
  2. README.md +186 -0
  3. eth_py150_open.py +134 -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,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - machine-generated
6
+ language:
7
+ - en
8
+ license:
9
+ - apache-2.0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 100K<n<1M
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - other
18
+ task_ids: []
19
+ paperswithcode_id: eth-py150-open
20
+ pretty_name: ethpy150open
21
+ tags:
22
+ - contextual-embeddings
23
+ dataset_info:
24
+ features:
25
+ - name: filepath
26
+ dtype: string
27
+ - name: license
28
+ dtype: string
29
+ config_name: eth_py150_open
30
+ splits:
31
+ - name: train
32
+ num_bytes: 5414978
33
+ num_examples: 74749
34
+ - name: test
35
+ num_bytes: 3006199
36
+ num_examples: 41457
37
+ - name: validation
38
+ num_bytes: 598524
39
+ num_examples: 8302
40
+ download_size: 13875671
41
+ dataset_size: 9019701
42
+ ---
43
+
44
+ # Dataset Card for ethpy150open
45
+
46
+ ## Table of Contents
47
+ - [Dataset Description](#dataset-description)
48
+ - [Dataset Summary](#dataset-summary)
49
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
50
+ - [Languages](#languages)
51
+ - [Dataset Structure](#dataset-structure)
52
+ - [Data Instances](#data-instances)
53
+ - [Data Fields](#data-fields)
54
+ - [Data Splits](#data-splits)
55
+ - [Dataset Creation](#dataset-creation)
56
+ - [Curation Rationale](#curation-rationale)
57
+ - [Source Data](#source-data)
58
+ - [Annotations](#annotations)
59
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
60
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
61
+ - [Social Impact of Dataset](#social-impact-of-dataset)
62
+ - [Discussion of Biases](#discussion-of-biases)
63
+ - [Other Known Limitations](#other-known-limitations)
64
+ - [Additional Information](#additional-information)
65
+ - [Dataset Curators](#dataset-curators)
66
+ - [Licensing Information](#licensing-information)
67
+ - [Citation Information](#citation-information)
68
+ - [Contributions](#contributions)
69
+
70
+ ## Dataset Description
71
+
72
+ - **Homepage:** https://www.sri.inf.ethz.ch/py150
73
+ - **Repository:** https://github.com/google-research-datasets/eth_py150_open
74
+ - **Paper:** https://proceedings.icml.cc/static/paper_files/icml/2020/5401-Paper.pdf
75
+ - **Leaderboard:** None
76
+ - **Point of Contact:** Aditya Kanade <kanade@iisc.ac.in>, Petros Maniatis <maniatis@google.com>
77
+
78
+ ### Dataset Summary
79
+
80
+ A redistributable subset of the [ETH Py150 corpus](https://www.sri.inf.ethz.ch/py150), introduced in the ICML 2020 paper ['Learning and Evaluating Contextual Embedding of Source Code'](https://proceedings.icml.cc/static/paper_files/icml/2020/5401-Paper.pdf)
81
+
82
+ ### Supported Tasks and Leaderboards
83
+
84
+ [More Information Needed]
85
+
86
+ ### Languages
87
+
88
+ English
89
+
90
+ ## Dataset Structure
91
+ List of dicts of
92
+ {
93
+ "filepath": The relative URL containing the path to the file on GitHub
94
+ "license": The license used for that specific file or repository
95
+ }
96
+
97
+ ### Data Instances
98
+
99
+ {
100
+ "filepath": "0rpc/zerorpc-python/setup.py",
101
+ "license": "mit"
102
+ },
103
+ {
104
+ "filepath": "0rpc/zerorpc-python/zerorpc/heartbeat.py",
105
+ "license": "mit"
106
+ },
107
+
108
+ ### Data Fields
109
+
110
+ - `filepath`: The relative URL containing the path to the file on GitHub
111
+ - `license`: The license used for that specific file or repository
112
+
113
+ ### Data Splits
114
+
115
+ | | Train | Valid | Test |
116
+ | ----- | ------- | ----- | ----- |
117
+ | Dataset Split | 74749 | 8302 | 41457 |
118
+
119
+ ## Dataset Creation
120
+ The original dataset is at https://www.sri.inf.ethz.ch/py150
121
+ ### Curation Rationale
122
+
123
+ To generate a more redistributable version of the dataset
124
+
125
+ ### Source Data
126
+
127
+ #### Initial Data Collection and Normalization
128
+
129
+ All the urls are filepaths relative to GitHub and the master branch was used as available at the time
130
+
131
+ #### Who are the source language producers?
132
+
133
+ [More Information Needed]
134
+
135
+ ### Annotations
136
+
137
+ #### Annotation process
138
+
139
+ [More Information Needed]
140
+
141
+ #### Who are the annotators?
142
+
143
+ [More Information Needed]
144
+
145
+ ### Personal and Sensitive Information
146
+
147
+ [More Information Needed]
148
+
149
+ ## Considerations for Using the Data
150
+
151
+ ### Social Impact of Dataset
152
+
153
+ [More Information Needed]
154
+
155
+ ### Discussion of Biases
156
+
157
+ [More Information Needed]
158
+
159
+ ### Other Known Limitations
160
+
161
+ [More Information Needed]
162
+
163
+ ## Additional Information
164
+
165
+ ### Dataset Curators
166
+
167
+ [More Information Needed]
168
+
169
+ ### Licensing Information
170
+
171
+ Apache License 2.0
172
+
173
+ ### Citation Information
174
+
175
+ @inproceedings{kanade2020learning,
176
+ title={Learning and Evaluating Contextual Embedding of Source Code},
177
+ author={Kanade, Aditya and Maniatis, Petros and Balakrishnan, Gogul and Shi, Kensen},
178
+ booktitle={International Conference on Machine Learning},
179
+ pages={5110--5121},
180
+ year={2020},
181
+ organization={PMLR}
182
+ }
183
+
184
+ ### Contributions
185
+
186
+ Thanks to [@Bharat123rox](https://github.com/Bharat123rox) for adding this dataset.
eth_py150_open.py ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """A redistributable subset of the ETH Py150 corpus"""
16
+
17
+
18
+ import json
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ @inproceedings{kanade2020learning,
26
+ title={Learning and Evaluating Contextual Embedding of Source Code},
27
+ author={Kanade, Aditya and Maniatis, Petros and Balakrishnan, Gogul and Shi, Kensen},
28
+ booktitle={International Conference on Machine Learning},
29
+ pages={5110--5121},
30
+ year={2020},
31
+ organization={PMLR}
32
+ }
33
+ """
34
+
35
+
36
+ _DESCRIPTION = """\
37
+ A redistributable subset of the ETH Py150 corpus, introduced in the ICML 2020 paper 'Learning and Evaluating Contextual Embedding of Source Code'
38
+ """
39
+
40
+ # TODO: Add a link to an official homepage for the dataset here
41
+ _HOMEPAGE = "https://github.com/google-research-datasets/eth_py150_open"
42
+
43
+ # TODO: Add the licence for the dataset here if you can find it
44
+ _LICENSE = "Apache License, Version 2.0"
45
+
46
+ # TODO: Add link to the official dataset URLs here
47
+ # The HuggingFace dataset library don't host the datasets but only point to the original files
48
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
49
+ _URL = "https://raw.githubusercontent.com/google-research-datasets/eth_py150_open/master/"
50
+
51
+
52
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
53
+ class EthPy150Open(datasets.GeneratorBasedBuilder):
54
+ """A redistributable subset of the ETH Py150 corpus"""
55
+
56
+ VERSION = datasets.Version("1.1.0")
57
+
58
+ # This is an example of a dataset with multiple configurations.
59
+ # If you don't want/need to define several sub-sets in your dataset,
60
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
61
+
62
+ # If you need to make complex sub-parts in the datasets with configurable options
63
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
64
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
65
+
66
+ # You will be able to load one or the other configurations in the following list with
67
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
68
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
69
+ BUILDER_CONFIGS = [
70
+ datasets.BuilderConfig(
71
+ name="eth_py150_open", version=VERSION, description="A subset of the original Py150 corpus"
72
+ ),
73
+ ]
74
+
75
+ def _info(self):
76
+ features = datasets.Features({"filepath": datasets.Value("string"), "license": datasets.Value("string")})
77
+ return datasets.DatasetInfo(
78
+ # This is the description that will appear on the datasets page.
79
+ description=_DESCRIPTION,
80
+ # This defines the different columns of the dataset and their types
81
+ features=features, # Here we define them above because they are different between the two configurations
82
+ # If there's a common (input, target) tuple from the features,
83
+ # specify them here. They'll be used if as_supervised=True in
84
+ # builder.as_dataset.
85
+ supervised_keys=("filepath", "license"),
86
+ # Homepage of the dataset for documentation
87
+ homepage=_HOMEPAGE,
88
+ # License for the dataset if available
89
+ license=_LICENSE,
90
+ # Citation for the dataset
91
+ citation=_CITATION,
92
+ )
93
+
94
+ def _split_generators(self, dl_manager):
95
+ """Returns SplitGenerators."""
96
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
97
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
98
+
99
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
100
+ # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
101
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
102
+ urls = {
103
+ "train": _URL + "train__manifest.json",
104
+ "dev": _URL + "dev__manifest.json",
105
+ "test": _URL + "eval__manifest.json",
106
+ }
107
+ data_dir = dl_manager.download_and_extract(urls)
108
+ return [
109
+ datasets.SplitGenerator(
110
+ name=datasets.Split.TRAIN,
111
+ # These kwargs will be passed to _generate_examples
112
+ gen_kwargs={"filepath": os.path.join(data_dir["train"]), "split": "train"},
113
+ ),
114
+ datasets.SplitGenerator(
115
+ name=datasets.Split.TEST,
116
+ # These kwargs will be passed to _generate_examples
117
+ gen_kwargs={"filepath": os.path.join(data_dir["test"]), "split": "test"},
118
+ ),
119
+ datasets.SplitGenerator(
120
+ name=datasets.Split.VALIDATION,
121
+ # These kwargs will be passed to _generate_examples
122
+ gen_kwargs={"filepath": os.path.join(data_dir["dev"]), "split": "dev"},
123
+ ),
124
+ ]
125
+
126
+ def _generate_examples(self, filepath, split):
127
+ """Yields examples."""
128
+ # TODO: This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
129
+ # It is in charge of opening the given file and yielding (key, example) tuples from the dataset
130
+ # The key is not important, it's more here for legacy reason (legacy from tfds)
131
+
132
+ with open(filepath, encoding="utf-8") as f:
133
+ for id_, row in enumerate(json.load(f)):
134
+ yield id_, row