Datasets:
pmc
/

Languages:
English
License:
lvwerra HF staff commited on
Commit
bc01299
1 Parent(s): ef0ef46

fix subsets in `_split_generators`

Browse files
Files changed (1) hide show
  1. open_access.py +25 -16
open_access.py CHANGED
@@ -104,6 +104,14 @@ class OpenAccess(datasets.GeneratorBasedBuilder):
104
  )
105
 
106
  def _split_generators(self, dl_manager):
 
 
 
 
 
 
 
 
107
  for subset in self.config.subsets:
108
  url = _URL.format(subset=_SUBSETS[subset])
109
  basename = f"{_SUBSETS[subset]}_txt."
@@ -114,8 +122,6 @@ class OpenAccess(datasets.GeneratorBasedBuilder):
114
  # "baseline_archives": [f"{url}{basename}{baseline}.tar.gz" for baseline in baselines],
115
  # }
116
  # baseline_paths = dl_manager.download(baseline_urls)
117
- baseline_file_lists = []
118
- baseline_archives = []
119
  for baseline in baselines:
120
  baseline_file_list_url = f"{url}{basename}{baseline}.filelist.csv"
121
  try:
@@ -142,20 +148,23 @@ class OpenAccess(datasets.GeneratorBasedBuilder):
142
  ],
143
  "incremental_archives": [f"{url}{basename}{incremental}.tar.gz" for incremental in incrementals],
144
  }
145
- incremental_paths = dl_manager.download(incremental_urls)
146
- return [
147
- datasets.SplitGenerator(
148
- name=datasets.Split.TRAIN,
149
- gen_kwargs={
150
- "baseline_file_lists": baseline_file_lists,
151
- "baseline_archives": [dl_manager.iter_archive(archive) for archive in baseline_archives],
152
- "incremental_file_lists": incremental_paths["incremental_file_lists"],
153
- "incremental_archives": [
154
- dl_manager.iter_archive(archive) for archive in incremental_paths["incremental_archives"]
155
- ],
156
- },
157
- ),
158
- ]
 
 
 
159
 
160
  def _generate_examples(self, baseline_file_lists, baseline_archives, incremental_file_lists, incremental_archives):
161
  key = 0
 
104
  )
105
 
106
  def _split_generators(self, dl_manager):
107
+
108
+ incremental_paths = {
109
+ "incremental_file_lists": [],
110
+ "incremental_archives": []
111
+ }
112
+ baseline_file_lists = []
113
+ baseline_archives = []
114
+
115
  for subset in self.config.subsets:
116
  url = _URL.format(subset=_SUBSETS[subset])
117
  basename = f"{_SUBSETS[subset]}_txt."
 
122
  # "baseline_archives": [f"{url}{basename}{baseline}.tar.gz" for baseline in baselines],
123
  # }
124
  # baseline_paths = dl_manager.download(baseline_urls)
 
 
125
  for baseline in baselines:
126
  baseline_file_list_url = f"{url}{basename}{baseline}.filelist.csv"
127
  try:
 
148
  ],
149
  "incremental_archives": [f"{url}{basename}{incremental}.tar.gz" for incremental in incrementals],
150
  }
151
+ paths = dl_manager.download(incremental_urls)
152
+ incremental_paths["incremental_file_lists"].extend(paths["incremental_file_lists"])
153
+ incremental_paths["incremental_archives"].extend(paths["incremental_archives"])
154
+
155
+ return [
156
+ datasets.SplitGenerator(
157
+ name=datasets.Split.TRAIN,
158
+ gen_kwargs={
159
+ "baseline_file_lists": baseline_file_lists,
160
+ "baseline_archives": [dl_manager.iter_archive(archive) for archive in baseline_archives],
161
+ "incremental_file_lists": incremental_paths["incremental_file_lists"],
162
+ "incremental_archives": [
163
+ dl_manager.iter_archive(archive) for archive in incremental_paths["incremental_archives"]
164
+ ],
165
+ },
166
+ ),
167
+ ]
168
 
169
  def _generate_examples(self, baseline_file_lists, baseline_archives, incremental_file_lists, incremental_archives):
170
  key = 0