:hammer: chabud test working
Browse files
california_burned_areas.py
CHANGED
|
@@ -123,7 +123,7 @@ class CaBuAr(datasets.GeneratorBasedBuilder):
|
|
| 123 |
|
| 124 |
return [
|
| 125 |
datasets.SplitGenerator(
|
| 126 |
-
name=fold
|
| 127 |
# These kwargs will be passed to _generate_examples
|
| 128 |
gen_kwargs={
|
| 129 |
"fold": fold,
|
|
@@ -131,15 +131,14 @@ class CaBuAr(datasets.GeneratorBasedBuilder):
|
|
| 131 |
"filepath": h5_files[file_index],
|
| 132 |
},
|
| 133 |
)
|
| 134 |
-
for fold, file_index in zip(range(0,
|
| 135 |
]
|
| 136 |
|
| 137 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 138 |
def _generate_examples(self, fold: int, load_prefire: bool, filepath):
|
| 139 |
-
print(f"Loading fold {fold} from {filepath}")
|
| 140 |
with h5py.File(filepath, "r") as f:
|
| 141 |
for uuid, values in f.items():
|
| 142 |
-
if
|
| 143 |
continue
|
| 144 |
if load_prefire and "pre_fire" not in values:
|
| 145 |
continue
|
|
|
|
| 123 |
|
| 124 |
return [
|
| 125 |
datasets.SplitGenerator(
|
| 126 |
+
name=fold,
|
| 127 |
# These kwargs will be passed to _generate_examples
|
| 128 |
gen_kwargs={
|
| 129 |
"fold": fold,
|
|
|
|
| 131 |
"filepath": h5_files[file_index],
|
| 132 |
},
|
| 133 |
)
|
| 134 |
+
for fold, file_index in zip(list(range(0, 5)) + ["chabud"], [0] * 5 + [1])
|
| 135 |
]
|
| 136 |
|
| 137 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 138 |
def _generate_examples(self, fold: int, load_prefire: bool, filepath):
|
|
|
|
| 139 |
with h5py.File(filepath, "r") as f:
|
| 140 |
for uuid, values in f.items():
|
| 141 |
+
if values.attrs["fold"] != fold:
|
| 142 |
continue
|
| 143 |
if load_prefire and "pre_fire" not in values:
|
| 144 |
continue
|