Datasets:

Modalities:
Geospatial
Languages:
English
DOI:
Libraries:
License:
cmalbrec commited on
Commit
e02beed
·
verified ·
1 Parent(s): 7114f32

bug fix ix

Browse files
Files changed (1) hide show
  1. 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={"filepath": "meta.jsonl", "dl_manager": dl_manager},
69
  )
70
  ]
71
 
72
- def _generate_examples(self, filepath, dl_manager):
73
- """
74
- Streaming-compliant serving of metadata for SSL4EO data samples.
75
- """
76
- print("Metadata in ", filepath)
77
- with dl_manager.open(filepath) as f:
78
- for idx, line in enumerate(f):
79
- data = json.loads(line)
80
- yield idx, data
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):