EC2 Default User commited on
Commit
f43d5c8
·
1 Parent(s): 9ba0a9e

Add split generator

Browse files
Files changed (1) hide show
  1. oas-paired-sequence-data.py +35 -35
oas-paired-sequence-data.py CHANGED
@@ -107,41 +107,41 @@ class OasPairedSequenceData(datasets.GeneratorBasedBuilder):
107
  citation=_CITATION,
108
  )
109
 
110
- # def _split_generators(self, dl_manager):
111
- # # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
112
- # # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
113
-
114
- # # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
115
- # # 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.
116
- # # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
117
- # urls = _URLS[self.config.name]
118
- # data_dir = dl_manager.download_and_extract(urls)
119
- # return [
120
- # datasets.SplitGenerator(
121
- # name=datasets.Split.TRAIN,
122
- # # These kwargs will be passed to _generate_examples
123
- # gen_kwargs={
124
- # "filepath": os.path.join(data_dir, "train.jsonl"),
125
- # "split": "train",
126
- # },
127
- # ),
128
- # datasets.SplitGenerator(
129
- # name=datasets.Split.VALIDATION,
130
- # # These kwargs will be passed to _generate_examples
131
- # gen_kwargs={
132
- # "filepath": os.path.join(data_dir, "dev.jsonl"),
133
- # "split": "dev",
134
- # },
135
- # ),
136
- # datasets.SplitGenerator(
137
- # name=datasets.Split.TEST,
138
- # # These kwargs will be passed to _generate_examples
139
- # gen_kwargs={
140
- # "filepath": os.path.join(data_dir, "test.jsonl"),
141
- # "split": "test",
142
- # },
143
- # ),
144
- # ]
145
 
146
  # # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
147
  # def _generate_examples(self, filepath, split):
 
107
  citation=_CITATION,
108
  )
109
 
110
+ def _split_generators(self, dl_manager):
111
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
112
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
113
+
114
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
115
+ # 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.
116
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
117
+ urls = _URLS[self.config.name]
118
+ data_dir = dl_manager.download_and_extract(urls)
119
+ return [
120
+ datasets.SplitGenerator(
121
+ name=datasets.Split.TRAIN,
122
+ # These kwargs will be passed to _generate_examples
123
+ gen_kwargs={
124
+ "filepath": os.path.join(data_dir, "train.jsonl"),
125
+ "split": "train",
126
+ },
127
+ ),
128
+ # datasets.SplitGenerator(
129
+ # name=datasets.Split.VALIDATION,
130
+ # # These kwargs will be passed to _generate_examples
131
+ # gen_kwargs={
132
+ # "filepath": os.path.join(data_dir, "dev.jsonl"),
133
+ # "split": "dev",
134
+ # },
135
+ # ),
136
+ # datasets.SplitGenerator(
137
+ # name=datasets.Split.TEST,
138
+ # # These kwargs will be passed to _generate_examples
139
+ # gen_kwargs={
140
+ # "filepath": os.path.join(data_dir, "test.jsonl"),
141
+ # "split": "test",
142
+ # },
143
+ # ),
144
+ ]
145
 
146
  # # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
147
  # def _generate_examples(self, filepath, split):