lukasbraach commited on
Commit
72330f3
·
verified ·
1 Parent(s): 8a4f8b6

Revert "upd: try numerical ID"

Browse files

This reverts commit 8a4f8b6032a23a871cf6efc87a0b6797bf5acdde.

Files changed (1) hide show
  1. rwth_phoenix_weather_2014.py +7 -6
rwth_phoenix_weather_2014.py CHANGED
@@ -98,6 +98,7 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
98
  def _split_generators(self, dl_manager: datasets.DownloadManager):
99
  split_frames = {}
100
  split_tokens = {}
 
101
 
102
  dataDirMapper = {
103
  datasets.Split.TRAIN: "train",
@@ -120,6 +121,8 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
120
  lambda x: x.strip().split()
121
  )
122
 
 
 
123
  if self.config.name == 'pre-training':
124
  split_frames[split] = [None for id in df.id]
125
  continue
@@ -138,6 +141,7 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
138
  datasets.SplitGenerator(
139
  name=split,
140
  gen_kwargs={
 
141
  "split_frames": split_frames[split],
142
  "split_tokens": split_tokens[split],
143
  },
@@ -149,10 +153,8 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
149
  ]
150
  ]
151
 
152
- def _generate_examples(self, split_frames, split_tokens):
153
- id_ = 0
154
-
155
- for frames, tokens in zip(split_frames, split_tokens):
156
  frames_as_list = [
157
  {"path": p, "bytes": im.read()} for p, im in frames
158
  ] if frames is not None else None
@@ -164,5 +166,4 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
164
  if frames_as_list is not None:
165
  result["frames"] = frames_as_list
166
 
167
- yield id_, result
168
- id_ += 1
 
98
  def _split_generators(self, dl_manager: datasets.DownloadManager):
99
  split_frames = {}
100
  split_tokens = {}
101
+ split_ids = {}
102
 
103
  dataDirMapper = {
104
  datasets.Split.TRAIN: "train",
 
121
  lambda x: x.strip().split()
122
  )
123
 
124
+ split_ids[split] = df.id
125
+
126
  if self.config.name == 'pre-training':
127
  split_frames[split] = [None for id in df.id]
128
  continue
 
141
  datasets.SplitGenerator(
142
  name=split,
143
  gen_kwargs={
144
+ "split_ids": split_ids[split],
145
  "split_frames": split_frames[split],
146
  "split_tokens": split_tokens[split],
147
  },
 
153
  ]
154
  ]
155
 
156
+ def _generate_examples(self, split_ids, split_frames, split_tokens):
157
+ for id, frames, tokens in zip(split_ids, split_frames, split_tokens):
 
 
158
  frames_as_list = [
159
  {"path": p, "bytes": im.read()} for p, im in frames
160
  ] if frames is not None else None
 
166
  if frames_as_list is not None:
167
  result["frames"] = frames_as_list
168
 
169
+ yield id, result