|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""Libri-Light audio dataset.""" |
|
|
|
|
|
import glob |
|
import os |
|
|
|
import json |
|
|
|
import datasets |
|
|
|
|
|
_CITATION = """\ |
|
@INPROCEEDINGS{librilight, |
|
author={J. Kahn and M. Rivière and W. Zheng and E. Kharitonov and Q. Xu and P. E. Mazaré and J. Karadayi and V. Liptchinsky and R. Collobert and C. Fuegen and T. Likhomanenko and G. Synnaeve and A. Joulin and A. Mohamed and E. Dupoux}, |
|
booktitle={ICASSP 2020 - 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)}, |
|
title={Libri-Light: A Benchmark for ASR with Limited or No Supervision}, |
|
year={2020}, |
|
pages={7669-7673}, |
|
} |
|
""" |
|
|
|
_DESCRIPTION = """\ |
|
Libri-light is a large dataset of 60K hours of unlabelled speech from audiobooks in English. |
|
It is a benchmark for the training of automatic speech recognition (ASR) systems with limited or no supervision. |
|
""" |
|
|
|
_HOMEPAGE = "https://ai.facebook.com/tools/libri-light/" |
|
|
|
_LICENSE = """\ |
|
MIT License |
|
|
|
Copyright (c) Facebook, Inc. and its affiliates. |
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
of this software and associated documentation files (the "Software"), to deal |
|
in the Software without restriction, including without limitation the rights |
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
copies of the Software, and to permit persons to whom the Software is |
|
furnished to do so, subject to the following conditions: |
|
|
|
The above copyright notice and this permission notice shall be included in all |
|
copies or substantial portions of the Software. |
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
SOFTWARE. |
|
""" |
|
|
|
_DL_URL = "https://dl.fbaipublicfiles.com/librilight/data/{name}.tar" |
|
|
|
|
|
class LibriLightConfig(datasets.BuilderConfig): |
|
"""BuilderConfig for Libri-Light.""" |
|
|
|
def __init__(self, **kwargs): |
|
super(LibriLightConfig, self).__init__(version=datasets.Version("2.1.0", ""), **kwargs) |
|
|
|
|
|
class LibriLight(datasets.GeneratorBasedBuilder): |
|
"""Libri-Light dataset.""" |
|
|
|
BUILDER_CONFIGS = [ |
|
LibriLightConfig(name="small", description="577 hours, 35 GB."), |
|
LibriLightConfig(name="medium", description="5193 hours, 321 GB."), |
|
LibriLightConfig(name="large", description="51934 hours, 3.05 TB."), |
|
] |
|
|
|
def _info(self): |
|
features = datasets.Features( |
|
{ |
|
"id": datasets.Value("string"), |
|
"file": datasets.Value("string"), |
|
"audio": datasets.Audio(sampling_rate=16_000), |
|
"speaker_id": datasets.Value("int64"), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
) |
|
|
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=features, |
|
homepage=_HOMEPAGE, |
|
license=_LICENSE, |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
archive_path = dl_manager.download_and_extract({"train": _DL_URL.format(name=self.config.name)}) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={"archive_path": archive_path["train"]}, |
|
), |
|
] |
|
|
|
def _generate_examples(self, archive_path): |
|
paths = glob.glob(os.path.join(archive_path, "**", "**", "*.flac")) |
|
print("") |
|
print("ARCHIVE PATH: ", archive_path) |
|
print("LEN PATHS: ", len(paths)) |
|
print("") |
|
for key, path in enumerate(paths): |
|
path_split = path.split("/") |
|
id_ = path_split[-1].replace(".flac", "") |
|
speaker_id = int(path_split[-3]) |
|
|
|
|
|
|
|
yield key, { |
|
"id": id_, |
|
"file": path, |
|
"audio": path, |
|
"speaker_id": speaker_id, |
|
|
|
} |
|
|