re-enable streaming
Browse files
dcase23-task2-enriched.py
CHANGED
@@ -399,7 +399,7 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
399 |
if split in self.config.splits:
|
400 |
audio_path[split] = dl_manager.download(self.config.data_urls[split])
|
401 |
local_extracted_archive[split] = dl_manager.extract(
|
402 |
-
audio_path[split])
|
403 |
if self.config.embeddings_urls is not None:
|
404 |
for emb_name, emb_data in self.config.embeddings_urls.items():
|
405 |
downloaded_embeddings = dl_manager.download(emb_data[split])
|
@@ -440,7 +440,10 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
440 |
lookup = Path(path).parent.name + "/" + Path(path).name
|
441 |
if lookup in metadata["path"].values:
|
442 |
path = os.path.join(local_extracted_archive, path) if local_extracted_archive else path
|
443 |
-
|
|
|
|
|
|
|
444 |
result = {field: None for field in data_fields}
|
445 |
result.update(metadata[metadata["path"] == lookup].T.squeeze().to_dict())
|
446 |
for emb_key in embeddings.keys():
|
|
|
399 |
if split in self.config.splits:
|
400 |
audio_path[split] = dl_manager.download(self.config.data_urls[split])
|
401 |
local_extracted_archive[split] = dl_manager.extract(
|
402 |
+
audio_path[split]) if not dl_manager.is_streaming else None
|
403 |
if self.config.embeddings_urls is not None:
|
404 |
for emb_name, emb_data in self.config.embeddings_urls.items():
|
405 |
downloaded_embeddings = dl_manager.download(emb_data[split])
|
|
|
440 |
lookup = Path(path).parent.name + "/" + Path(path).name
|
441 |
if lookup in metadata["path"].values:
|
442 |
path = os.path.join(local_extracted_archive, path) if local_extracted_archive else path
|
443 |
+
if local_extracted_archive:
|
444 |
+
audio = {"path": path, "bytes": None}
|
445 |
+
else:
|
446 |
+
audio = {"path": path, "bytes": f.read()}
|
447 |
result = {field: None for field in data_fields}
|
448 |
result.update(metadata[metadata["path"] == lookup].T.squeeze().to_dict())
|
449 |
for emb_key in embeddings.keys():
|