andreped commited on
Commit
70cd26f
1 Parent(s): 18402ce

Added _split_generators for downloading data

Browse files
Files changed (1) hide show
  1. AeroPath.py +2 -50
AeroPath.py CHANGED
@@ -89,7 +89,6 @@ class AeroPath(datasets.GeneratorBasedBuilder):
89
  if (patient_id < 1) or (patiend_id > 27):
90
  raise ValueError("patient_id should be an integer in range [1, 27].")
91
 
92
- """
93
  def _info(self):
94
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
95
  if self.config.name == "zenodo": # This is the name of the configuration selected in BUILDER_CONFIGS above
@@ -119,7 +118,7 @@ class AeroPath(datasets.GeneratorBasedBuilder):
119
  # Citation for the dataset
120
  citation=_CITATION,
121
  )
122
-
123
  def _split_generators(self, dl_manager):
124
  # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
125
  # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
@@ -129,51 +128,4 @@ class AeroPath(datasets.GeneratorBasedBuilder):
129
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
130
  urls = _URLS[self.config.name]
131
  data_dir = dl_manager.download_and_extract(urls)
132
- return [
133
- datasets.SplitGenerator(
134
- name=datasets.Split.TRAIN,
135
- # These kwargs will be passed to _generate_examples
136
- gen_kwargs={
137
- "filepath": os.path.join(data_dir, "train.jsonl"),
138
- "split": "train",
139
- },
140
- ),
141
- datasets.SplitGenerator(
142
- name=datasets.Split.VALIDATION,
143
- # These kwargs will be passed to _generate_examples
144
- gen_kwargs={
145
- "filepath": os.path.join(data_dir, "dev.jsonl"),
146
- "split": "dev",
147
- },
148
- ),
149
- datasets.SplitGenerator(
150
- name=datasets.Split.TEST,
151
- # These kwargs will be passed to _generate_examples
152
- gen_kwargs={
153
- "filepath": os.path.join(data_dir, "test.jsonl"),
154
- "split": "test"
155
- },
156
- ),
157
- ]
158
-
159
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
160
- def _generate_examples(self, filepath, split):
161
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
162
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
163
- with open(filepath, encoding="utf-8") as f:
164
- for key, row in enumerate(f):
165
- data = json.loads(row)
166
- if self.config.name == "first_domain":
167
- # Yields examples as (key, example) tuples
168
- yield key, {
169
- "sentence": data["sentence"],
170
- "option1": data["option1"],
171
- "answer": "" if split == "test" else data["answer"],
172
- }
173
- else:
174
- yield key, {
175
- "sentence": data["sentence"],
176
- "option2": data["option2"],
177
- "second_domain_answer": "" if split == "test" else data["second_domain_answer"],
178
- }
179
- """
 
89
  if (patient_id < 1) or (patiend_id > 27):
90
  raise ValueError("patient_id should be an integer in range [1, 27].")
91
 
 
92
  def _info(self):
93
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
94
  if self.config.name == "zenodo": # This is the name of the configuration selected in BUILDER_CONFIGS above
 
118
  # Citation for the dataset
119
  citation=_CITATION,
120
  )
121
+
122
  def _split_generators(self, dl_manager):
123
  # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
124
  # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
 
128
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
129
  urls = _URLS[self.config.name]
130
  data_dir = dl_manager.download_and_extract(urls)
131
+ return None