Update data load script to allow sharding.
Browse files- edgar-corpus.py +4 -4
edgar-corpus.py
CHANGED
@@ -88,9 +88,9 @@ class EdgarCorpus(datasets.GeneratorBasedBuilder):
|
|
88 |
|
89 |
# Create the full path to the extracted files as it can be one or multiple
|
90 |
filepaths = {
|
91 |
-
"test":
|
92 |
-
"train":
|
93 |
-
"validate":
|
94 |
}
|
95 |
|
96 |
return [
|
@@ -122,7 +122,7 @@ class EdgarCorpus(datasets.GeneratorBasedBuilder):
|
|
122 |
|
123 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
124 |
def _generate_examples(self, filepath, split):
|
125 |
-
for
|
126 |
with open(path, encoding="utf-8") as f:
|
127 |
for row in f:
|
128 |
data = json.loads(row)
|
|
|
88 |
|
89 |
# Create the full path to the extracted files as it can be one or multiple
|
90 |
filepaths = {
|
91 |
+
"test": [v for k, v in data_dir.items() if 'test' in k],
|
92 |
+
"train": [v for k, v in data_dir.items() if 'train' in k],
|
93 |
+
"validate": [v for k, v in data_dir.items() if 'validate' in k],
|
94 |
}
|
95 |
|
96 |
return [
|
|
|
122 |
|
123 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
124 |
def _generate_examples(self, filepath, split):
|
125 |
+
for path in filepath:
|
126 |
with open(path, encoding="utf-8") as f:
|
127 |
for row in f:
|
128 |
data = json.loads(row)
|