schen149 commited on
Commit
0a2c2eb
1 Parent(s): bb57a96

updating dataset loader

Browse files
Files changed (1) hide show
  1. propsegment.py +5 -7
propsegment.py CHANGED
@@ -129,7 +129,8 @@ class PropSegment(datasets.GeneratorBasedBuilder):
129
  def _split_generators(self, dl_manager):
130
  config_name = self.config.name
131
  urls = _URLS[config_name]
132
- data_dir = dl_manager.download_and_extract(urls)
 
133
  file_prefix = _CONFIG_TO_FILENAME[config_name]
134
 
135
  return [
@@ -137,8 +138,7 @@ class PropSegment(datasets.GeneratorBasedBuilder):
137
  name=datasets.Split.TRAIN,
138
  # These kwargs will be passed to _generate_examples
139
  gen_kwargs={
140
- "filepath": os.path.join(
141
- data_dir, "{}.train.jsonl".format(file_prefix)),
142
  "split": "train",
143
  },
144
  ),
@@ -146,8 +146,7 @@ class PropSegment(datasets.GeneratorBasedBuilder):
146
  name=datasets.Split.VALIDATION,
147
  # These kwargs will be passed to _generate_examples
148
  gen_kwargs={
149
- "filepath": os.path.join(
150
- data_dir, "{}.dev.jsonl".format(file_prefix)),
151
  "split": "dev",
152
  },
153
  ),
@@ -155,8 +154,7 @@ class PropSegment(datasets.GeneratorBasedBuilder):
155
  name=datasets.Split.TEST,
156
  # These kwargs will be passed to _generate_examples
157
  gen_kwargs={
158
- "filepath": os.path.join(
159
- data_dir, "{}.test.jsonl".format(file_prefix)),
160
  "split": "test"
161
  },
162
  ),
 
129
  def _split_generators(self, dl_manager):
130
  config_name = self.config.name
131
  urls = _URLS[config_name]
132
+
133
+ data_dir = dl_manager.download(urls)
134
  file_prefix = _CONFIG_TO_FILENAME[config_name]
135
 
136
  return [
 
138
  name=datasets.Split.TRAIN,
139
  # These kwargs will be passed to _generate_examples
140
  gen_kwargs={
141
+ "filepath": data_dir["train"],
 
142
  "split": "train",
143
  },
144
  ),
 
146
  name=datasets.Split.VALIDATION,
147
  # These kwargs will be passed to _generate_examples
148
  gen_kwargs={
149
+ "filepath": data_dir["dev"],
 
150
  "split": "dev",
151
  },
152
  ),
 
154
  name=datasets.Split.TEST,
155
  # These kwargs will be passed to _generate_examples
156
  gen_kwargs={
157
+ "filepath": data_dir["test"],
 
158
  "split": "test"
159
  },
160
  ),