Datasets:
Commit
•
54cea06
0
Parent(s):
Update files from the datasets library (from 1.3.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.3.0
- .gitattributes +27 -0
- README.md +187 -0
- dataset_infos.json +1 -0
- dummy/clean/2.1.0/dummy_data.zip +3 -0
- dummy/other/2.1.0/dummy_data.zip +3 -0
- librispeech_asr.py +154 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
- expert-generated
|
7 |
+
languages:
|
8 |
+
- en
|
9 |
+
licenses:
|
10 |
+
- cc-by-4-0
|
11 |
+
multilinguality:
|
12 |
+
- monolingual
|
13 |
+
size_categories:
|
14 |
+
- 100K<n<1M
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- other
|
19 |
+
task_ids:
|
20 |
+
- other-other-automatic speech recognition
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for librispeech_asr
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Dataset Description](#dataset-description)
|
27 |
+
- [Dataset Summary](#dataset-summary)
|
28 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
29 |
+
- [Languages](#languages)
|
30 |
+
- [Dataset Structure](#dataset-structure)
|
31 |
+
- [Data Instances](#data-instances)
|
32 |
+
- [Data Fields](#data-instances)
|
33 |
+
- [Data Splits](#data-instances)
|
34 |
+
- [Dataset Creation](#dataset-creation)
|
35 |
+
- [Curation Rationale](#curation-rationale)
|
36 |
+
- [Source Data](#source-data)
|
37 |
+
- [Annotations](#annotations)
|
38 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
39 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
40 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
41 |
+
- [Discussion of Biases](#discussion-of-biases)
|
42 |
+
- [Other Known Limitations](#other-known-limitations)
|
43 |
+
- [Additional Information](#additional-information)
|
44 |
+
- [Dataset Curators](#dataset-curators)
|
45 |
+
- [Licensing Information](#licensing-information)
|
46 |
+
- [Citation Information](#citation-information)
|
47 |
+
- [Contributions](#contributions)
|
48 |
+
|
49 |
+
## Dataset Description
|
50 |
+
|
51 |
+
- **Homepage:** [LibriSpeech ASR corpus](http://www.openslr.org/12)
|
52 |
+
- **Repository:** [Needs More Information]
|
53 |
+
- **Paper:** [LibriSpeech: An ASR Corpus Based On Public Domain Audio Books](https://www.danielpovey.com/files/2015_icassp_librispeech.pdf)
|
54 |
+
- **Leaderboard:** [Paperswithcode Leaderboard](https://paperswithcode.com/sota/speech-recognition-on-librispeech-test-other)
|
55 |
+
- **Point of Contact:** [Daniel Povey](mailto:dpovey@gmail.com)
|
56 |
+
|
57 |
+
### Dataset Summary
|
58 |
+
|
59 |
+
LibriSpeech is a corpus of approximately 1000 hours of 16kHz read English speech, prepared by Vassil Panayotov with the assistance of Daniel Povey. The data is derived from read audiobooks from the LibriVox project, and has been carefully segmented and aligned.
|
60 |
+
|
61 |
+
### Supported Tasks and Leaderboards
|
62 |
+
|
63 |
+
- `automatic-speech-recognition`, `speaker-identification`: The dataset can be used to train a model for Automatic Speech Recognition (ASR). The model is presented with an audio file and asked to transcribe the audio file to written text. The most common evaluation metric is the word error rate (WER). The task has an active leaderboard which can be found at https://paperswithcode.com/sota/speech-recognition-on-librispeech-test-clean and ranks models based on their WER.
|
64 |
+
|
65 |
+
### Languages
|
66 |
+
|
67 |
+
The audio is in English. There are two configurations: `clean` and `other`.
|
68 |
+
The speakers in the corpus were ranked according to the WER of the transcripts of a model trained on
|
69 |
+
a different dataset, and were divided roughly in the middle,
|
70 |
+
with the lower-WER speakers designated as "clean" and the higher WER speakers designated as "other".
|
71 |
+
|
72 |
+
## Dataset Structure
|
73 |
+
|
74 |
+
### Data Instances
|
75 |
+
|
76 |
+
A typical data point comprises the path to the audio file, usually called `file` and its transcription, called `text`. Some additional information about the speaker and the passage which contains the transcription is provided.
|
77 |
+
|
78 |
+
```
|
79 |
+
{'chapter_id': 141231,
|
80 |
+
'file': '/home/patrick/.cache/huggingface/datasets/downloads/extracted/b7ded9969e09942ab65313e691e6fc2e12066192ee8527e21d634aca128afbe2/dev_clean/1272/141231/1272-141231-0000.flac',
|
81 |
+
'id': '1272-141231-0000',
|
82 |
+
'speaker_id': 1272,
|
83 |
+
'text': 'A MAN SAID TO THE UNIVERSE SIR I EXIST'}
|
84 |
+
```
|
85 |
+
|
86 |
+
|
87 |
+
### Data Fields
|
88 |
+
|
89 |
+
- file: A path to the downloaded audio file in .flac format.
|
90 |
+
|
91 |
+
- text: the transcription of the audio file.
|
92 |
+
|
93 |
+
- id: unique id of the data sample.
|
94 |
+
|
95 |
+
- speaker_id: unique id of the speaker. The same speaker id can be found for multiple data samples.
|
96 |
+
|
97 |
+
- chapter_id: id of the audiobook chapter which includes the transcription.
|
98 |
+
|
99 |
+
### Data Splits
|
100 |
+
|
101 |
+
The size of the corpus makes it impractical, or at least inconvenient
|
102 |
+
for some users, to distribute it as a single large archive. Thus the
|
103 |
+
training portion of the corpus is split into three subsets, with approximate size 100, 360 and 500 hours respectively.
|
104 |
+
A simple automatic
|
105 |
+
procedure was used to select the audio in the first two sets to be, on
|
106 |
+
average, of higher recording quality and with accents closer to US
|
107 |
+
English. An acoustic model was trained on WSJ’s si-84 data subset
|
108 |
+
and was used to recognize the audio in the corpus, using a bigram
|
109 |
+
LM estimated on the text of the respective books. We computed the
|
110 |
+
Word Error Rate (WER) of this automatic transcript relative to our
|
111 |
+
reference transcripts obtained from the book texts.
|
112 |
+
The speakers in the corpus were ranked according to the WER of
|
113 |
+
the WSJ model’s transcripts, and were divided roughly in the middle,
|
114 |
+
with the lower-WER speakers designated as "clean" and the higher-WER speakers designated as "other".
|
115 |
+
|
116 |
+
For "clean", the data is split into train, validation, and test set. The train set is further split into train.100 and train.360
|
117 |
+
respectively accounting for 100h and 360h of the training data.
|
118 |
+
For "other", the data is split into train, validation, and test set. The train set contains approximately 500h of recorded speech.
|
119 |
+
|
120 |
+
| | Train.500 | Train.360 | Train.100 | Valid | Test |
|
121 |
+
| ----- | ------ | ----- | ---- | ---- | ---- |
|
122 |
+
| clean | - | 104014 | 28539 | 2703 | 2620|
|
123 |
+
| other | 148688 | - | - | 2864 | 2939 |
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
## Dataset Creation
|
128 |
+
|
129 |
+
### Curation Rationale
|
130 |
+
|
131 |
+
[Needs More Information]
|
132 |
+
|
133 |
+
### Source Data
|
134 |
+
|
135 |
+
#### Initial Data Collection and Normalization
|
136 |
+
|
137 |
+
[Needs More Information]
|
138 |
+
|
139 |
+
#### Who are the source language producers?
|
140 |
+
|
141 |
+
[Needs More Information]
|
142 |
+
|
143 |
+
### Annotations
|
144 |
+
|
145 |
+
#### Annotation process
|
146 |
+
|
147 |
+
[Needs More Information]
|
148 |
+
|
149 |
+
#### Who are the annotators?
|
150 |
+
|
151 |
+
[Needs More Information]
|
152 |
+
|
153 |
+
### Personal and Sensitive Information
|
154 |
+
|
155 |
+
[Needs More Information]
|
156 |
+
|
157 |
+
## Considerations for Using the Data
|
158 |
+
|
159 |
+
### Social Impact of Dataset
|
160 |
+
|
161 |
+
[More Information Needed]
|
162 |
+
|
163 |
+
### Discussion of Biases
|
164 |
+
|
165 |
+
[More Information Needed]
|
166 |
+
|
167 |
+
### Other Known Limitations
|
168 |
+
|
169 |
+
[Needs More Information]
|
170 |
+
|
171 |
+
## Additional Information
|
172 |
+
|
173 |
+
### Dataset Curators
|
174 |
+
|
175 |
+
The dataset was initially created by Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur.
|
176 |
+
|
177 |
+
### Licensing Information
|
178 |
+
|
179 |
+
CC BY 4.0
|
180 |
+
|
181 |
+
### Citation Information
|
182 |
+
|
183 |
+
[Needs More Information]
|
184 |
+
|
185 |
+
### Contributions
|
186 |
+
|
187 |
+
Thanks to [@patrickvonplaten](https://github.com/patrickvonplaten) for adding this dataset.
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"clean": {"description": "LibriSpeech is a corpus of approximately 1000 hours of read English speech with sampling rate of 16 kHz,\nprepared by Vassil Panayotov with the assistance of Daniel Povey. The data is derived from read\naudiobooks from the LibriVox project, and has been carefully segmented and aligned.87\n\nNote that in order to limit the required storage for preparing this dataset, the audio\nis stored in the .flac format and is not converted to a float32 array. To convert, the audio\nfile to a float32 array, please make use of the `.map()` function as follows:\n\n\n```python\nimport soundfile as sf\n\ndef map_to_array(batch):\n speech_array, _ = sf.read(batch[\"file\"])\n batch[\"speech\"] = speech_array\n return batch\n\ndataset = dataset.map(map_to_array, remove_columns=[\"file\"])\n", "citation": "@inproceedings{panayotov2015librispeech,\n title={Librispeech: an ASR corpus based on public domain audio books},\n author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},\n booktitle={Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on},\n pages={5206--5210},\n year={2015},\n organization={IEEE}\n}\n", "homepage": "http://www.openslr.org/12", "license": "", "features": {"file": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "speaker_id": {"dtype": "int64", "id": null, "_type": "Value"}, "chapter_id": {"dtype": "int64", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "speech", "output": "text"}, "builder_name": "librispeech_asr", "config_name": "clean", "version": {"version_str": "2.1.0", "description": "", "major": 2, "minor": 1, "patch": 0}, "splits": {"train.100": {"name": "train.100", "num_bytes": 11823891, "num_examples": 28539, "dataset_name": "librispeech_asr"}, "train.360": {"name": "train.360", "num_bytes": 43049490, "num_examples": 104014, "dataset_name": "librispeech_asr"}, "validation": {"name": "validation", "num_bytes": 894510, "num_examples": 2703, "dataset_name": "librispeech_asr"}, "test": {"name": "test", "num_bytes": 868614, "num_examples": 2620, "dataset_name": "librispeech_asr"}}, "download_checksums": {"http://www.openslr.org/resources/12/dev-clean.tar.gz": {"num_bytes": 337926286, "checksum": "76f87d090650617fca0cac8f88b9416e0ebf80350acb97b343a85fa903728ab3"}, "http://www.openslr.org/resources/12/test-clean.tar.gz": {"num_bytes": 346663984, "checksum": "39fde525e59672dc6d1551919b1478f724438a95aa55f874b576be21967e6c23"}, "http://www.openslr.org/resources/12/train-clean-100.tar.gz": {"num_bytes": 6387309499, "checksum": "d4ddd1d5a6ab303066f14971d768ee43278a5f2a0aa43dc716b0e64ecbbbf6e2"}, "http://www.openslr.org/resources/12/train-clean-360.tar.gz": {"num_bytes": 23049477885, "checksum": "146a56496217e96c14334a160df97fffedd6e0a04e66b9c5af0d40be3c792ecf"}}, "download_size": 30121377654, "post_processing_size": null, "dataset_size": 56636505, "size_in_bytes": 30178014159}, "other": {"description": "LibriSpeech is a corpus of approximately 1000 hours of read English speech with sampling rate of 16 kHz,\nprepared by Vassil Panayotov with the assistance of Daniel Povey. The data is derived from read\naudiobooks from the LibriVox project, and has been carefully segmented and aligned.87\n\nNote that in order to limit the required storage for preparing this dataset, the audio\nis stored in the .flac format and is not converted to a float32 array. To convert, the audio\nfile to a float32 array, please make use of the `.map()` function as follows:\n\n\n```python\nimport soundfile as sf\n\ndef map_to_array(batch):\n speech_array, _ = sf.read(batch[\"file\"])\n batch[\"speech\"] = speech_array\n return batch\n\ndataset = dataset.map(map_to_array, remove_columns=[\"file\"])\n", "citation": "@inproceedings{panayotov2015librispeech,\n title={Librispeech: an ASR corpus based on public domain audio books},\n author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},\n booktitle={Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on},\n pages={5206--5210},\n year={2015},\n organization={IEEE}\n}\n", "homepage": "http://www.openslr.org/12", "license": "", "features": {"file": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "speaker_id": {"dtype": "int64", "id": null, "_type": "Value"}, "chapter_id": {"dtype": "int64", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "speech", "output": "text"}, "builder_name": "librispeech_asr", "config_name": "other", "version": {"version_str": "2.1.0", "description": "", "major": 2, "minor": 1, "patch": 0}, "splits": {"train.500": {"name": "train.500", "num_bytes": 59561081, "num_examples": 148688, "dataset_name": "librispeech_asr"}, "validation": {"name": "validation", "num_bytes": 907644, "num_examples": 2864, "dataset_name": "librispeech_asr"}, "test": {"name": "test", "num_bytes": 934838, "num_examples": 2939, "dataset_name": "librispeech_asr"}}, "download_checksums": {"http://www.openslr.org/resources/12/test-other.tar.gz": {"num_bytes": 328757843, "checksum": "d09c181bba5cf717b3dee7d4d592af11a3ee3a09e08ae025c5506f6ebe961c29"}, "http://www.openslr.org/resources/12/dev-other.tar.gz": {"num_bytes": 314305928, "checksum": "12661c48e8c3fe1de2c1caa4c3e135193bfb1811584f11f569dd12645aa84365"}, "http://www.openslr.org/resources/12/train-other-500.tar.gz": {"num_bytes": 30593501606, "checksum": "ddb22f27f96ec163645d53215559df6aa36515f26e01dd70798188350adcb6d2"}}, "download_size": 31236565377, "post_processing_size": null, "dataset_size": 61403563, "size_in_bytes": 31297968940}}
|
dummy/clean/2.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a42672e6d1e054ebfed873d36a9b9cee3a919a159104b59649b887ea257e3582
|
3 |
+
size 381925
|
dummy/other/2.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0286334344a77e4f0963ee68caa9c49b15126f0f8dbbaf23972e3c7ad606c0e7
|
3 |
+
size 286405
|
librispeech_asr.py
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Librispeech automatic speech recognition dataset."""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import glob
|
22 |
+
import os
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
_CITATION = """\
|
28 |
+
@inproceedings{panayotov2015librispeech,
|
29 |
+
title={Librispeech: an ASR corpus based on public domain audio books},
|
30 |
+
author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},
|
31 |
+
booktitle={Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on},
|
32 |
+
pages={5206--5210},
|
33 |
+
year={2015},
|
34 |
+
organization={IEEE}
|
35 |
+
}
|
36 |
+
"""
|
37 |
+
|
38 |
+
_DESCRIPTION = """\
|
39 |
+
LibriSpeech is a corpus of approximately 1000 hours of read English speech with sampling rate of 16 kHz,
|
40 |
+
prepared by Vassil Panayotov with the assistance of Daniel Povey. The data is derived from read
|
41 |
+
audiobooks from the LibriVox project, and has been carefully segmented and aligned.87
|
42 |
+
|
43 |
+
Note that in order to limit the required storage for preparing this dataset, the audio
|
44 |
+
is stored in the .flac format and is not converted to a float32 array. To convert, the audio
|
45 |
+
file to a float32 array, please make use of the `.map()` function as follows:
|
46 |
+
|
47 |
+
|
48 |
+
```python
|
49 |
+
import soundfile as sf
|
50 |
+
|
51 |
+
def map_to_array(batch):
|
52 |
+
speech_array, _ = sf.read(batch["file"])
|
53 |
+
batch["speech"] = speech_array
|
54 |
+
return batch
|
55 |
+
|
56 |
+
dataset = dataset.map(map_to_array, remove_columns=["file"])
|
57 |
+
```
|
58 |
+
"""
|
59 |
+
|
60 |
+
_URL = "http://www.openslr.org/12"
|
61 |
+
_DL_URL = "http://www.openslr.org/resources/12/"
|
62 |
+
|
63 |
+
_DL_URLS = {
|
64 |
+
"clean": {
|
65 |
+
"dev": _DL_URL + "dev-clean.tar.gz",
|
66 |
+
"test": _DL_URL + "test-clean.tar.gz",
|
67 |
+
"train.100": _DL_URL + "train-clean-100.tar.gz",
|
68 |
+
"train.360": _DL_URL + "train-clean-360.tar.gz",
|
69 |
+
},
|
70 |
+
"other": {
|
71 |
+
"test": _DL_URL + "test-other.tar.gz",
|
72 |
+
"dev": _DL_URL + "dev-other.tar.gz",
|
73 |
+
"train.500": _DL_URL + "train-other-500.tar.gz",
|
74 |
+
},
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
class LibrispeechASRConfig(datasets.BuilderConfig):
|
79 |
+
"""BuilderConfig for LibriSpeechASR."""
|
80 |
+
|
81 |
+
def __init__(self, **kwargs):
|
82 |
+
"""
|
83 |
+
Args:
|
84 |
+
data_dir: `string`, the path to the folder containing the files in the
|
85 |
+
downloaded .tar
|
86 |
+
citation: `string`, citation for the data set
|
87 |
+
url: `string`, url for information about the data set
|
88 |
+
**kwargs: keyword arguments forwarded to super.
|
89 |
+
"""
|
90 |
+
super(LibrispeechASRConfig, self).__init__(version=datasets.Version("2.1.0", ""), **kwargs)
|
91 |
+
|
92 |
+
|
93 |
+
class LibrispeechASR(datasets.GeneratorBasedBuilder):
|
94 |
+
"""Librispeech dataset."""
|
95 |
+
|
96 |
+
BUILDER_CONFIGS = [
|
97 |
+
LibrispeechASRConfig(name="clean", description="'Clean' speech."),
|
98 |
+
LibrispeechASRConfig(name="other", description="'Other', more challenging, speech."),
|
99 |
+
]
|
100 |
+
|
101 |
+
def _info(self):
|
102 |
+
return datasets.DatasetInfo(
|
103 |
+
description=_DESCRIPTION,
|
104 |
+
features=datasets.Features(
|
105 |
+
{
|
106 |
+
"file": datasets.Value("string"),
|
107 |
+
"text": datasets.Value("string"),
|
108 |
+
"speaker_id": datasets.Value("int64"),
|
109 |
+
"chapter_id": datasets.Value("int64"),
|
110 |
+
"id": datasets.Value("string"),
|
111 |
+
}
|
112 |
+
),
|
113 |
+
supervised_keys=("file", "text"),
|
114 |
+
homepage=_URL,
|
115 |
+
citation=_CITATION,
|
116 |
+
)
|
117 |
+
|
118 |
+
def _split_generators(self, dl_manager):
|
119 |
+
archive_path = dl_manager.download_and_extract(_DL_URLS[self.config.name])
|
120 |
+
|
121 |
+
if self.config.name == "clean":
|
122 |
+
train_splits = [
|
123 |
+
datasets.SplitGenerator(name="train.100", gen_kwargs={"archive_path": archive_path["train.100"]}),
|
124 |
+
datasets.SplitGenerator(name="train.360", gen_kwargs={"archive_path": archive_path["train.360"]}),
|
125 |
+
]
|
126 |
+
elif self.config.name == "other":
|
127 |
+
train_splits = [
|
128 |
+
datasets.SplitGenerator(name="train.500", gen_kwargs={"archive_path": archive_path["train.500"]}),
|
129 |
+
]
|
130 |
+
|
131 |
+
return train_splits + [
|
132 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"archive_path": archive_path["dev"]}),
|
133 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"archive_path": archive_path["test"]}),
|
134 |
+
]
|
135 |
+
|
136 |
+
def _generate_examples(self, archive_path):
|
137 |
+
"""Generate examples from a Librispeech archive_path."""
|
138 |
+
transcripts_glob = os.path.join(archive_path, "LibriSpeech", "*/*/*/*.txt")
|
139 |
+
for transcript_file in sorted(glob.glob(transcripts_glob)):
|
140 |
+
path = os.path.dirname(transcript_file)
|
141 |
+
with open(os.path.join(path, transcript_file), "r", encoding="utf-8") as f:
|
142 |
+
for line in f:
|
143 |
+
line = line.strip()
|
144 |
+
key, transcript = line.split(" ", 1)
|
145 |
+
audio_file = f"{key}.flac"
|
146 |
+
speaker_id, chapter_id = [int(el) for el in key.split("-")[:2]]
|
147 |
+
example = {
|
148 |
+
"id": key,
|
149 |
+
"speaker_id": speaker_id,
|
150 |
+
"chapter_id": chapter_id,
|
151 |
+
"file": os.path.join(path, audio_file),
|
152 |
+
"text": transcript,
|
153 |
+
}
|
154 |
+
yield key, example
|