Datasets:

License:
sobamchan commited on
Commit
5c9021e
·
1 Parent(s): 567fd9a

updated loader.

Browse files
Files changed (1) hide show
  1. xscitldr_staging.py +6 -4
xscitldr_staging.py CHANGED
@@ -115,13 +115,15 @@ class XSciTLDRStaging(datasets.GeneratorBasedBuilder):
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
- "filedir": os.path.join(data_dir, "train.jsonl"),
125
  "split": "train",
126
  },
127
  ),
@@ -129,7 +131,7 @@ class XSciTLDRStaging(datasets.GeneratorBasedBuilder):
129
  name=datasets.Split.TEST,
130
  # These kwargs will be passed to _generate_examples
131
  gen_kwargs={
132
- "filedir": os.path.join(data_dir, "test.jsonl"),
133
  "split": "test"
134
  },
135
  ),
@@ -137,7 +139,7 @@ class XSciTLDRStaging(datasets.GeneratorBasedBuilder):
137
  name=datasets.Split.VALIDATION,
138
  # These kwargs will be passed to _generate_examples
139
  gen_kwargs={
140
- "filedir": os.path.join(data_dir, "dev.jsonl"),
141
  "split": "dev",
142
  },
143
  ),
 
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_path_train = dl_manager.download_and_extract(os.path.join(urls, "train.jsonl"))
119
+ data_path_test = dl_manager.download_and_extract(os.path.join(urls, "test.jsonl"))
120
+ data_path_dev = dl_manager.download_and_extract(os.path.join(urls, "dev.jsonl"))
121
  return [
122
  datasets.SplitGenerator(
123
  name=datasets.Split.TRAIN,
124
  # These kwargs will be passed to _generate_examples
125
  gen_kwargs={
126
+ "filedir": data_path_train,
127
  "split": "train",
128
  },
129
  ),
 
131
  name=datasets.Split.TEST,
132
  # These kwargs will be passed to _generate_examples
133
  gen_kwargs={
134
+ "filedir": data_path_test,
135
  "split": "test"
136
  },
137
  ),
 
139
  name=datasets.Split.VALIDATION,
140
  # These kwargs will be passed to _generate_examples
141
  gen_kwargs={
142
+ "filedir": data_path_dev,
143
  "split": "dev",
144
  },
145
  ),