Datasets:
Update: loading script TODO test
Browse files
utcd.py
CHANGED
|
@@ -138,14 +138,15 @@ class Utcd(datasets.GeneratorBasedBuilder):
|
|
| 138 |
|
| 139 |
base_path = dl_manager.download_and_extract('datasets.zip')
|
| 140 |
split2paths = {s: [os_join(base_path, f'{dir_nm}_split', dnm, f'{s}.json') for dnm in dnms] for s in splits}
|
|
|
|
| 141 |
return [
|
| 142 |
datasets.SplitGenerator(name=_split2hf_split[s], gen_kwargs=dict(filepath=split2paths[s])) for s in splits
|
| 143 |
]
|
| 144 |
|
| 145 |
def _generate_examples(self, filepath: List[str]):
|
|
|
|
| 146 |
for path in filepath: # each file for one split of one dataset
|
| 147 |
dnm = path.split(os.sep)[-2]
|
| 148 |
-
id_ = 0
|
| 149 |
with open(path, encoding='utf-8') as fl:
|
| 150 |
dset = json.load(fl)
|
| 151 |
for txt, labels in dset.items():
|
|
|
|
| 138 |
|
| 139 |
base_path = dl_manager.download_and_extract('datasets.zip')
|
| 140 |
split2paths = {s: [os_join(base_path, f'{dir_nm}_split', dnm, f'{s}.json') for dnm in dnms] for s in splits}
|
| 141 |
+
# order of dataset file paths will be deterministic for deterministic dataset name ordering
|
| 142 |
return [
|
| 143 |
datasets.SplitGenerator(name=_split2hf_split[s], gen_kwargs=dict(filepath=split2paths[s])) for s in splits
|
| 144 |
]
|
| 145 |
|
| 146 |
def _generate_examples(self, filepath: List[str]):
|
| 147 |
+
id_ = 0
|
| 148 |
for path in filepath: # each file for one split of one dataset
|
| 149 |
dnm = path.split(os.sep)[-2]
|
|
|
|
| 150 |
with open(path, encoding='utf-8') as fl:
|
| 151 |
dset = json.load(fl)
|
| 152 |
for txt, labels in dset.items():
|