Datasets:

License:
sobamchan commited on
Commit
4e2b100
·
1 Parent(s): 5c9021e

updated loader.

Browse files
Files changed (1) hide show
  1. xscitldr_staging.py +5 -5
xscitldr_staging.py CHANGED
@@ -123,7 +123,7 @@ class XSciTLDRStaging(datasets.GeneratorBasedBuilder):
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,7 +131,7 @@ class XSciTLDRStaging(datasets.GeneratorBasedBuilder):
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,17 +139,17 @@ class XSciTLDRStaging(datasets.GeneratorBasedBuilder):
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
  ),
146
  ]
147
 
148
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
149
- def _generate_examples(self, filedir, split):
150
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
151
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
152
- with open(os.path.join(filedir, f"{split}.jsonl"), encoding="utf-8") as f:
153
  for key, row in enumerate(f):
154
  data = json.loads(row)
155
  yield key, {
 
123
  name=datasets.Split.TRAIN,
124
  # These kwargs will be passed to _generate_examples
125
  gen_kwargs={
126
+ "filepath": 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
+ "filepath": 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
+ "filepath": data_path_dev,
143
  "split": "dev",
144
  },
145
  ),
146
  ]
147
 
148
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
149
+ def _generate_examples(self, filepath, split):
150
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
151
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
152
+ with open(filepath, encoding="utf-8") as f:
153
  for key, row in enumerate(f):
154
  data = json.loads(row)
155
  yield key, {