Datasets:
Formats:
parquet
Languages:
English
Size:
100K - 1M
ArXiv:
Tags:
query-by-example-spoken-term-detection
audio-slot-filling
speaker-diarization
automatic-speaker-verification
License:
Update superb.py
#6
by
lhoestq
HF Staff
- opened
superb.py
CHANGED
|
@@ -143,7 +143,7 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 143 |
),
|
| 144 |
supervised_keys=("file", "text"),
|
| 145 |
url="http://www.openslr.org/12",
|
| 146 |
-
data_url="
|
| 147 |
),
|
| 148 |
SuperbConfig(
|
| 149 |
name="ks",
|
|
@@ -221,7 +221,7 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 221 |
),
|
| 222 |
supervised_keys=None,
|
| 223 |
url="https://fluent.ai/fluent-speech-commands-a-dataset-for-spoken-language-understanding-research/",
|
| 224 |
-
data_url="
|
| 225 |
),
|
| 226 |
SuperbConfig(
|
| 227 |
name="si",
|
|
@@ -271,7 +271,7 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 271 |
), # TODO
|
| 272 |
supervised_keys=None, # TODO
|
| 273 |
url="https://github.com/ftshijt/LibriMix",
|
| 274 |
-
data_url="https://huggingface.co/datasets/
|
| 275 |
),
|
| 276 |
SuperbConfig(
|
| 277 |
name="er",
|
|
@@ -294,42 +294,6 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 294 |
),
|
| 295 |
]
|
| 296 |
|
| 297 |
-
@property
|
| 298 |
-
def manual_download_instructions(self):
|
| 299 |
-
if self.config.name == "si":
|
| 300 |
-
return textwrap.dedent(
|
| 301 |
-
"""
|
| 302 |
-
Please download the VoxCeleb dataset using the following script,
|
| 303 |
-
which should create `VoxCeleb1/wav/id*` directories for both train and test speakers`:
|
| 304 |
-
```
|
| 305 |
-
mkdir VoxCeleb1
|
| 306 |
-
cd VoxCeleb1
|
| 307 |
-
|
| 308 |
-
wget https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_dev_wav_partaa
|
| 309 |
-
wget https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_dev_wav_partab
|
| 310 |
-
wget https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_dev_wav_partac
|
| 311 |
-
wget https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_dev_wav_partad
|
| 312 |
-
cat vox1_dev* > vox1_dev_wav.zip
|
| 313 |
-
unzip vox1_dev_wav.zip
|
| 314 |
-
|
| 315 |
-
wget https://thor.robots.ox.ac.uk/~vgg/data/voxceleb/vox1a/vox1_test_wav.zip
|
| 316 |
-
unzip vox1_test_wav.zip
|
| 317 |
-
|
| 318 |
-
# download the official SUPERB train-dev-test split
|
| 319 |
-
wget https://raw.githubusercontent.com/s3prl/s3prl/master/s3prl/downstream/voxceleb1/veri_test_class.txt
|
| 320 |
-
```"""
|
| 321 |
-
)
|
| 322 |
-
elif self.config.name == "er":
|
| 323 |
-
return textwrap.dedent(
|
| 324 |
-
"""
|
| 325 |
-
Please download the IEMOCAP dataset after submitting the request form here:
|
| 326 |
-
https://sail.usc.edu/iemocap/iemocap_release.htm
|
| 327 |
-
Having downloaded the dataset you can extract it with `tar -xvzf IEMOCAP_full_release.tar.gz`
|
| 328 |
-
which should create a folder called `IEMOCAP_full_release`
|
| 329 |
-
"""
|
| 330 |
-
)
|
| 331 |
-
return None
|
| 332 |
-
|
| 333 |
def _info(self):
|
| 334 |
return datasets.DatasetInfo(
|
| 335 |
description=_DESCRIPTION,
|
|
@@ -390,24 +354,28 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 390 |
),
|
| 391 |
]
|
| 392 |
elif self.config.name == "si":
|
| 393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
return [
|
| 395 |
datasets.SplitGenerator(
|
| 396 |
name=datasets.Split.TRAIN,
|
| 397 |
-
gen_kwargs={"archive_path":
|
| 398 |
),
|
| 399 |
datasets.SplitGenerator(
|
| 400 |
name=datasets.Split.VALIDATION,
|
| 401 |
-
gen_kwargs={"archive_path":
|
| 402 |
),
|
| 403 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"archive_path":
|
| 404 |
]
|
| 405 |
elif self.config.name == "sd":
|
| 406 |
splits = ["train", "dev", "test"]
|
| 407 |
_DL_URLS = {
|
| 408 |
split: {
|
| 409 |
filename: self.config.data_url.format(split=split, filename=filename)
|
| 410 |
-
for filename in ["reco2dur", "segments", "utt2spk", "
|
| 411 |
}
|
| 412 |
for split in splits
|
| 413 |
}
|
|
@@ -419,11 +387,13 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 419 |
for split in splits
|
| 420 |
]
|
| 421 |
elif self.config.name == "er":
|
| 422 |
-
|
|
|
|
|
|
|
| 423 |
return [
|
| 424 |
datasets.SplitGenerator(
|
| 425 |
name=f"session{i}",
|
| 426 |
-
gen_kwargs={"archive_path":
|
| 427 |
)
|
| 428 |
for i in range(1, 6)
|
| 429 |
]
|
|
@@ -465,14 +435,13 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 465 |
label = "_unknown_"
|
| 466 |
yield key, {"file": audio_file, "audio": audio_file, "label": label}
|
| 467 |
elif self.config.name == "ic":
|
| 468 |
-
|
| 469 |
-
csv_path = os.path.join(root_path, "data", f"{split}_data.csv")
|
| 470 |
with open(csv_path, encoding="utf-8") as csv_file:
|
| 471 |
csv_reader = csv.reader(csv_file, delimiter=",", skipinitialspace=True)
|
| 472 |
next(csv_reader)
|
| 473 |
for row in csv_reader:
|
| 474 |
key, file_path, speaker_id, text, action, object_, location = row
|
| 475 |
-
audio_path = os.path.join(
|
| 476 |
yield key, {
|
| 477 |
"file": audio_path,
|
| 478 |
"audio": audio_path,
|
|
@@ -483,20 +452,22 @@ class Superb(datasets.GeneratorBasedBuilder):
|
|
| 483 |
"location": location,
|
| 484 |
}
|
| 485 |
elif self.config.name == "si":
|
| 486 |
-
|
| 487 |
-
splits_path = os.path.join(archive_path, "veri_test_class.txt")
|
| 488 |
with open(splits_path, "r", encoding="utf-8") as f:
|
| 489 |
for key, line in enumerate(f):
|
| 490 |
split_id, file_path = line.strip().split(" ")
|
| 491 |
if int(split_id) != split:
|
| 492 |
continue
|
| 493 |
speaker_id = file_path.split("/")[0]
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
|
|
|
|
|
|
|
|
|
| 500 |
elif self.config.name == "sd":
|
| 501 |
data = SdData(archive_path)
|
| 502 |
args = SdArgs()
|
|
@@ -556,7 +527,7 @@ class SdData:
|
|
| 556 |
"""Load sd data."""
|
| 557 |
self.segments = self._load_segments_rechash(data_dir["segments"])
|
| 558 |
self.utt2spk = self._load_utt2spk(data_dir["utt2spk"])
|
| 559 |
-
self.wavs = self._load_wav_zip(data_dir["
|
| 560 |
self.reco2dur = self._load_reco2dur(data_dir["reco2dur"])
|
| 561 |
|
| 562 |
def _load_segments_rechash(self, segments_file):
|
|
@@ -574,7 +545,7 @@ class SdData:
|
|
| 574 |
|
| 575 |
def _load_wav_zip(self, wav_zip):
|
| 576 |
"""Return dictionary { rec: wav_rxfilename }."""
|
| 577 |
-
wav_dir = os.path.join(wav_zip, "
|
| 578 |
return {
|
| 579 |
os.path.splitext(filename)[0]: os.path.join(wav_dir, filename) for filename in sorted(os.listdir(wav_dir))
|
| 580 |
}
|
|
|
|
| 143 |
),
|
| 144 |
supervised_keys=("file", "text"),
|
| 145 |
url="http://www.openslr.org/12",
|
| 146 |
+
data_url="https://huggingface.co/datasets/lhoestq/superb-asr/resolve/main/",
|
| 147 |
),
|
| 148 |
SuperbConfig(
|
| 149 |
name="ks",
|
|
|
|
| 221 |
),
|
| 222 |
supervised_keys=None,
|
| 223 |
url="https://fluent.ai/fluent-speech-commands-a-dataset-for-spoken-language-understanding-research/",
|
| 224 |
+
data_url="https://huggingface.co/datasets/lhoestq/fluent-speech-corpus/resolve/main/fluent_speech_commands_dataset.zip",
|
| 225 |
),
|
| 226 |
SuperbConfig(
|
| 227 |
name="si",
|
|
|
|
| 271 |
), # TODO
|
| 272 |
supervised_keys=None, # TODO
|
| 273 |
url="https://github.com/ftshijt/LibriMix",
|
| 274 |
+
data_url="https://huggingface.co/datasets/lhoestq/LibriMix-sd/resolve/main/{split}/{filename}",
|
| 275 |
),
|
| 276 |
SuperbConfig(
|
| 277 |
name="er",
|
|
|
|
| 294 |
),
|
| 295 |
]
|
| 296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
def _info(self):
|
| 298 |
return datasets.DatasetInfo(
|
| 299 |
description=_DESCRIPTION,
|
|
|
|
| 354 |
),
|
| 355 |
]
|
| 356 |
elif self.config.name == "si":
|
| 357 |
+
archive_path = (
|
| 358 |
+
dl_manager.download_and_extract("https://huggingface.co/datasets/ProgramComputer/voxceleb/resolve/main/vox1/vox1_dev_wav.zip"),
|
| 359 |
+
dl_manager.download_and_extract("https://huggingface.co/datasets/ProgramComputer/voxceleb/resolve/main/vox1/vox1_test_wav.zip"),
|
| 360 |
+
dl_manager.download_and_extract("https://raw.githubusercontent.com/s3prl/s3prl/master/s3prl/downstream/voxceleb1/veri_test_class.txt"),
|
| 361 |
+
)
|
| 362 |
return [
|
| 363 |
datasets.SplitGenerator(
|
| 364 |
name=datasets.Split.TRAIN,
|
| 365 |
+
gen_kwargs={"archive_path": archive_path, "split": 1},
|
| 366 |
),
|
| 367 |
datasets.SplitGenerator(
|
| 368 |
name=datasets.Split.VALIDATION,
|
| 369 |
+
gen_kwargs={"archive_path": archive_path, "split": 2},
|
| 370 |
),
|
| 371 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"archive_path": archive_path, "split": 3}),
|
| 372 |
]
|
| 373 |
elif self.config.name == "sd":
|
| 374 |
splits = ["train", "dev", "test"]
|
| 375 |
_DL_URLS = {
|
| 376 |
split: {
|
| 377 |
filename: self.config.data_url.format(split=split, filename=filename)
|
| 378 |
+
for filename in ["reco2dur", "segments", "utt2spk", "mix_both.zip"]
|
| 379 |
}
|
| 380 |
for split in splits
|
| 381 |
}
|
|
|
|
| 387 |
for split in splits
|
| 388 |
]
|
| 389 |
elif self.config.name == "er":
|
| 390 |
+
archive_path = (
|
| 391 |
+
dl_manager.download_and_extract("https://huggingface.co/datasets/lhoestq/IEMOCAP_full_release/resolve/main/IEMOCAP_full_release.zip")
|
| 392 |
+
)
|
| 393 |
return [
|
| 394 |
datasets.SplitGenerator(
|
| 395 |
name=f"session{i}",
|
| 396 |
+
gen_kwargs={"archive_path": archive_path, "split": i},
|
| 397 |
)
|
| 398 |
for i in range(1, 6)
|
| 399 |
]
|
|
|
|
| 435 |
label = "_unknown_"
|
| 436 |
yield key, {"file": audio_file, "audio": audio_file, "label": label}
|
| 437 |
elif self.config.name == "ic":
|
| 438 |
+
csv_path = os.path.join(archive_path, "data", f"{split}_data.csv")
|
|
|
|
| 439 |
with open(csv_path, encoding="utf-8") as csv_file:
|
| 440 |
csv_reader = csv.reader(csv_file, delimiter=",", skipinitialspace=True)
|
| 441 |
next(csv_reader)
|
| 442 |
for row in csv_reader:
|
| 443 |
key, file_path, speaker_id, text, action, object_, location = row
|
| 444 |
+
audio_path = os.path.join(archive_path, file_path)
|
| 445 |
yield key, {
|
| 446 |
"file": audio_path,
|
| 447 |
"audio": audio_path,
|
|
|
|
| 452 |
"location": location,
|
| 453 |
}
|
| 454 |
elif self.config.name == "si":
|
| 455 |
+
*archives_dirs, splits_path = archive_path
|
|
|
|
| 456 |
with open(splits_path, "r", encoding="utf-8") as f:
|
| 457 |
for key, line in enumerate(f):
|
| 458 |
split_id, file_path = line.strip().split(" ")
|
| 459 |
if int(split_id) != split:
|
| 460 |
continue
|
| 461 |
speaker_id = file_path.split("/")[0]
|
| 462 |
+
for archive_dir in archives_dirs: # in one or the other
|
| 463 |
+
wav_path = os.path.join(archive_dir, "wav")
|
| 464 |
+
audio_path = os.path.join(wav_path, file_path)
|
| 465 |
+
if os.path.exists(audio_path):
|
| 466 |
+
yield key, {
|
| 467 |
+
"file": audio_path,
|
| 468 |
+
"audio": audio_path,
|
| 469 |
+
"label": speaker_id,
|
| 470 |
+
}
|
| 471 |
elif self.config.name == "sd":
|
| 472 |
data = SdData(archive_path)
|
| 473 |
args = SdArgs()
|
|
|
|
| 527 |
"""Load sd data."""
|
| 528 |
self.segments = self._load_segments_rechash(data_dir["segments"])
|
| 529 |
self.utt2spk = self._load_utt2spk(data_dir["utt2spk"])
|
| 530 |
+
self.wavs = self._load_wav_zip(data_dir["mix_both.zip"])
|
| 531 |
self.reco2dur = self._load_reco2dur(data_dir["reco2dur"])
|
| 532 |
|
| 533 |
def _load_segments_rechash(self, segments_file):
|
|
|
|
| 545 |
|
| 546 |
def _load_wav_zip(self, wav_zip):
|
| 547 |
"""Return dictionary { rec: wav_rxfilename }."""
|
| 548 |
+
wav_dir = os.path.join(wav_zip, "mix_both")
|
| 549 |
return {
|
| 550 |
os.path.splitext(filename)[0]: os.path.join(wav_dir, filename) for filename in sorted(os.listdir(wav_dir))
|
| 551 |
}
|