Datasets:
bug fix ix
Browse files- ssl4eo_eu_forest.py +11 -13
ssl4eo_eu_forest.py
CHANGED
|
@@ -59,25 +59,23 @@ note = {This work was carried under the EvoLand project, cf. https://www.evo-lan
|
|
| 59 |
|
| 60 |
|
| 61 |
def _split_generators(self, dl_manager):
|
| 62 |
-
""
|
| 63 |
-
Define dataset splits - single 'train' split for now.
|
| 64 |
-
"""
|
| 65 |
return [
|
| 66 |
datasets.SplitGenerator(
|
| 67 |
name=datasets.Split.TRAIN,
|
| 68 |
-
gen_kwargs={"
|
| 69 |
)
|
| 70 |
]
|
| 71 |
|
| 72 |
-
def _generate_examples(self,
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
|
| 82 |
|
| 83 |
def features_to_croissant(features):
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
def _split_generators(self, dl_manager):
|
| 62 |
+
files = dl_manager.iter_files(["meta.jsonl"])
|
|
|
|
|
|
|
| 63 |
return [
|
| 64 |
datasets.SplitGenerator(
|
| 65 |
name=datasets.Split.TRAIN,
|
| 66 |
+
gen_kwargs={"files": files},
|
| 67 |
)
|
| 68 |
]
|
| 69 |
|
| 70 |
+
def _generate_examples(self, files):
|
| 71 |
+
for file_url in files:
|
| 72 |
+
# print for path resolution verification (may appear multiple times with num_proc > 1)
|
| 73 |
+
print("Streaming from:", file_url)
|
| 74 |
+
# In streaming mode open(file_url) is supported by datasets' patched I/O
|
| 75 |
+
with open(file_url, encoding="utf-8") as f:
|
| 76 |
+
for idx, line in enumerate(f):
|
| 77 |
+
data = json.loads(line)
|
| 78 |
+
yield idx, data
|
| 79 |
|
| 80 |
|
| 81 |
def features_to_croissant(features):
|