overwrite dataset file
Browse files
dcase23-task2-enriched.py
CHANGED
@@ -207,6 +207,7 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
207 |
dataset=DATASET[key],
|
208 |
homepage=_HOMEPAGE[key],
|
209 |
data_urls=DATA_URLS[key],
|
|
|
210 |
release_date=stats["date"],
|
211 |
splits=stats["splits"],
|
212 |
layout=_SPOTLIGHT_LAYOUT,
|
@@ -230,9 +231,10 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
230 |
"label": datasets.ClassLabel(num_classes=_NUM_TARGETS, names=_TARGET_NAMES),
|
231 |
"class": datasets.ClassLabel(num_classes=_NUM_CLASSES, names=_CLASS_NAMES),
|
232 |
}
|
233 |
-
|
234 |
-
|
235 |
-
|
|
|
236 |
features = datasets.Features(features)
|
237 |
|
238 |
return datasets.DatasetInfo(
|
@@ -261,8 +263,9 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
261 |
audio_path[split] = dl_manager.download(self.config.data_urls[split])
|
262 |
local_extracted_archive[split] = dl_manager.extract(
|
263 |
audio_path[split]) if not dl_manager.is_streaming else None
|
264 |
-
|
265 |
-
|
|
|
266 |
|
267 |
return [
|
268 |
datasets.SplitGenerator(
|
@@ -306,3 +309,4 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
306 |
|
307 |
if __name__ == "__main__":
|
308 |
ds = load_dataset("dcase23-task2-enriched.py", "dev", split="train", streaming=True)
|
|
|
|
207 |
dataset=DATASET[key],
|
208 |
homepage=_HOMEPAGE[key],
|
209 |
data_urls=DATA_URLS[key],
|
210 |
+
embeddings_urls=EMBEDDING_URLS[key],
|
211 |
release_date=stats["date"],
|
212 |
splits=stats["splits"],
|
213 |
layout=_SPOTLIGHT_LAYOUT,
|
|
|
231 |
"label": datasets.ClassLabel(num_classes=_NUM_TARGETS, names=_TARGET_NAMES),
|
232 |
"class": datasets.ClassLabel(num_classes=_NUM_CLASSES, names=_CLASS_NAMES),
|
233 |
}
|
234 |
+
if self.config.embeddings_urls is not None:
|
235 |
+
features.update({
|
236 |
+
emb_name: datasets.Array2D(shape=emb["size"], dtype=emb["dtype"]) for emb_name, emb in self.config.embeddings_urls.items()
|
237 |
+
})
|
238 |
features = datasets.Features(features)
|
239 |
|
240 |
return datasets.DatasetInfo(
|
|
|
263 |
audio_path[split] = dl_manager.download(self.config.data_urls[split])
|
264 |
local_extracted_archive[split] = dl_manager.extract(
|
265 |
audio_path[split]) if not dl_manager.is_streaming else None
|
266 |
+
if self.config.embeddings_urls is not None:
|
267 |
+
for emb_name, emb_data in self.config.embeddings_urls.items():
|
268 |
+
embeddings[split][emb_name] = np.load(dl_manager.download_and_extract(emb_data[split]) + "/arr_0.npy", allow_pickle=True).item()
|
269 |
|
270 |
return [
|
271 |
datasets.SplitGenerator(
|
|
|
309 |
|
310 |
if __name__ == "__main__":
|
311 |
ds = load_dataset("dcase23-task2-enriched.py", "dev", split="train", streaming=True)
|
312 |
+
|