m3hrdadfi commited on
Commit
ac980fe
1 Parent(s): 16e18c3

Initial model

Browse files
.ipynb_checkpoints/config-checkpoint.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/wav2vec2-large-xlsr-53",
3
+ "activation_dropout": 0.0,
4
+ "apply_spec_augment": true,
5
+ "architectures": [
6
+ "Wav2Vec2ForCTC"
7
+ ],
8
+ "attention_dropout": 0.1,
9
+ "bos_token_id": 1,
10
+ "conv_bias": true,
11
+ "conv_dim": [
12
+ 512,
13
+ 512,
14
+ 512,
15
+ 512,
16
+ 512,
17
+ 512,
18
+ 512
19
+ ],
20
+ "conv_kernel": [
21
+ 10,
22
+ 3,
23
+ 3,
24
+ 3,
25
+ 3,
26
+ 2,
27
+ 2
28
+ ],
29
+ "conv_stride": [
30
+ 5,
31
+ 2,
32
+ 2,
33
+ 2,
34
+ 2,
35
+ 2,
36
+ 2
37
+ ],
38
+ "ctc_loss_reduction": "mean",
39
+ "ctc_zero_infinity": true,
40
+ "do_stable_layer_norm": true,
41
+ "eos_token_id": 2,
42
+ "feat_extract_activation": "gelu",
43
+ "feat_extract_dropout": 0.0,
44
+ "feat_extract_norm": "layer",
45
+ "feat_proj_dropout": 0.0,
46
+ "final_dropout": 0.0,
47
+ "gradient_checkpointing": true,
48
+ "hidden_act": "gelu",
49
+ "hidden_dropout": 0.1,
50
+ "hidden_size": 1024,
51
+ "initializer_range": 0.02,
52
+ "intermediate_size": 4096,
53
+ "layer_norm_eps": 1e-05,
54
+ "layerdrop": 0.1,
55
+ "mask_channel_length": 10,
56
+ "mask_channel_min_space": 1,
57
+ "mask_channel_other": 0.0,
58
+ "mask_channel_prob": 0.0,
59
+ "mask_channel_selection": "static",
60
+ "mask_feature_length": 10,
61
+ "mask_feature_prob": 0.0,
62
+ "mask_time_length": 10,
63
+ "mask_time_min_space": 1,
64
+ "mask_time_other": 0.0,
65
+ "mask_time_prob": 0.05,
66
+ "mask_time_selection": "static",
67
+ "model_type": "wav2vec2",
68
+ "num_attention_heads": 16,
69
+ "num_conv_pos_embedding_groups": 16,
70
+ "num_conv_pos_embeddings": 128,
71
+ "num_feat_extract_layers": 7,
72
+ "num_hidden_layers": 24,
73
+ "pad_token_id": 0,
74
+ "transformers_version": "4.5.0.dev0",
75
+ "vocab_size": 40
76
+ }
README.md ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: fa
3
+ datasets:
4
+ - common_voice
5
+ tags:
6
+ - audio
7
+ - automatic-speech-recognition
8
+ - speech
9
+ - xlsr-fine-tuning-week
10
+ license: apache-2.0
11
+ widget:
12
+ - label: Common Voice sample 4024
13
+ src: https://huggingface.co/m3hrdadfi/wav2vec2-large-xlsr-persian-v2/resolve/main/sample4024.flac
14
+ - label: Common Voice sample 4084
15
+ src: https://huggingface.co/m3hrdadfi/wav2vec2-large-xlsr-persian-v2/resolve/main/sample4084.flac
16
+ model-index:
17
+ - name: XLSR Wav2Vec2 Persian (Farsi) V2 by Mehrdad Farahani
18
+ results:
19
+ - task:
20
+ name: Speech Recognition
21
+ type: automatic-speech-recognition
22
+ dataset:
23
+ name: Common Voice fa
24
+ type: common_voice
25
+ args: fa
26
+ metrics:
27
+ - name: Test WER
28
+ type: wer
29
+ value: 31.92
30
+
31
+ ---
32
+
33
+ # Wav2Vec2-Large-XLSR-53-Persian V2
34
+
35
+ Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) in Persian (Farsi) using [Common Voice](https://huggingface.co/datasets/common_voice). When using this model, make sure that your speech input is sampled at 16kHz.
36
+
37
+ ## Usage
38
+ The model can be used directly (without a language model) as follows:
39
+
40
+ **Requirements**
41
+ ```bash
42
+ # requirement packages
43
+ !pip install git+https://github.com/huggingface/datasets.git
44
+ !pip install git+https://github.com/huggingface/transformers.git
45
+ !pip install torchaudio
46
+ !pip install librosa
47
+ !pip install jiwer
48
+ !pip install hazm
49
+ ```
50
+
51
+
52
+ **Prediction**
53
+ ```python
54
+ import librosa
55
+ import torch
56
+ import torchaudio
57
+ from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
58
+ from datasets import load_dataset
59
+
60
+ import numpy as np
61
+ import hazm
62
+ import re
63
+ import string
64
+
65
+ import IPython.display as ipd
66
+
67
+ _normalizer = hazm.Normalizer()
68
+
69
+ chars_to_ignore = [
70
+ ",", "?", ".", "!", "-", ";", ":", '""', "%", "'", '"', "�",
71
+ "#", "!", "؟", "?", "«", "»", "،", "(", ")", "؛", "'ٔ", "٬",'ٔ', ",", "?",
72
+ ".", "!", "-", ";", ":",'"',"“", "%", "‘", "”", "�", "–", "…", "_", "”", '“', '„',
73
+ 'ā', 'š',
74
+ # "ء",
75
+ ]
76
+
77
+ # In case of farsi
78
+ chars_to_ignore = chars_to_ignore + list(string.ascii_lowercase + string.digits)
79
+
80
+ chars_to_mapping = {
81
+ 'ك': 'ک', 'دِ': 'د', 'بِ': 'ب', 'زِ': 'ز', 'ذِ': 'ذ', 'شِ': 'ش', 'سِ': 'س', 'ى': 'ی',
82
+ 'ي': 'ی', 'أ': 'ا', 'ؤ': 'و', "ے": "ی", "ۀ": "ه", "ﭘ": "پ", "ﮐ": "ک", "ﯽ": "ی",
83
+ "ﺎ": "ا", "ﺑ": "ب", "ﺘ": "ت", "ﺧ": "خ", "ﺩ": "د", "ﺱ": "س", "ﻀ": "ض", "ﻌ": "ع",
84
+ "ﻟ": "ل", "ﻡ": "م", "ﻢ": "م", "ﻪ": "ه", "ﻮ": "و", 'ﺍ': "ا", 'ة': "ه",
85
+ 'ﯾ': "ی", 'ﯿ': "ی", 'ﺒ': "ب", 'ﺖ': "ت", 'ﺪ': "د", 'ﺮ': "ر", 'ﺴ': "س", 'ﺷ': "ش",
86
+ 'ﺸ': "ش", 'ﻋ': "ع", 'ﻤ': "م", 'ﻥ': "ن", 'ﻧ': "ن", 'ﻭ': "و", 'ﺭ': "ر", "ﮔ": "گ",
87
+
88
+ # "ها": " ها", "ئ": "ی",
89
+
90
+ "a": " ای ", "b": " بی ", "c": " سی ", "d": " دی ", "e": " ایی ", "f": " اف ",
91
+ "g": " جی ", "h": " اچ ", "i": " آی ", "j": " جی ", "k": " کی ", "l": " ال ",
92
+ "m": " ام ", "n": " ان ", "o": " او ", "p": " پی ", "q": " کیو ", "r": " آر ",
93
+ "s": " اس ", "t": " تی ", "u": " یو ", "v": " وی ", "w": " دبلیو ", "x": " اکس ",
94
+ "y": " وای ", "z": " زد ",
95
+ "\u200c": " ", "\u200d": " ", "\u200e": " ", "\u200f": " ", "\ufeff": " ",
96
+ }
97
+
98
+ def multiple_replace(text, chars_to_mapping):
99
+ pattern = "|".join(map(re.escape, chars_to_mapping.keys()))
100
+ return re.sub(pattern, lambda m: chars_to_mapping[m.group()], str(text))
101
+
102
+ def remove_special_characters(text, chars_to_ignore_regex):
103
+ text = re.sub(chars_to_ignore_regex, '', text).lower() + " "
104
+ return text
105
+
106
+ def normalizer(batch, chars_to_ignore, chars_to_mapping):
107
+ chars_to_ignore_regex = f"""[{"".join(chars_to_ignore)}]"""
108
+ text = batch["sentence"].lower().strip()
109
+
110
+ text = _normalizer.normalize(text)
111
+ text = multiple_replace(text, chars_to_mapping)
112
+ text = remove_special_characters(text, chars_to_ignore_regex)
113
+ text = re.sub(" +", " ", text)
114
+ text = text.strip() + " "
115
+
116
+ batch["sentence"] = text
117
+ return batch
118
+
119
+
120
+ def speech_file_to_array_fn(batch):
121
+ speech_array, sampling_rate = torchaudio.load(batch["path"])
122
+ speech_array = speech_array.squeeze().numpy()
123
+ speech_array = librosa.resample(np.asarray(speech_array), sampling_rate, 16_000)
124
+
125
+ batch["speech"] = speech_array
126
+ return batch
127
+
128
+
129
+ def predict(batch):
130
+ features = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
131
+
132
+ input_values = features.input_values.to(device)
133
+ attention_mask = features.attention_mask.to(device)
134
+
135
+ with torch.no_grad():
136
+ logits = model(input_values, attention_mask=attention_mask).logits
137
+
138
+ pred_ids = torch.argmax(logits, dim=-1)
139
+
140
+ batch["predicted"] = processor.batch_decode(pred_ids)[0]
141
+ return batch
142
+
143
+
144
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
145
+ processor = Wav2Vec2Processor.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-persian-v2")
146
+ model = Wav2Vec2ForCTC.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-persian-v2").to(device)
147
+
148
+ dataset = load_dataset("common_voice", "fa", split="test[:1%]")
149
+ dataset = dataset.map(
150
+ normalizer,
151
+ fn_kwargs={"chars_to_ignore": chars_to_ignore, "chars_to_mapping": chars_to_mapping},
152
+ remove_columns=list(set(dataset.column_names) - set(['sentence', 'path']))
153
+ )
154
+
155
+ dataset = dataset.map(speech_file_to_array_fn)
156
+ result = dataset.map(predict)
157
+
158
+ max_items = np.random.randint(0, len(result), 20).tolist()
159
+ for i in max_items:
160
+ reference, predicted = result["sentence"][i], result["predicted"][i]
161
+ print("reference:", reference)
162
+ print("predicted:", predicted)
163
+ print('---')
164
+ ```
165
+
166
+ **Output:**
167
+ ```text
168
+ reference: عجم زنده کردم بدین پارسی
169
+ predicted: عجم زنده کردم بدین پارسی
170
+ ---
171
+ reference: لباس هایم کی آماده خواهند شد
172
+ predicted: لباس خایم کی آماده خواهند شد
173
+ ---
174
+ reference: با مهان همنشین شدم
175
+ predicted: با مهان همنشین شدم
176
+ ---
177
+ reference: یکی از بهترین فیلم هایی بود که در این سال ها دیدم
178
+ predicted: یکی از بهترین فیلمهایی بود که در این سالها دیدم
179
+ ---
180
+ reference: اون خیلی بد ماساژ میده
181
+ predicted: اون خیلی بد ماساژ میده
182
+ ---
183
+ reference: هنوزم بزرگترین دستاورد دولت روحانی اینه که رییسی رییسجمهور نشد
184
+ predicted: هنوزم بزرگترین دستآوردار دولت روانیاینه که ریسی ریسیومرو نشد
185
+ ---
186
+ reference: واسه بدنسازی آماده ای
187
+ predicted: واسه بعدنسافی آماده ای
188
+ ---
189
+ reference: خدای من شماها سالمین
190
+ predicted: خدای من شما ها سالمین
191
+ ---
192
+ reference: بهشون ثابت میشه که دروغ نگفتم
193
+ predicted: بهشون ثابت میشه که دروغ مگفتم
194
+ ---
195
+ reference: آیا ممکن است یک پتو برای من بیاورید
196
+ predicted: سف کمیتخ لظا
197
+ ---
198
+ reference: نزدیک جلو
199
+ predicted: رزیک جلو
200
+ ---
201
+ reference: شایعه پراکن دربارهاش دروغ و شایعه می سازد
202
+ predicted: شایه پراکن دربارهاش دروغ و شایعه می سازد
203
+ ---
204
+ reference: وقتی نیاز است که یک چهره دوستانه بیابند
205
+ predicted: وقتی نیاز است یک چهره دوستانه بیابند
206
+ ---
207
+ reference: ممکنه رادیواکتیوی چیزی باشه
208
+ predicted: ممکنه به آدیوتیوی چیزی باشه
209
+ ---
210
+ reference: دهنتون رو ببندید
211
+ predicted: دهن جن رو ببندید
212
+ ---
213
+ reference: پاشیم بریم قند و شکر و روغنمون رو بگیریم تا تموم نشده
214
+ predicted: پاشین بریم قند و شکر و روغنمون رو بگیریم تا تموم نشده
215
+ ---
216
+ reference: اما قبل از تمام کردن بحث تاریخی باید ذکری هم از ناپیکس بکنیم
217
+ predicted: اما قبل از تمام کردن بحث تاریخی باید ذکری هم از نایپکس بکنیم
218
+ ---
219
+ reference: لطفا کپی امضا شده قرارداد را بازگردانید
220
+ predicted: لطفا کپی امضال شده قرار داد را باز گردانید
221
+ ---
222
+ reference: خیلی هم چیز مهمی نیست
223
+ predicted: خیلی هم چیز مهمی نیست
224
+ ---
225
+ reference: شایعه پراکن دربارهاش دروغ و شایعه می سازد
226
+ predicted: شایه پراکن دربارهاش دروغ و شایعه می سازد
227
+ ---
228
+ ```
229
+
230
+ ## Evaluation
231
+
232
+ The model can be evaluated as follows on the Persian (Farsi) test data of Common Voice.
233
+
234
+ ```python
235
+ import librosa
236
+ import torch
237
+ import torchaudio
238
+ from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
239
+ from datasets import load_dataset, load_metric
240
+
241
+ import numpy as np
242
+ import hazm
243
+ import re
244
+ import string
245
+
246
+ _normalizer = hazm.Normalizer()
247
+
248
+ chars_to_ignore = [
249
+ ",", "?", ".", "!", "-", ";", ":", '""', "%", "'", '"', "�",
250
+ "#", "!", "؟", "?", "«", "»", "،", "(", ")", "؛", "'ٔ", "٬",'ٔ', ",", "?",
251
+ ".", "!", "-", ";", ":",'"',"“", "%", "‘", "”", "�", "–", "…", "_", "”", '“', '„',
252
+ 'ā', 'š',
253
+ # "ء",
254
+ ]
255
+
256
+ # In case of farsi
257
+ chars_to_ignore = chars_to_ignore + list(string.ascii_lowercase + string.digits)
258
+
259
+ chars_to_mapping = {
260
+ 'ك': 'ک', 'دِ': 'د', 'بِ': 'ب', 'زِ': 'ز', 'ذِ': 'ذ', 'شِ': 'ش', 'سِ': 'س', 'ى': 'ی',
261
+ 'ي': 'ی', 'أ': 'ا', 'ؤ': 'و', "ے": "ی", "ۀ": "ه", "ﭘ": "پ", "ﮐ": "ک", "ﯽ": "ی",
262
+ "ﺎ": "ا", "ﺑ": "ب", "ﺘ": "ت", "ﺧ": "خ", "ﺩ": "د", "ﺱ": "س", "ﻀ": "ض", "ﻌ": "ع",
263
+ "ﻟ": "ل", "ﻡ": "م", "ﻢ": "م", "ﻪ": "ه", "ﻮ": "و", 'ﺍ': "ا", 'ة': "ه",
264
+ 'ﯾ': "ی", 'ﯿ': "ی", 'ﺒ': "ب", 'ﺖ': "ت", 'ﺪ': "د", 'ﺮ': "ر", 'ﺴ': "س", 'ﺷ': "ش",
265
+ 'ﺸ': "ش", 'ﻋ': "ع", 'ﻤ': "م", 'ﻥ': "ن", 'ﻧ': "ن", 'ﻭ': "و", 'ﺭ': "ر", "ﮔ": "گ",
266
+
267
+ # "ها": " ها", "ئ": "ی",
268
+
269
+ "a": " ای ", "b": " بی ", "c": " سی ", "d": " دی ", "e": " ایی ", "f": " اف ",
270
+ "g": " جی ", "h": " اچ ", "i": " آی ", "j": " جی ", "k": " کی ", "l": " ال ",
271
+ "m": " ام ", "n": " ان ", "o": " او ", "p": " پی ", "q": " کیو ", "r": " آر ",
272
+ "s": " اس ", "t": " تی ", "u": " یو ", "v": " وی ", "w": " دبلیو ", "x": " اکس ",
273
+ "y": " وای ", "z": " زد ",
274
+ "\u200c": " ", "\u200d": " ", "\u200e": " ", "\u200f": " ", "\ufeff": " ",
275
+ }
276
+
277
+ def multiple_replace(text, chars_to_mapping):
278
+ pattern = "|".join(map(re.escape, chars_to_mapping.keys()))
279
+ return re.sub(pattern, lambda m: chars_to_mapping[m.group()], str(text))
280
+
281
+ def remove_special_characters(text, chars_to_ignore_regex):
282
+ text = re.sub(chars_to_ignore_regex, '', text).lower() + " "
283
+ return text
284
+
285
+ def normalizer(batch, chars_to_ignore, chars_to_mapping):
286
+ chars_to_ignore_regex = f"""[{"".join(chars_to_ignore)}]"""
287
+ text = batch["sentence"].lower().strip()
288
+
289
+ text = _normalizer.normalize(text)
290
+ text = multiple_replace(text, chars_to_mapping)
291
+ text = remove_special_characters(text, chars_to_ignore_regex)
292
+ text = re.sub(" +", " ", text)
293
+ text = text.strip() + " "
294
+
295
+ batch["sentence"] = text
296
+ return batch
297
+
298
+
299
+ def speech_file_to_array_fn(batch):
300
+ speech_array, sampling_rate = torchaudio.load(batch["path"])
301
+ speech_array = speech_array.squeeze().numpy()
302
+ speech_array = librosa.resample(np.asarray(speech_array), sampling_rate, 16_000)
303
+
304
+ batch["speech"] = speech_array
305
+ return batch
306
+
307
+
308
+ def predict(batch):
309
+ features = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
310
+
311
+ input_values = features.input_values.to(device)
312
+ attention_mask = features.attention_mask.to(device)
313
+
314
+ with torch.no_grad():
315
+ logits = model(input_values, attention_mask=attention_mask).logits
316
+
317
+ pred_ids = torch.argmax(logits, dim=-1)
318
+
319
+ batch["predicted"] = processor.batch_decode(pred_ids)[0]
320
+ return batch
321
+
322
+
323
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
324
+ processor = Wav2Vec2Processor.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-persian-v2")
325
+ model = Wav2Vec2ForCTC.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-persian-v2").to(device)
326
+
327
+ dataset = load_dataset("common_voice", "fa", split="test")
328
+ dataset = dataset.map(
329
+ normalizer,
330
+ fn_kwargs={"chars_to_ignore": chars_to_ignore, "chars_to_mapping": chars_to_mapping},
331
+ remove_columns=list(set(dataset.column_names) - set(['sentence', 'path']))
332
+ )
333
+ dataset = dataset.map(speech_file_to_array_fn)
334
+ result = dataset.map(predict)
335
+
336
+ wer = load_metric("wer")
337
+ print("WER: {:.2f}".format(100 * wer.compute(predictions=result["predicted"], references=result["sentence"])))
338
+ ```
339
+
340
+ **Test Result:**
341
+ - WER: 31.92%
342
+
343
+
344
+ ## Training
345
+ The Common Voice `train`, `validation` datasets were used for training.
346
+
347
+ You can see the training states [here](https://wandb.ai/m3hrdadfi/finetuned_wav2vec_xlsr_persian/reports/Fine-Tuning-for-Wav2Vec2-Large-XLSR-53-Persian--Vmlldzo1NjY1NjU?accessToken=pspukt0liicopnwe93wo1ipetqk0gzkuv8669g00wc6hcesk1fh0rfkbd0h46unk)
348
+
349
+ The script used for training can be found [here](https://colab.research.google.com/github/m3hrdadfi/notebooks/blob/main/Fine_Tune_XLSR_Wav2Vec2_on_Persian_ASR_with_%F0%9F%A4%97_Transformers_ipynb.ipynb)
all_results.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 30.0,
3
+ "eval_loss": 0.5013265609741211,
4
+ "eval_mem_cpu_alloc_delta": 447967023,
5
+ "eval_mem_cpu_peaked_delta": 40936880,
6
+ "eval_mem_gpu_alloc_delta": 0,
7
+ "eval_mem_gpu_peaked_delta": 6271776768,
8
+ "eval_runtime": 635.3557,
9
+ "eval_samples": 5208,
10
+ "eval_samples_per_second": 8.197,
11
+ "eval_wer": 0.32129213337144935,
12
+ "init_mem_cpu_alloc_delta": 20270917,
13
+ "init_mem_cpu_peaked_delta": 18306,
14
+ "init_mem_gpu_alloc_delta": 1261919232,
15
+ "init_mem_gpu_peaked_delta": 0,
16
+ "total_flos": 4.998078272539758e+19,
17
+ "train_mem_cpu_alloc_delta": 57067470,
18
+ "train_mem_cpu_peaked_delta": 487786762,
19
+ "train_mem_gpu_alloc_delta": 3793118208,
20
+ "train_mem_gpu_peaked_delta": 6813593600,
21
+ "train_runtime": 61300.1017,
22
+ "train_samples": 12730,
23
+ "train_samples_per_second": 0.111
24
+ }
config.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/wav2vec2-large-xlsr-53",
3
+ "activation_dropout": 0.0,
4
+ "apply_spec_augment": true,
5
+ "architectures": [
6
+ "Wav2Vec2ForCTC"
7
+ ],
8
+ "attention_dropout": 0.1,
9
+ "bos_token_id": 1,
10
+ "conv_bias": true,
11
+ "conv_dim": [
12
+ 512,
13
+ 512,
14
+ 512,
15
+ 512,
16
+ 512,
17
+ 512,
18
+ 512
19
+ ],
20
+ "conv_kernel": [
21
+ 10,
22
+ 3,
23
+ 3,
24
+ 3,
25
+ 3,
26
+ 2,
27
+ 2
28
+ ],
29
+ "conv_stride": [
30
+ 5,
31
+ 2,
32
+ 2,
33
+ 2,
34
+ 2,
35
+ 2,
36
+ 2
37
+ ],
38
+ "ctc_loss_reduction": "mean",
39
+ "ctc_zero_infinity": true,
40
+ "do_stable_layer_norm": true,
41
+ "eos_token_id": 2,
42
+ "feat_extract_activation": "gelu",
43
+ "feat_extract_dropout": 0.0,
44
+ "feat_extract_norm": "layer",
45
+ "feat_proj_dropout": 0.0,
46
+ "final_dropout": 0.0,
47
+ "gradient_checkpointing": true,
48
+ "hidden_act": "gelu",
49
+ "hidden_dropout": 0.1,
50
+ "hidden_size": 1024,
51
+ "initializer_range": 0.02,
52
+ "intermediate_size": 4096,
53
+ "layer_norm_eps": 1e-05,
54
+ "layerdrop": 0.1,
55
+ "mask_channel_length": 10,
56
+ "mask_channel_min_space": 1,
57
+ "mask_channel_other": 0.0,
58
+ "mask_channel_prob": 0.0,
59
+ "mask_channel_selection": "static",
60
+ "mask_feature_length": 10,
61
+ "mask_feature_prob": 0.0,
62
+ "mask_time_length": 10,
63
+ "mask_time_min_space": 1,
64
+ "mask_time_other": 0.0,
65
+ "mask_time_prob": 0.05,
66
+ "mask_time_selection": "static",
67
+ "model_type": "wav2vec2",
68
+ "num_attention_heads": 16,
69
+ "num_conv_pos_embedding_groups": 16,
70
+ "num_conv_pos_embeddings": 128,
71
+ "num_feat_extract_layers": 7,
72
+ "num_hidden_layers": 24,
73
+ "pad_token_id": 0,
74
+ "transformers_version": "4.5.0.dev0",
75
+ "vocab_size": 40
76
+ }
eval_results.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 30.0,
3
+ "eval_loss": 0.5013265609741211,
4
+ "eval_mem_cpu_alloc_delta": 447967023,
5
+ "eval_mem_cpu_peaked_delta": 40936880,
6
+ "eval_mem_gpu_alloc_delta": 0,
7
+ "eval_mem_gpu_peaked_delta": 6271776768,
8
+ "eval_runtime": 635.3557,
9
+ "eval_samples": 5208,
10
+ "eval_samples_per_second": 8.197,
11
+ "eval_wer": 0.32129213337144935
12
+ }
predictions.csv ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "feature_size": 1,
4
+ "padding_side": "right",
5
+ "padding_value": 0.0,
6
+ "return_attention_mask": true,
7
+ "sampling_rate": 16000
8
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c06a17254c2d51cc616567a8b7d0add932760e3c193d03c46676ee2441b322f0
3
+ size 1262097815
result.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a47518a2653bffa224b006c91801824b302bac9dd29cda2a1360948b7837aa1d
3
+ size 3183
sample4024.flac ADDED
Binary file (56.3 kB). View file
 
sample4084.flac ADDED
Binary file (112 kB). View file
 
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>"}
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "<unk>", "bos_token": "<s>", "eos_token": "</s>", "pad_token": "<pad>", "do_lower_case": false, "word_delimiter_token": "|"}
train_results.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 30.0,
3
+ "init_mem_cpu_alloc_delta": 20270917,
4
+ "init_mem_cpu_peaked_delta": 18306,
5
+ "init_mem_gpu_alloc_delta": 1261919232,
6
+ "init_mem_gpu_peaked_delta": 0,
7
+ "total_flos": 4.998078272539758e+19,
8
+ "train_mem_cpu_alloc_delta": 57067470,
9
+ "train_mem_cpu_peaked_delta": 487786762,
10
+ "train_mem_gpu_alloc_delta": 3793118208,
11
+ "train_mem_gpu_peaked_delta": 6813593600,
12
+ "train_runtime": 61300.1017,
13
+ "train_samples": 12730,
14
+ "train_samples_per_second": 0.111
15
+ }
trainer_state.json ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 29.997802197802198,
5
+ "global_step": 6810,
6
+ "is_hyper_param_search": false,
7
+ "is_local_process_zero": true,
8
+ "is_world_process_zero": true,
9
+ "log_history": [
10
+ {
11
+ "epoch": 1.32,
12
+ "learning_rate": 0.00017999999999999998,
13
+ "loss": 11.6291,
14
+ "step": 300
15
+ },
16
+ {
17
+ "epoch": 1.32,
18
+ "eval_loss": 3.028644323348999,
19
+ "eval_runtime": 643.9816,
20
+ "eval_samples_per_second": 8.087,
21
+ "eval_wer": 1.0,
22
+ "step": 300
23
+ },
24
+ {
25
+ "epoch": 2.64,
26
+ "learning_rate": 0.0002952456418383518,
27
+ "loss": 3.0796,
28
+ "step": 600
29
+ },
30
+ {
31
+ "epoch": 2.64,
32
+ "eval_loss": 2.9614171981811523,
33
+ "eval_runtime": 650.4972,
34
+ "eval_samples_per_second": 8.006,
35
+ "eval_wer": 1.0,
36
+ "step": 600
37
+ },
38
+ {
39
+ "epoch": 3.96,
40
+ "learning_rate": 0.0002809825673534073,
41
+ "loss": 1.6756,
42
+ "step": 900
43
+ },
44
+ {
45
+ "epoch": 3.96,
46
+ "eval_loss": 0.6643654108047485,
47
+ "eval_runtime": 668.5248,
48
+ "eval_samples_per_second": 7.79,
49
+ "eval_wer": 0.5919852387016294,
50
+ "step": 900
51
+ },
52
+ {
53
+ "epoch": 5.29,
54
+ "learning_rate": 0.00026671949286846274,
55
+ "loss": 0.5169,
56
+ "step": 1200
57
+ },
58
+ {
59
+ "epoch": 5.29,
60
+ "eval_loss": 0.48998841643333435,
61
+ "eval_runtime": 670.8355,
62
+ "eval_samples_per_second": 7.763,
63
+ "eval_wer": 0.4740247927440942,
64
+ "step": 1200
65
+ },
66
+ {
67
+ "epoch": 6.61,
68
+ "learning_rate": 0.0002524564183835182,
69
+ "loss": 0.3643,
70
+ "step": 1500
71
+ },
72
+ {
73
+ "epoch": 6.61,
74
+ "eval_loss": 0.4465296268463135,
75
+ "eval_runtime": 685.664,
76
+ "eval_samples_per_second": 7.596,
77
+ "eval_wer": 0.43660178279061307,
78
+ "step": 1500
79
+ },
80
+ {
81
+ "epoch": 7.93,
82
+ "learning_rate": 0.00023819334389857367,
83
+ "loss": 0.277,
84
+ "step": 1800
85
+ },
86
+ {
87
+ "epoch": 7.93,
88
+ "eval_loss": 0.4225097894668579,
89
+ "eval_runtime": 675.9712,
90
+ "eval_samples_per_second": 7.704,
91
+ "eval_wer": 0.4157592453026326,
92
+ "step": 1800
93
+ },
94
+ {
95
+ "epoch": 9.25,
96
+ "learning_rate": 0.00022393026941362913,
97
+ "loss": 0.2271,
98
+ "step": 2100
99
+ },
100
+ {
101
+ "epoch": 9.25,
102
+ "eval_loss": 0.4406384825706482,
103
+ "eval_runtime": 685.3056,
104
+ "eval_samples_per_second": 7.6,
105
+ "eval_wer": 0.39260375789391616,
106
+ "step": 2100
107
+ },
108
+ {
109
+ "epoch": 10.57,
110
+ "learning_rate": 0.0002096671949286846,
111
+ "loss": 0.1895,
112
+ "step": 2400
113
+ },
114
+ {
115
+ "epoch": 10.57,
116
+ "eval_loss": 0.4478096067905426,
117
+ "eval_runtime": 689.1958,
118
+ "eval_samples_per_second": 7.557,
119
+ "eval_wer": 0.3899529613555446,
120
+ "step": 2400
121
+ },
122
+ {
123
+ "epoch": 11.89,
124
+ "learning_rate": 0.0001954041204437401,
125
+ "loss": 0.1653,
126
+ "step": 2700
127
+ },
128
+ {
129
+ "epoch": 11.89,
130
+ "eval_loss": 0.4374055862426758,
131
+ "eval_runtime": 693.8794,
132
+ "eval_samples_per_second": 7.506,
133
+ "eval_wer": 0.3792977987993451,
134
+ "step": 2700
135
+ },
136
+ {
137
+ "epoch": 13.22,
138
+ "learning_rate": 0.00018114104595879556,
139
+ "loss": 0.1366,
140
+ "step": 3000
141
+ },
142
+ {
143
+ "epoch": 13.22,
144
+ "eval_loss": 0.4575331211090088,
145
+ "eval_runtime": 703.7067,
146
+ "eval_samples_per_second": 7.401,
147
+ "eval_wer": 0.37355440629954,
148
+ "step": 3000
149
+ },
150
+ {
151
+ "epoch": 14.54,
152
+ "learning_rate": 0.000166877971473851,
153
+ "loss": 0.1219,
154
+ "step": 3300
155
+ },
156
+ {
157
+ "epoch": 14.54,
158
+ "eval_loss": 0.4847738444805145,
159
+ "eval_runtime": 705.6195,
160
+ "eval_samples_per_second": 7.381,
161
+ "eval_wer": 0.36983809350554847,
162
+ "step": 3300
163
+ },
164
+ {
165
+ "epoch": 15.86,
166
+ "learning_rate": 0.00015261489698890646,
167
+ "loss": 0.1102,
168
+ "step": 3600
169
+ },
170
+ {
171
+ "epoch": 15.86,
172
+ "eval_loss": 0.4509291350841522,
173
+ "eval_runtime": 713.2815,
174
+ "eval_samples_per_second": 7.301,
175
+ "eval_wer": 0.35738974505574467,
176
+ "step": 3600
177
+ },
178
+ {
179
+ "epoch": 17.18,
180
+ "learning_rate": 0.00013835182250396196,
181
+ "loss": 0.1017,
182
+ "step": 3900
183
+ },
184
+ {
185
+ "epoch": 17.18,
186
+ "eval_loss": 0.45042145252227783,
187
+ "eval_runtime": 714.3616,
188
+ "eval_samples_per_second": 7.29,
189
+ "eval_wer": 0.34715039372125056,
190
+ "step": 3900
191
+ },
192
+ {
193
+ "epoch": 18.5,
194
+ "learning_rate": 0.00012408874801901742,
195
+ "loss": 0.0937,
196
+ "step": 4200
197
+ },
198
+ {
199
+ "epoch": 18.5,
200
+ "eval_loss": 0.4522610008716583,
201
+ "eval_runtime": 719.9965,
202
+ "eval_samples_per_second": 7.233,
203
+ "eval_wer": 0.3469164999090413,
204
+ "step": 4200
205
+ },
206
+ {
207
+ "epoch": 19.82,
208
+ "learning_rate": 0.00010982567353407289,
209
+ "loss": 0.0829,
210
+ "step": 4500
211
+ },
212
+ {
213
+ "epoch": 19.82,
214
+ "eval_loss": 0.4488724172115326,
215
+ "eval_runtime": 720.1162,
216
+ "eval_samples_per_second": 7.232,
217
+ "eval_wer": 0.3452012786195067,
218
+ "step": 4500
219
+ },
220
+ {
221
+ "epoch": 21.15,
222
+ "learning_rate": 9.556259904912835e-05,
223
+ "loss": 0.0752,
224
+ "step": 4800
225
+ },
226
+ {
227
+ "epoch": 21.15,
228
+ "eval_loss": 0.4762090742588043,
229
+ "eval_runtime": 730.1963,
230
+ "eval_samples_per_second": 7.132,
231
+ "eval_wer": 0.33800254684373293,
232
+ "step": 4800
233
+ },
234
+ {
235
+ "epoch": 22.47,
236
+ "learning_rate": 8.129952456418383e-05,
237
+ "loss": 0.0698,
238
+ "step": 5100
239
+ },
240
+ {
241
+ "epoch": 22.47,
242
+ "eval_loss": 0.480989009141922,
243
+ "eval_runtime": 727.7194,
244
+ "eval_samples_per_second": 7.157,
245
+ "eval_wer": 0.33597546713791937,
246
+ "step": 5100
247
+ },
248
+ {
249
+ "epoch": 23.79,
250
+ "learning_rate": 6.70364500792393e-05,
251
+ "loss": 0.0642,
252
+ "step": 5400
253
+ },
254
+ {
255
+ "epoch": 23.79,
256
+ "eval_loss": 0.49236759543418884,
257
+ "eval_runtime": 737.7861,
258
+ "eval_samples_per_second": 7.059,
259
+ "eval_wer": 0.3343382104524546,
260
+ "step": 5400
261
+ },
262
+ {
263
+ "epoch": 25.11,
264
+ "learning_rate": 5.2773375594294765e-05,
265
+ "loss": 0.058,
266
+ "step": 5700
267
+ },
268
+ {
269
+ "epoch": 25.11,
270
+ "eval_loss": 0.4960506558418274,
271
+ "eval_runtime": 740.7836,
272
+ "eval_samples_per_second": 7.03,
273
+ "eval_wer": 0.3302840510408275,
274
+ "step": 5700
275
+ },
276
+ {
277
+ "epoch": 26.43,
278
+ "learning_rate": 3.851030110935023e-05,
279
+ "loss": 0.0553,
280
+ "step": 6000
281
+ },
282
+ {
283
+ "epoch": 26.43,
284
+ "eval_loss": 0.4915299415588379,
285
+ "eval_runtime": 748.2447,
286
+ "eval_samples_per_second": 6.96,
287
+ "eval_wer": 0.32506042256815404,
288
+ "step": 6000
289
+ },
290
+ {
291
+ "epoch": 27.75,
292
+ "learning_rate": 2.4247226624405704e-05,
293
+ "loss": 0.0545,
294
+ "step": 6300
295
+ },
296
+ {
297
+ "epoch": 27.75,
298
+ "eval_loss": 0.5011223554611206,
299
+ "eval_runtime": 762.4791,
300
+ "eval_samples_per_second": 6.83,
301
+ "eval_wer": 0.3210062631565269,
302
+ "step": 6300
303
+ },
304
+ {
305
+ "epoch": 29.07,
306
+ "learning_rate": 9.984152139461172e-06,
307
+ "loss": 0.0523,
308
+ "step": 6600
309
+ },
310
+ {
311
+ "epoch": 29.07,
312
+ "eval_loss": 0.49885958433151245,
313
+ "eval_runtime": 743.9824,
314
+ "eval_samples_per_second": 7.0,
315
+ "eval_wer": 0.3229034018555576,
316
+ "step": 6600
317
+ },
318
+ {
319
+ "epoch": 30.0,
320
+ "step": 6810,
321
+ "total_flos": 4.998078272539758e+19,
322
+ "train_runtime": 61300.1017,
323
+ "train_samples_per_second": 0.111
324
+ }
325
+ ],
326
+ "max_steps": 6810,
327
+ "num_train_epochs": 30,
328
+ "total_flos": 4.998078272539758e+19,
329
+ "trial_name": null,
330
+ "trial_params": null
331
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5dbe2c70e4a0a1ea1b9c9db9b598b453f20cf687a2938fc2858cb547981ea9e0
3
+ size 2351
vocab.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"<pad>": 0, "<s>": 1, "</s>": 2, "<unk>": 3, "|": 4, "ء": 5, "آ": 6, "ئ": 7, "ا": 8, "ب": 9, "ت": 10, "ث": 11, "ج": 12, "ح": 13, "خ": 14, "د": 15, "ذ": 16, "ر": 17, "ز": 18, "س": 19, "ش": 20, "ص": 21, "ض": 22, "ط": 23, "ظ": 24, "ع": 25, "غ": 26, "ف": 27, "ق": 28, "ل": 29, "م": 30, "ن": 31, "ه": 32, "و": 33, "پ": 34, "چ": 35, "ژ": 36, "ک": 37, "گ": 38, "ی": 39}