Emilio Marinone
commited on
Commit
•
06408c2
1
Parent(s):
5f17366
remove printing to stdout
Browse files
nst_sv.py
CHANGED
@@ -213,7 +213,6 @@ class NstSV(datasets.GeneratorBasedBuilder):
|
|
213 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
214 |
def _generate_examples(self, data_dir, annotations_dir):
|
215 |
|
216 |
-
files_failed_loading = []
|
217 |
if self.config.name == "close_channel":
|
218 |
channel_ext = "-1"
|
219 |
else:
|
@@ -221,8 +220,7 @@ class NstSV(datasets.GeneratorBasedBuilder):
|
|
221 |
|
222 |
annotations_files = os.listdir(annotations_dir)
|
223 |
for annotation_filename in tqdm(annotations_files):
|
224 |
-
|
225 |
-
# if annotation_filename not in _BAD_ANNOTATIONS:
|
226 |
annotations_filepath = os.path.join(annotations_dir, annotation_filename)
|
227 |
with open(annotations_filepath, "r") as f:
|
228 |
annotation = json.load(f)
|
@@ -235,7 +233,6 @@ class NstSV(datasets.GeneratorBasedBuilder):
|
|
235 |
# so if file is "123456.wav"
|
236 |
# close channel file is "123456-1.wav"
|
237 |
# distant channel file is "123456-2.wav"
|
238 |
-
# try:
|
239 |
rel_filepath = f'se/{annotation["pid"]}/{annotation["pid"]}_{recording["file"]}'.replace(".wav", f"{channel_ext}.wav")
|
240 |
audio_filepath = f"{data_dir}/{rel_filepath}"
|
241 |
if os.path.exists(audio_filepath):
|
@@ -279,13 +276,4 @@ class NstSV(datasets.GeneratorBasedBuilder):
|
|
279 |
'segment': "",
|
280 |
'channel': self.config.name or ""
|
281 |
}
|
282 |
-
print(f"Yielding {rel_filepath}")
|
283 |
yield rel_filepath, result
|
284 |
-
|
285 |
-
# except:
|
286 |
-
# files_failed_loading.append(rel_filepath)
|
287 |
-
|
288 |
-
print(
|
289 |
-
"Dataset loaded. "
|
290 |
-
f"Files failed loading: {files_failed_loading}. "
|
291 |
-
)
|
|
|
213 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
214 |
def _generate_examples(self, data_dir, annotations_dir):
|
215 |
|
|
|
216 |
if self.config.name == "close_channel":
|
217 |
channel_ext = "-1"
|
218 |
else:
|
|
|
220 |
|
221 |
annotations_files = os.listdir(annotations_dir)
|
222 |
for annotation_filename in tqdm(annotations_files):
|
223 |
+
|
|
|
224 |
annotations_filepath = os.path.join(annotations_dir, annotation_filename)
|
225 |
with open(annotations_filepath, "r") as f:
|
226 |
annotation = json.load(f)
|
|
|
233 |
# so if file is "123456.wav"
|
234 |
# close channel file is "123456-1.wav"
|
235 |
# distant channel file is "123456-2.wav"
|
|
|
236 |
rel_filepath = f'se/{annotation["pid"]}/{annotation["pid"]}_{recording["file"]}'.replace(".wav", f"{channel_ext}.wav")
|
237 |
audio_filepath = f"{data_dir}/{rel_filepath}"
|
238 |
if os.path.exists(audio_filepath):
|
|
|
276 |
'segment': "",
|
277 |
'channel': self.config.name or ""
|
278 |
}
|
|
|
279 |
yield rel_filepath, result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|