Tanel commited on
Commit
52418a0
1 Parent(s): f728d34

initial commit

Browse files
Files changed (6) hide show
  1. README.md +258 -0
  2. classifier.ckpt +3 -0
  3. embedding_model.ckpt +3 -0
  4. hyperparams.yaml +57 -0
  5. label_encoder.txt +109 -0
  6. normalizer.ckpt +3 -0
README.md ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: multilingual
3
+ thumbnail:
4
+ tags:
5
+ - audio-classification
6
+ - speechbrain
7
+ - embeddings
8
+ - Language
9
+ - Identification
10
+ - pytorch
11
+ - ECAPA-TDNN
12
+ - TDNN
13
+ - VoxLingua107
14
+ license: "apache-2.0"
15
+ datasets:
16
+ - VoxLingua107
17
+ metrics:
18
+ - Accuracy
19
+ widget:
20
+ - label: English Sample
21
+ src: https://cdn-media.huggingface.co/speech_samples/LibriSpeech_61-70968-0000.flac
22
+ ---
23
+
24
+ # VoxLingua107 ECAPA-TDNN Spoken Language Identification Model (CE)
25
+
26
+ ## Model description
27
+
28
+ This is a spoken language recognition model trained on the VoxLingua107 dataset using SpeechBrain.
29
+ The model uses the ECAPA-TDNN architecture that has previously been used for speaker recognition. However, it uses
30
+ more fully connected hidden layers after the embedding layer, and cross-entropy loss was used for training.
31
+ We observed that this improved the performance of extracted utterance embeddings for downstream tasks.
32
+
33
+ The model can classify a speech utterance according to the language spoken.
34
+ It covers 107 different languages (
35
+ Abkhazian,
36
+ Afrikaans,
37
+ Amharic,
38
+ Arabic,
39
+ Assamese,
40
+ Azerbaijani,
41
+ Bashkir,
42
+ Belarusian,
43
+ Bulgarian,
44
+ Bengali,
45
+ Tibetan,
46
+ Breton,
47
+ Bosnian,
48
+ Catalan,
49
+ Cebuano,
50
+ Czech,
51
+ Welsh,
52
+ Danish,
53
+ German,
54
+ Greek,
55
+ English,
56
+ Esperanto,
57
+ Spanish,
58
+ Estonian,
59
+ Basque,
60
+ Persian,
61
+ Finnish,
62
+ Faroese,
63
+ French,
64
+ Galician,
65
+ Guarani,
66
+ Gujarati,
67
+ Manx,
68
+ Hausa,
69
+ Hawaiian,
70
+ Hindi,
71
+ Croatian,
72
+ Haitian,
73
+ Hungarian,
74
+ Armenian,
75
+ Interlingua,
76
+ Indonesian,
77
+ Icelandic,
78
+ Italian,
79
+ Hebrew,
80
+ Japanese,
81
+ Javanese,
82
+ Georgian,
83
+ Kazakh,
84
+ Central Khmer,
85
+ Kannada,
86
+ Korean,
87
+ Latin,
88
+ Luxembourgish,
89
+ Lingala,
90
+ Lao,
91
+ Lithuanian,
92
+ Latvian,
93
+ Malagasy,
94
+ Maori,
95
+ Macedonian,
96
+ Malayalam,
97
+ Mongolian,
98
+ Marathi,
99
+ Malay,
100
+ Maltese,
101
+ Burmese,
102
+ Nepali,
103
+ Dutch,
104
+ Norwegian Nynorsk,
105
+ Norwegian,
106
+ Occitan,
107
+ Panjabi,
108
+ Polish,
109
+ Pushto,
110
+ Portuguese,
111
+ Romanian,
112
+ Russian,
113
+ Sanskrit,
114
+ Scots,
115
+ Sindhi,
116
+ Sinhala,
117
+ Slovak,
118
+ Slovenian,
119
+ Shona,
120
+ Somali,
121
+ Albanian,
122
+ Serbian,
123
+ Sundanese,
124
+ Swedish,
125
+ Swahili,
126
+ Tamil,
127
+ Telugu,
128
+ Tajik,
129
+ Thai,
130
+ Turkmen,
131
+ Tagalog,
132
+ Turkish,
133
+ Tatar,
134
+ Ukrainian,
135
+ Urdu,
136
+ Uzbek,
137
+ Vietnamese,
138
+ Waray,
139
+ Yiddish,
140
+ Yoruba,
141
+ Mandarin Chinese).
142
+
143
+ ## Intended uses & limitations
144
+
145
+ The model has two uses:
146
+
147
+ - use 'as is' for spoken language recognition
148
+ - use as an utterance-level feature (embedding) extractor, for creating a dedicated language ID model on your own data
149
+
150
+ The model is trained on automatically collected YouTube data. For more
151
+ information about the dataset, see [here](http://bark.phon.ioc.ee/voxlingua107/).
152
+
153
+
154
+ #### How to use
155
+
156
+ ```python
157
+ import torchaudio
158
+ from speechbrain.pretrained import EncoderClassifier
159
+ language_id = EncoderClassifier.from_hparams(source="speechbrain/lang-id-voxlingua107-ecapa", savedir="tmp")
160
+ # Download Thai language sample from Omniglot and cvert to suitable form
161
+ signal = language_id.load_audio("https://omniglot.com/soundfiles/udhr/udhr_th.mp3")
162
+ prediction = language_id.classify_batch(signal)
163
+ print(prediction)
164
+ (tensor([[-2.8646e+01, -3.0346e+01, -2.0748e+01, -2.9562e+01, -2.2187e+01,
165
+ -3.2668e+01, -3.6677e+01, -3.3573e+01, -3.2545e+01, -2.4365e+01,
166
+ -2.4688e+01, -3.1171e+01, -2.7743e+01, -2.9918e+01, -2.4770e+01,
167
+ -3.2250e+01, -2.4727e+01, -2.6087e+01, -2.1870e+01, -3.2821e+01,
168
+ -2.2128e+01, -2.2822e+01, -3.0888e+01, -3.3564e+01, -2.9906e+01,
169
+ -2.2392e+01, -2.5573e+01, -2.6443e+01, -3.2429e+01, -3.2652e+01,
170
+ -3.0030e+01, -2.4607e+01, -2.2967e+01, -2.4396e+01, -2.8578e+01,
171
+ -2.5153e+01, -2.8475e+01, -2.6409e+01, -2.5230e+01, -2.7957e+01,
172
+ -2.6298e+01, -2.3609e+01, -2.5863e+01, -2.8225e+01, -2.7225e+01,
173
+ -3.0486e+01, -2.1185e+01, -2.7938e+01, -3.3155e+01, -1.9076e+01,
174
+ -2.9181e+01, -2.2160e+01, -1.8352e+01, -2.5866e+01, -3.3636e+01,
175
+ -4.2016e+00, -3.1581e+01, -3.1894e+01, -2.7834e+01, -2.5429e+01,
176
+ -3.2235e+01, -3.2280e+01, -2.8786e+01, -2.3366e+01, -2.6047e+01,
177
+ -2.2075e+01, -2.3770e+01, -2.2518e+01, -2.8101e+01, -2.5745e+01,
178
+ -2.6441e+01, -2.9822e+01, -2.7109e+01, -3.0225e+01, -2.4566e+01,
179
+ -2.9268e+01, -2.7651e+01, -3.4221e+01, -2.9026e+01, -2.6009e+01,
180
+ -3.1968e+01, -3.1747e+01, -2.8156e+01, -2.9025e+01, -2.7756e+01,
181
+ -2.8052e+01, -2.9341e+01, -2.8806e+01, -2.1636e+01, -2.3992e+01,
182
+ -2.3794e+01, -3.3743e+01, -2.8332e+01, -2.7465e+01, -1.5085e-02,
183
+ -2.9094e+01, -2.1444e+01, -2.9780e+01, -3.6046e+01, -3.7401e+01,
184
+ -3.0888e+01, -3.3172e+01, -1.8931e+01, -2.2679e+01, -3.0225e+01,
185
+ -2.4995e+01, -2.1028e+01]]), tensor([-0.0151]), tensor([94]), ['th'])
186
+ # The scores in the prediction[0] tensor can be interpreted as log-likelihoods that
187
+ # the given utterance belongs to the given language (i.e., the larger the better)
188
+ # The linear-scale likelihood can be retrieved using the following:
189
+ print(prediction[1].exp())
190
+ tensor([0.9850])
191
+ # The identified language ISO code is given in prediction[3]
192
+ print(prediction[3])
193
+ ['th']
194
+
195
+ # Alternatively, use the utterance embedding extractor:
196
+ emb = language_id.encode_batch(signal)
197
+ print(emb.shape)
198
+ torch.Size([1, 1, 256])
199
+ ```
200
+ To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
201
+
202
+
203
+ #### Limitations and bias
204
+
205
+ Since the model is trained on VoxLingua107, it has many limitations and biases, some of which are:
206
+
207
+ - Probably it's accuracy on smaller languages is quite limited
208
+ - Probably it works worse on female speech than male speech (because YouTube data includes much more male speech)
209
+ - Based on subjective experiments, it doesn't work well on speech with a foreign accent
210
+ - Probably it doesn't work well on children's speech and on persons with speech disorders
211
+
212
+
213
+ ## Training data
214
+
215
+ The model is trained on [VoxLingua107](http://bark.phon.ioc.ee/voxlingua107/).
216
+
217
+ VoxLingua107 is a speech dataset for training spoken language identification models.
218
+ The dataset consists of short speech segments automatically extracted from YouTube videos and labeled according the language of the video title and description, with some post-processing steps to filter out false positives.
219
+
220
+ VoxLingua107 contains data for 107 languages. The total amount of speech in the training set is 6628 hours.
221
+ The average amount of data per language is 62 hours. However, the real amount per language varies a lot. There is also a seperate development set containing 1609 speech segments from 33 languages, validated by at least two volunteers to really contain the given language.
222
+
223
+ ## Training procedure
224
+
225
+ See the [SpeechBrain recipe](https://github.com/speechbrain/speechbrain/tree/voxlingua107/recipes/VoxLingua107/lang_id).
226
+
227
+ ## Evaluation results
228
+
229
+ Error rate: 6.7% on the VoxLingua107 development dataset
230
+
231
+ #### Referencing SpeechBrain
232
+ ```bibtex
233
+ @misc{speechbrain,
234
+ title={{SpeechBrain}: A General-Purpose Speech Toolkit},
235
+ author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
236
+ year={2021},
237
+ eprint={2106.04624},
238
+ archivePrefix={arXiv},
239
+ primaryClass={eess.AS},
240
+ note={arXiv:2106.04624}
241
+ }
242
+ ```
243
+
244
+ ### Referencing VoxLingua107
245
+
246
+ ```bibtex
247
+ @inproceedings{valk2021slt,
248
+ title={{VoxLingua107}: a Dataset for Spoken Language Recognition},
249
+ author={J{\"o}rgen Valk and Tanel Alum{\"a}e},
250
+ booktitle={Proc. IEEE SLT Workshop},
251
+ year={2021},
252
+ }
253
+ ```
254
+
255
+ #### About SpeechBrain
256
+ SpeechBrain is an open-source and all-in-one speech toolkit. It is designed to be simple, extremely flexible, and user-friendly. Competitive or state-of-the-art performance is obtained in various domains.
257
+ Website: https://speechbrain.github.io/
258
+ GitHub: https://github.com/speechbrain/speechbrain
classifier.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a50d9024ff58d317031c9787d4c6c614d454a87a8ef32f9d36338cd3ff57adbc
3
+ size 762555
embedding_model.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab750d5c06d713477045fa798fab5d33e959dbc0dfe4de510a9a47844c79a19a
3
+ size 84474355
hyperparams.yaml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pretrained_path: speechbrain/lang-id-voxlingua107-ecapa
2
+
3
+
4
+ # Feature parameters
5
+ n_mels: 60
6
+ left_frames: 0
7
+ right_frames: 0
8
+ deltas: false
9
+
10
+ # Number of speakers
11
+ out_n_neurons: 107
12
+
13
+ # Functions
14
+ compute_features: !new:speechbrain.lobes.features.Fbank
15
+ n_mels: 60
16
+ left_frames: 0
17
+ right_frames: 0
18
+ deltas: false
19
+
20
+ embedding_model: !new:speechbrain.lobes.models.ECAPA_TDNN.ECAPA_TDNN
21
+ input_size: 60
22
+ channels: [1024, 1024, 1024, 1024, 3072]
23
+ kernel_sizes: [5, 3, 3, 3, 1]
24
+ dilations: [1, 2, 3, 4, 1]
25
+ attention_channels: 128
26
+ lin_neurons: 256
27
+
28
+
29
+ classifier: !new:speechbrain.lobes.models.Xvector.Classifier
30
+ input_shape: [null, null, 256]
31
+ activation: !name:torch.nn.LeakyReLU
32
+ lin_blocks: 1
33
+ lin_neurons: 512
34
+ out_neurons: !ref <out_n_neurons>
35
+
36
+
37
+ mean_var_norm: !new:speechbrain.processing.features.InputNormalization
38
+ norm_type: sentence
39
+ std_norm: false
40
+
41
+ modules:
42
+ compute_features: !ref <compute_features>
43
+ mean_var_norm: !ref <mean_var_norm>
44
+ embedding_model: !ref <embedding_model>
45
+ classifier: !ref <classifier>
46
+
47
+ label_encoder: !new:speechbrain.dataio.encoder.CategoricalEncoder
48
+
49
+ pretrainer: !new:speechbrain.utils.parameter_transfer.Pretrainer
50
+ loadables:
51
+ embedding_model: !ref <embedding_model>
52
+ classifier: !ref <classifier>
53
+ label_encoder: !ref <label_encoder>
54
+ paths:
55
+ embedding_model: !ref <pretrained_path>/embedding_model.ckpt
56
+ classifier: !ref <pretrained_path>/classifier.ckpt
57
+ label_encoder: !ref <pretrained_path>/label_encoder.txt
label_encoder.txt ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'ab' => 0
2
+ 'af' => 1
3
+ 'am' => 2
4
+ 'ar' => 3
5
+ 'as' => 4
6
+ 'az' => 5
7
+ 'ba' => 6
8
+ 'be' => 7
9
+ 'bg' => 8
10
+ 'bn' => 9
11
+ 'bo' => 10
12
+ 'br' => 11
13
+ 'bs' => 12
14
+ 'ca' => 13
15
+ 'ceb' => 14
16
+ 'cs' => 15
17
+ 'cy' => 16
18
+ 'da' => 17
19
+ 'de' => 18
20
+ 'el' => 19
21
+ 'en' => 20
22
+ 'eo' => 21
23
+ 'es' => 22
24
+ 'et' => 23
25
+ 'eu' => 24
26
+ 'fa' => 25
27
+ 'fi' => 26
28
+ 'fo' => 27
29
+ 'fr' => 28
30
+ 'gl' => 29
31
+ 'gn' => 30
32
+ 'gu' => 31
33
+ 'gv' => 32
34
+ 'ha' => 33
35
+ 'haw' => 34
36
+ 'hi' => 35
37
+ 'hr' => 36
38
+ 'ht' => 37
39
+ 'hu' => 38
40
+ 'hy' => 39
41
+ 'ia' => 40
42
+ 'id' => 41
43
+ 'is' => 42
44
+ 'it' => 43
45
+ 'iw' => 44
46
+ 'ja' => 45
47
+ 'jw' => 46
48
+ 'ka' => 47
49
+ 'kk' => 48
50
+ 'km' => 49
51
+ 'kn' => 50
52
+ 'ko' => 51
53
+ 'la' => 52
54
+ 'lb' => 53
55
+ 'ln' => 54
56
+ 'lo' => 55
57
+ 'lt' => 56
58
+ 'lv' => 57
59
+ 'mg' => 58
60
+ 'mi' => 59
61
+ 'mk' => 60
62
+ 'ml' => 61
63
+ 'mn' => 62
64
+ 'mr' => 63
65
+ 'ms' => 64
66
+ 'mt' => 65
67
+ 'my' => 66
68
+ 'ne' => 67
69
+ 'nl' => 68
70
+ 'nn' => 69
71
+ 'no' => 70
72
+ 'oc' => 71
73
+ 'pa' => 72
74
+ 'pl' => 73
75
+ 'ps' => 74
76
+ 'pt' => 75
77
+ 'ro' => 76
78
+ 'ru' => 77
79
+ 'sa' => 78
80
+ 'sco' => 79
81
+ 'sd' => 80
82
+ 'si' => 81
83
+ 'sk' => 82
84
+ 'sl' => 83
85
+ 'sn' => 84
86
+ 'so' => 85
87
+ 'sq' => 86
88
+ 'sr' => 87
89
+ 'su' => 88
90
+ 'sv' => 89
91
+ 'sw' => 90
92
+ 'ta' => 91
93
+ 'te' => 92
94
+ 'tg' => 93
95
+ 'th' => 94
96
+ 'tk' => 95
97
+ 'tl' => 96
98
+ 'tr' => 97
99
+ 'tt' => 98
100
+ 'uk' => 99
101
+ 'ur' => 100
102
+ 'uz' => 101
103
+ 'vi' => 102
104
+ 'war' => 103
105
+ 'yi' => 104
106
+ 'yo' => 105
107
+ 'zh' => 106
108
+ ================
109
+ 'starting_index' => 0
normalizer.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c369e01dfa2e0d84c6b116f33c7b94f1fe28c061642086538e93cde3d97c26ef
3
+ size 1063