infinitejoy commited on
Commit
4da9fbb
1 Parent(s): 68ff46b

armenian training script

Browse files
Files changed (1) hide show
  1. armenian_training_script.ipynb +1516 -0
armenian_training_script.ipynb ADDED
@@ -0,0 +1,1516 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# HuggingFace challenge - Debugger notebook\n",
8
+ "Run this notebook to verify your libraries versions, check GPU config and run a quick training"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "code",
13
+ "execution_count": 2,
14
+ "metadata": {
15
+ "id": "T2utsYSKszvv"
16
+ },
17
+ "outputs": [],
18
+ "source": [
19
+ "import platform\n",
20
+ "import multiprocessing\n",
21
+ "\n",
22
+ "import torch\n",
23
+ "import transformers\n",
24
+ "import datasets\n",
25
+ "\n",
26
+ "import soundfile"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "markdown",
31
+ "metadata": {},
32
+ "source": [
33
+ "## Print main infos"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "code",
38
+ "execution_count": 3,
39
+ "metadata": {
40
+ "colab": {
41
+ "base_uri": "https://localhost:8080/"
42
+ },
43
+ "id": "5P6I-W9ts-kR",
44
+ "outputId": "939bd550-1486-46a6-8371-e82ada0f448c"
45
+ },
46
+ "outputs": [
47
+ {
48
+ "name": "stdout",
49
+ "output_type": "stream",
50
+ "text": [
51
+ "Platform: Linux-5.11.0-37-generic-x86_64-with-glibc2.10\n",
52
+ "CPU cores: 60\n",
53
+ "Python version: 3.8.8\n",
54
+ "PyTorch version: 1.10.1+cu102\n",
55
+ "GPU is visible: True\n",
56
+ "Transformers version: 4.16.0.dev0\n",
57
+ "Datasets version: 1.17.1.dev0\n",
58
+ "soundfile version: 0.10.3\n"
59
+ ]
60
+ }
61
+ ],
62
+ "source": [
63
+ "print(f\"Platform: {platform.platform()}\")\n",
64
+ "print(f\"CPU cores: {multiprocessing.cpu_count()}\")\n",
65
+ "\n",
66
+ "print(f\"Python version: {platform.python_version()}\")\n",
67
+ "\n",
68
+ "print(f\"PyTorch version: {torch.__version__}\")\n",
69
+ "print(f\"GPU is visible: {torch.cuda.is_available()}\")\n",
70
+ "\n",
71
+ "print(f\"Transformers version: {transformers.__version__}\")\n",
72
+ "print(f\"Datasets version: {datasets.__version__}\")\n",
73
+ "\n",
74
+ "print(f\"soundfile version: {soundfile.__version__}\")"
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "markdown",
79
+ "metadata": {},
80
+ "source": [
81
+ "## Check your GPU informations (if any)\n",
82
+ "If you launched an AI Training job with GPU resources, they should be listed below (Tesla V100s 32GB).\n",
83
+ "Driver and CUDA version "
84
+ ]
85
+ },
86
+ {
87
+ "cell_type": "code",
88
+ "execution_count": 4,
89
+ "metadata": {
90
+ "colab": {
91
+ "base_uri": "https://localhost:8080/"
92
+ },
93
+ "id": "YT7fRnKctggU",
94
+ "outputId": "f355a3e0-20da-489f-bd1f-5e508e792a68"
95
+ },
96
+ "outputs": [
97
+ {
98
+ "name": "stdout",
99
+ "output_type": "stream",
100
+ "text": [
101
+ "Mon Jan 24 17:23:29 2022 \n",
102
+ "+-----------------------------------------------------------------------------+\n",
103
+ "| NVIDIA-SMI 470.57.02 Driver Version: 470.57.02 CUDA Version: 11.4 |\n",
104
+ "|-------------------------------+----------------------+----------------------+\n",
105
+ "| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
106
+ "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
107
+ "| | | MIG M. |\n",
108
+ "|===============================+======================+======================|\n",
109
+ "| 0 Tesla V100S-PCI... Off | 00000000:00:06.0 Off | 0 |\n",
110
+ "| N/A 36C P0 26W / 250W | 4MiB / 32510MiB | 0% Default |\n",
111
+ "| | | N/A |\n",
112
+ "+-------------------------------+----------------------+----------------------+\n",
113
+ " \n",
114
+ "+-----------------------------------------------------------------------------+\n",
115
+ "| Processes: |\n",
116
+ "| GPU GI CI PID Type Process name GPU Memory |\n",
117
+ "| ID ID Usage |\n",
118
+ "|=============================================================================|\n",
119
+ "| No running processes found |\n",
120
+ "+-----------------------------------------------------------------------------+\n"
121
+ ]
122
+ }
123
+ ],
124
+ "source": [
125
+ "!nvidia-smi"
126
+ ]
127
+ },
128
+ {
129
+ "cell_type": "code",
130
+ "execution_count": 4,
131
+ "metadata": {},
132
+ "outputs": [
133
+ {
134
+ "data": {
135
+ "application/vnd.jupyter.widget-view+json": {
136
+ "model_id": "2fa897b4afc049229144599af9e3f807",
137
+ "version_major": 2,
138
+ "version_minor": 0
139
+ },
140
+ "text/plain": [
141
+ "VBox(children=(HTML(value='<center>\\n<img src=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
142
+ ]
143
+ },
144
+ "metadata": {},
145
+ "output_type": "display_data"
146
+ }
147
+ ],
148
+ "source": [
149
+ "from huggingface_hub import notebook_login\n",
150
+ "\n",
151
+ "notebook_login()"
152
+ ]
153
+ },
154
+ {
155
+ "cell_type": "markdown",
156
+ "metadata": {
157
+ "id": "TorMtpwPv6RQ"
158
+ },
159
+ "source": [
160
+ "## Quick training run with a dummy model and data\n",
161
+ "more information on https://github.com/huggingface/transformers/tree/master/examples/pytorch/speech-recognition"
162
+ ]
163
+ },
164
+ {
165
+ "cell_type": "code",
166
+ "execution_count": 5,
167
+ "metadata": {
168
+ "colab": {
169
+ "base_uri": "https://localhost:8080/"
170
+ },
171
+ "id": "fevoJD15u4Ss",
172
+ "outputId": "5861d34e-745b-45ee-e780-ed363043e655"
173
+ },
174
+ "outputs": [
175
+ {
176
+ "name": "stdout",
177
+ "output_type": "stream",
178
+ "text": [
179
+ "--2022-01-22 15:01:09-- https://raw.githubusercontent.com/huggingface/transformers/master/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py\n",
180
+ "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...\n",
181
+ "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.\n",
182
+ "HTTP request sent, awaiting response... 200 OK\n",
183
+ "Length: 30348 (30K) [text/plain]\n",
184
+ "Saving to: ‘run_speech_recognition_ctc.py’\n",
185
+ "\n",
186
+ "run_speech_recognit 100%[===================>] 29.64K --.-KB/s in 0.001s \n",
187
+ "\n",
188
+ "2022-01-22 15:01:09 (20.1 MB/s) - ‘run_speech_recognition_ctc.py’ saved [30348/30348]\n",
189
+ "\n"
190
+ ]
191
+ }
192
+ ],
193
+ "source": [
194
+ "!wget -O run_speech_recognition_ctc.py https://raw.githubusercontent.com/huggingface/transformers/master/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py"
195
+ ]
196
+ },
197
+ {
198
+ "cell_type": "code",
199
+ "execution_count": null,
200
+ "metadata": {},
201
+ "outputs": [],
202
+ "source": [
203
+ "# \t--learning_rate=\"7.5e-5\" \\\n",
204
+ "# 84.5"
205
+ ]
206
+ },
207
+ {
208
+ "cell_type": "code",
209
+ "execution_count": null,
210
+ "metadata": {
211
+ "colab": {
212
+ "base_uri": "https://localhost:8080/"
213
+ },
214
+ "id": "Mz4bubhxxsad",
215
+ "outputId": "23398525-cc19-43c2-9fec-497e06214f29"
216
+ },
217
+ "outputs": [
218
+ {
219
+ "name": "stdout",
220
+ "output_type": "stream",
221
+ "text": [
222
+ "01/24/2022 17:28:58 - WARNING - __main__ - Process rank: -1, device: cuda:0, n_gpu: 1distributed training: False, 16-bits training: True\n",
223
+ "01/24/2022 17:28:58 - INFO - __main__ - Training/evaluation parameters TrainingArguments(\n",
224
+ "_n_gpu=1,\n",
225
+ "adafactor=False,\n",
226
+ "adam_beta1=0.9,\n",
227
+ "adam_beta2=0.999,\n",
228
+ "adam_epsilon=1e-08,\n",
229
+ "bf16=False,\n",
230
+ "bf16_full_eval=False,\n",
231
+ "dataloader_drop_last=False,\n",
232
+ "dataloader_num_workers=0,\n",
233
+ "dataloader_pin_memory=True,\n",
234
+ "ddp_bucket_cap_mb=None,\n",
235
+ "ddp_find_unused_parameters=None,\n",
236
+ "debug=[],\n",
237
+ "deepspeed=None,\n",
238
+ "disable_tqdm=False,\n",
239
+ "do_eval=True,\n",
240
+ "do_predict=False,\n",
241
+ "do_train=True,\n",
242
+ "eval_accumulation_steps=None,\n",
243
+ "eval_steps=500,\n",
244
+ "evaluation_strategy=IntervalStrategy.STEPS,\n",
245
+ "fp16=True,\n",
246
+ "fp16_backend=auto,\n",
247
+ "fp16_full_eval=False,\n",
248
+ "fp16_opt_level=O1,\n",
249
+ "gradient_accumulation_steps=1,\n",
250
+ "gradient_checkpointing=True,\n",
251
+ "greater_is_better=None,\n",
252
+ "group_by_length=True,\n",
253
+ "half_precision_backend=auto,\n",
254
+ "hub_model_id=None,\n",
255
+ "hub_strategy=HubStrategy.EVERY_SAVE,\n",
256
+ "hub_token=<HUB_TOKEN>,\n",
257
+ "ignore_data_skip=False,\n",
258
+ "label_names=None,\n",
259
+ "label_smoothing_factor=0.0,\n",
260
+ "learning_rate=0.0003,\n",
261
+ "length_column_name=input_length,\n",
262
+ "load_best_model_at_end=False,\n",
263
+ "local_rank=-1,\n",
264
+ "log_level=-1,\n",
265
+ "log_level_replica=-1,\n",
266
+ "log_on_each_node=True,\n",
267
+ "logging_dir=./wav2vec2-large-xls-r-300m-armenian/runs/Jan24_17-28-58_job-8be8b741-e32e-4579-bbec-1e00d9824b4f,\n",
268
+ "logging_first_step=False,\n",
269
+ "logging_nan_inf_filter=True,\n",
270
+ "logging_steps=100,\n",
271
+ "logging_strategy=IntervalStrategy.STEPS,\n",
272
+ "lr_scheduler_type=SchedulerType.LINEAR,\n",
273
+ "max_grad_norm=1.0,\n",
274
+ "max_steps=-1,\n",
275
+ "metric_for_best_model=None,\n",
276
+ "mp_parameters=,\n",
277
+ "no_cuda=False,\n",
278
+ "num_train_epochs=200.0,\n",
279
+ "optim=OptimizerNames.ADAMW_HF,\n",
280
+ "output_dir=./wav2vec2-large-xls-r-300m-armenian,\n",
281
+ "overwrite_output_dir=True,\n",
282
+ "past_index=-1,\n",
283
+ "per_device_eval_batch_size=32,\n",
284
+ "per_device_train_batch_size=32,\n",
285
+ "prediction_loss_only=False,\n",
286
+ "push_to_hub=True,\n",
287
+ "push_to_hub_model_id=None,\n",
288
+ "push_to_hub_organization=None,\n",
289
+ "push_to_hub_token=<PUSH_TO_HUB_TOKEN>,\n",
290
+ "remove_unused_columns=True,\n",
291
+ "report_to=[],\n",
292
+ "resume_from_checkpoint=None,\n",
293
+ "run_name=./wav2vec2-large-xls-r-300m-armenian,\n",
294
+ "save_on_each_node=False,\n",
295
+ "save_steps=500,\n",
296
+ "save_strategy=IntervalStrategy.STEPS,\n",
297
+ "save_total_limit=2,\n",
298
+ "seed=42,\n",
299
+ "sharded_ddp=[],\n",
300
+ "skip_memory_metrics=True,\n",
301
+ "tf32=None,\n",
302
+ "tpu_metrics_debug=False,\n",
303
+ "tpu_num_cores=None,\n",
304
+ "use_legacy_prediction_loop=False,\n",
305
+ "warmup_ratio=0.0,\n",
306
+ "warmup_steps=500,\n",
307
+ "weight_decay=0.0,\n",
308
+ "xpu_backend=None,\n",
309
+ ")\n",
310
+ "01/24/2022 17:29:00 - WARNING - datasets.builder - Reusing dataset common_voice (/workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/hy-AM/7.0.0/33e08856cfa0d0665e837bcad73ffd920a0bc713ce8c5fffb55dbdf1c084d5ba)\n",
311
+ "01/24/2022 17:29:03 - WARNING - datasets.builder - Reusing dataset common_voice (/workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/hy-AM/7.0.0/33e08856cfa0d0665e837bcad73ffd920a0bc713ce8c5fffb55dbdf1c084d5ba)\n",
312
+ "remove special characters from datasets: 100%|█| 554/554 [00:00<00:00, 5471.47ex\n",
313
+ "remove special characters from datasets: 100%|█| 212/212 [00:00<00:00, 7143.49ex\n",
314
+ "loading configuration file https://huggingface.co/facebook/wav2vec2-xls-r-300m/resolve/main/config.json from cache at /workspace/.cache/huggingface/transformers/dabc27df63e37bd2a7a221c7774e35f36a280fbdf917cf54cadfc7df8c786f6f.a3e4c3c967d9985881e0ae550a5f6f668f897db5ab2e0802f9b97973b15970e6\n",
315
+ "Model config Wav2Vec2Config {\n",
316
+ " \"_name_or_path\": \"facebook/wav2vec2-xls-r-300m\",\n",
317
+ " \"activation_dropout\": 0.0,\n",
318
+ " \"adapter_kernel_size\": 3,\n",
319
+ " \"adapter_stride\": 2,\n",
320
+ " \"add_adapter\": false,\n",
321
+ " \"apply_spec_augment\": true,\n",
322
+ " \"architectures\": [\n",
323
+ " \"Wav2Vec2ForPreTraining\"\n",
324
+ " ],\n",
325
+ " \"attention_dropout\": 0.1,\n",
326
+ " \"bos_token_id\": 1,\n",
327
+ " \"classifier_proj_size\": 256,\n",
328
+ " \"codevector_dim\": 768,\n",
329
+ " \"contrastive_logits_temperature\": 0.1,\n",
330
+ " \"conv_bias\": true,\n",
331
+ " \"conv_dim\": [\n",
332
+ " 512,\n",
333
+ " 512,\n",
334
+ " 512,\n",
335
+ " 512,\n",
336
+ " 512,\n",
337
+ " 512,\n",
338
+ " 512\n",
339
+ " ],\n",
340
+ " \"conv_kernel\": [\n",
341
+ " 10,\n",
342
+ " 3,\n",
343
+ " 3,\n",
344
+ " 3,\n",
345
+ " 3,\n",
346
+ " 2,\n",
347
+ " 2\n",
348
+ " ],\n",
349
+ " \"conv_stride\": [\n",
350
+ " 5,\n",
351
+ " 2,\n",
352
+ " 2,\n",
353
+ " 2,\n",
354
+ " 2,\n",
355
+ " 2,\n",
356
+ " 2\n",
357
+ " ],\n",
358
+ " \"ctc_loss_reduction\": \"sum\",\n",
359
+ " \"ctc_zero_infinity\": false,\n",
360
+ " \"diversity_loss_weight\": 0.1,\n",
361
+ " \"do_stable_layer_norm\": true,\n",
362
+ " \"eos_token_id\": 2,\n",
363
+ " \"feat_extract_activation\": \"gelu\",\n",
364
+ " \"feat_extract_dropout\": 0.0,\n",
365
+ " \"feat_extract_norm\": \"layer\",\n",
366
+ " \"feat_proj_dropout\": 0.1,\n",
367
+ " \"feat_quantizer_dropout\": 0.0,\n",
368
+ " \"final_dropout\": 0.0,\n",
369
+ " \"gradient_checkpointing\": false,\n",
370
+ " \"hidden_act\": \"gelu\",\n",
371
+ " \"hidden_dropout\": 0.1,\n",
372
+ " \"hidden_size\": 1024,\n",
373
+ " \"initializer_range\": 0.02,\n",
374
+ " \"intermediate_size\": 4096,\n",
375
+ " \"layer_norm_eps\": 1e-05,\n",
376
+ " \"layerdrop\": 0.1,\n",
377
+ " \"mask_feature_length\": 10,\n",
378
+ " \"mask_feature_min_masks\": 0,\n",
379
+ " \"mask_feature_prob\": 0.0,\n",
380
+ " \"mask_time_length\": 10,\n",
381
+ " \"mask_time_min_masks\": 2,\n",
382
+ " \"mask_time_prob\": 0.075,\n",
383
+ " \"model_type\": \"wav2vec2\",\n",
384
+ " \"num_adapter_layers\": 3,\n",
385
+ " \"num_attention_heads\": 16,\n",
386
+ " \"num_codevector_groups\": 2,\n",
387
+ " \"num_codevectors_per_group\": 320,\n",
388
+ " \"num_conv_pos_embedding_groups\": 16,\n",
389
+ " \"num_conv_pos_embeddings\": 128,\n",
390
+ " \"num_feat_extract_layers\": 7,\n",
391
+ " \"num_hidden_layers\": 24,\n",
392
+ " \"num_negatives\": 100,\n",
393
+ " \"output_hidden_size\": 1024,\n",
394
+ " \"pad_token_id\": 0,\n",
395
+ " \"proj_codevector_dim\": 768,\n",
396
+ " \"tdnn_dilation\": [\n",
397
+ " 1,\n",
398
+ " 2,\n",
399
+ " 3,\n",
400
+ " 1,\n",
401
+ " 1\n",
402
+ " ],\n",
403
+ " \"tdnn_dim\": [\n",
404
+ " 512,\n",
405
+ " 512,\n",
406
+ " 512,\n",
407
+ " 512,\n",
408
+ " 1500\n",
409
+ " ],\n",
410
+ " \"tdnn_kernel\": [\n",
411
+ " 5,\n",
412
+ " 3,\n",
413
+ " 3,\n",
414
+ " 1,\n",
415
+ " 1\n",
416
+ " ],\n",
417
+ " \"torch_dtype\": \"float32\",\n",
418
+ " \"transformers_version\": \"4.16.0.dev0\",\n",
419
+ " \"use_weighted_layer_sum\": false,\n",
420
+ " \"vocab_size\": 32,\n",
421
+ " \"xvector_output_dim\": 512\n",
422
+ "}\n",
423
+ "\n",
424
+ "100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 42.75ba/s]\n",
425
+ "100%|████████████████████████████████████████████| 1/1 [00:00<00:00, 137.47ba/s]\n",
426
+ "Didn't find file ./wav2vec2-large-xls-r-300m-armenian/tokenizer_config.json. We won't load it.\n",
427
+ "Didn't find file ./wav2vec2-large-xls-r-300m-armenian/added_tokens.json. We won't load it.\n",
428
+ "Didn't find file ./wav2vec2-large-xls-r-300m-armenian/special_tokens_map.json. We won't load it.\n",
429
+ "Didn't find file ./wav2vec2-large-xls-r-300m-armenian/tokenizer.json. We won't load it.\n",
430
+ "loading file ./wav2vec2-large-xls-r-300m-armenian/vocab.json\n",
431
+ "loading file None\n",
432
+ "loading file None\n",
433
+ "loading file None\n",
434
+ "loading file None\n",
435
+ "file ./wav2vec2-large-xls-r-300m-armenian/config.json not found\n",
436
+ "Adding <s> to the vocabulary\n",
437
+ "Adding </s> to the vocabulary\n",
438
+ "Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n",
439
+ "loading configuration file https://huggingface.co/facebook/wav2vec2-xls-r-300m/resolve/main/config.json from cache at /workspace/.cache/huggingface/transformers/dabc27df63e37bd2a7a221c7774e35f36a280fbdf917cf54cadfc7df8c786f6f.a3e4c3c967d9985881e0ae550a5f6f668f897db5ab2e0802f9b97973b15970e6\n",
440
+ "Model config Wav2Vec2Config {\n",
441
+ " \"_name_or_path\": \"facebook/wav2vec2-xls-r-300m\",\n",
442
+ " \"activation_dropout\": 0.0,\n",
443
+ " \"adapter_kernel_size\": 3,\n",
444
+ " \"adapter_stride\": 2,\n",
445
+ " \"add_adapter\": false,\n",
446
+ " \"apply_spec_augment\": true,\n",
447
+ " \"architectures\": [\n",
448
+ " \"Wav2Vec2ForPreTraining\"\n",
449
+ " ],\n",
450
+ " \"attention_dropout\": 0.1,\n",
451
+ " \"bos_token_id\": 1,\n",
452
+ " \"classifier_proj_size\": 256,\n",
453
+ " \"codevector_dim\": 768,\n",
454
+ " \"contrastive_logits_temperature\": 0.1,\n",
455
+ " \"conv_bias\": true,\n",
456
+ " \"conv_dim\": [\n",
457
+ " 512,\n",
458
+ " 512,\n",
459
+ " 512,\n",
460
+ " 512,\n",
461
+ " 512,\n",
462
+ " 512,\n",
463
+ " 512\n",
464
+ " ],\n",
465
+ " \"conv_kernel\": [\n",
466
+ " 10,\n",
467
+ " 3,\n",
468
+ " 3,\n",
469
+ " 3,\n",
470
+ " 3,\n",
471
+ " 2,\n",
472
+ " 2\n",
473
+ " ],\n",
474
+ " \"conv_stride\": [\n",
475
+ " 5,\n",
476
+ " 2,\n",
477
+ " 2,\n",
478
+ " 2,\n",
479
+ " 2,\n",
480
+ " 2,\n",
481
+ " 2\n",
482
+ " ],\n",
483
+ " \"ctc_loss_reduction\": \"sum\",\n",
484
+ " \"ctc_zero_infinity\": false,\n",
485
+ " \"diversity_loss_weight\": 0.1,\n",
486
+ " \"do_stable_layer_norm\": true,\n",
487
+ " \"eos_token_id\": 2,\n",
488
+ " \"feat_extract_activation\": \"gelu\",\n",
489
+ " \"feat_extract_dropout\": 0.0,\n",
490
+ " \"feat_extract_norm\": \"layer\",\n",
491
+ " \"feat_proj_dropout\": 0.1,\n",
492
+ " \"feat_quantizer_dropout\": 0.0,\n",
493
+ " \"final_dropout\": 0.0,\n",
494
+ " \"gradient_checkpointing\": false,\n",
495
+ " \"hidden_act\": \"gelu\",\n",
496
+ " \"hidden_dropout\": 0.1,\n",
497
+ " \"hidden_size\": 1024,\n",
498
+ " \"initializer_range\": 0.02,\n",
499
+ " \"intermediate_size\": 4096,\n",
500
+ " \"layer_norm_eps\": 1e-05,\n",
501
+ " \"layerdrop\": 0.1,\n",
502
+ " \"mask_feature_length\": 10,\n",
503
+ " \"mask_feature_min_masks\": 0,\n",
504
+ " \"mask_feature_prob\": 0.0,\n",
505
+ " \"mask_time_length\": 10,\n",
506
+ " \"mask_time_min_masks\": 2,\n",
507
+ " \"mask_time_prob\": 0.075,\n",
508
+ " \"model_type\": \"wav2vec2\",\n",
509
+ " \"num_adapter_layers\": 3,\n",
510
+ " \"num_attention_heads\": 16,\n",
511
+ " \"num_codevector_groups\": 2,\n",
512
+ " \"num_codevectors_per_group\": 320,\n",
513
+ " \"num_conv_pos_embedding_groups\": 16,\n",
514
+ " \"num_conv_pos_embeddings\": 128,\n",
515
+ " \"num_feat_extract_layers\": 7,\n",
516
+ " \"num_hidden_layers\": 24,\n",
517
+ " \"num_negatives\": 100,\n",
518
+ " \"output_hidden_size\": 1024,\n",
519
+ " \"pad_token_id\": 0,\n",
520
+ " \"proj_codevector_dim\": 768,\n",
521
+ " \"tdnn_dilation\": [\n",
522
+ " 1,\n",
523
+ " 2,\n",
524
+ " 3,\n",
525
+ " 1,\n",
526
+ " 1\n",
527
+ " ],\n",
528
+ " \"tdnn_dim\": [\n",
529
+ " 512,\n",
530
+ " 512,\n",
531
+ " 512,\n",
532
+ " 512,\n",
533
+ " 1500\n",
534
+ " ],\n",
535
+ " \"tdnn_kernel\": [\n",
536
+ " 5,\n",
537
+ " 3,\n",
538
+ " 3,\n",
539
+ " 1,\n",
540
+ " 1\n",
541
+ " ],\n",
542
+ " \"torch_dtype\": \"float32\",\n",
543
+ " \"transformers_version\": \"4.16.0.dev0\",\n",
544
+ " \"use_weighted_layer_sum\": false,\n",
545
+ " \"vocab_size\": 32,\n",
546
+ " \"xvector_output_dim\": 512\n",
547
+ "}\n",
548
+ "\n",
549
+ "loading feature extractor configuration file https://huggingface.co/facebook/wav2vec2-xls-r-300m/resolve/main/preprocessor_config.json from cache at /workspace/.cache/huggingface/transformers/6fb028b95b394059e7d3b367bbca2382b576c66aebe896f04d2cd34e1b575f5b.d4484dc1c81456a2461485e7168b04347a7b9a4e3b1ef3aba723323b33e12326\n",
550
+ "Feature extractor Wav2Vec2FeatureExtractor {\n",
551
+ " \"do_normalize\": true,\n",
552
+ " \"feature_extractor_type\": \"Wav2Vec2FeatureExtractor\",\n",
553
+ " \"feature_size\": 1,\n",
554
+ " \"padding_side\": \"right\",\n",
555
+ " \"padding_value\": 0,\n",
556
+ " \"return_attention_mask\": true,\n",
557
+ " \"sampling_rate\": 16000\n",
558
+ "}\n",
559
+ "\n",
560
+ "loading weights file https://huggingface.co/facebook/wav2vec2-xls-r-300m/resolve/main/pytorch_model.bin from cache at /workspace/.cache/huggingface/transformers/1e6a6507f3b689035cd4b247e2a37c154e27f39143f31357a49b4e38baeccc36.1edb32803799e27ed554eb7dd935f6745b1a0b17b0ea256442fe24db6eb546cd\n",
561
+ "Some weights of the model checkpoint at facebook/wav2vec2-xls-r-300m were not used when initializing Wav2Vec2ForCTC: ['project_q.bias', 'project_hid.bias', 'quantizer.weight_proj.bias', 'quantizer.codevectors', 'project_hid.weight', 'project_q.weight', 'quantizer.weight_proj.weight']\n",
562
+ "- This IS expected if you are initializing Wav2Vec2ForCTC from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
563
+ "- This IS NOT expected if you are initializing Wav2Vec2ForCTC from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
564
+ "Some weights of Wav2Vec2ForCTC were not initialized from the model checkpoint at facebook/wav2vec2-xls-r-300m and are newly initialized: ['lm_head.bias', 'lm_head.weight']\n",
565
+ "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n",
566
+ "preprocess datasets: 100%|███████████████████| 554/554 [00:05<00:00, 107.32ex/s]\n",
567
+ "preprocess datasets: 100%|███████████████████| 212/212 [00:01<00:00, 118.26ex/s]\n",
568
+ "100%|████████████████████████████████████████████| 1/1 [00:00<00:00, 690.08ba/s]\n",
569
+ "100%|███████████████████████████████████████████| 1/1 [00:00<00:00, 1093.41ba/s]\n",
570
+ "Configuration saved in ./wav2vec2-large-xls-r-300m-armenian/preprocessor_config.json\n",
571
+ "tokenizer config file saved in ./wav2vec2-large-xls-r-300m-armenian/tokenizer_config.json\n",
572
+ "Special tokens file saved in ./wav2vec2-large-xls-r-300m-armenian/special_tokens_map.json\n",
573
+ "added tokens file saved in ./wav2vec2-large-xls-r-300m-armenian/added_tokens.json\n",
574
+ "Configuration saved in ./wav2vec2-large-xls-r-300m-armenian/config.json\n",
575
+ "loading feature extractor configuration file ./wav2vec2-large-xls-r-300m-armenian/preprocessor_config.json\n",
576
+ "loading configuration file ./wav2vec2-large-xls-r-300m-armenian/config.json\n",
577
+ "Model config Wav2Vec2Config {\n",
578
+ " \"_name_or_path\": \"./wav2vec2-large-xls-r-300m-armenian\",\n",
579
+ " \"activation_dropout\": 0.1,\n",
580
+ " \"adapter_kernel_size\": 3,\n",
581
+ " \"adapter_stride\": 2,\n",
582
+ " \"add_adapter\": false,\n",
583
+ " \"apply_spec_augment\": true,\n",
584
+ " \"architectures\": [\n",
585
+ " \"Wav2Vec2ForPreTraining\"\n",
586
+ " ],\n",
587
+ " \"attention_dropout\": 0.0,\n",
588
+ " \"bos_token_id\": 1,\n",
589
+ " \"classifier_proj_size\": 256,\n",
590
+ " \"codevector_dim\": 768,\n",
591
+ " \"contrastive_logits_temperature\": 0.1,\n",
592
+ " \"conv_bias\": true,\n",
593
+ " \"conv_dim\": [\n",
594
+ " 512,\n",
595
+ " 512,\n",
596
+ " 512,\n",
597
+ " 512,\n",
598
+ " 512,\n",
599
+ " 512,\n",
600
+ " 512\n",
601
+ " ],\n",
602
+ " \"conv_kernel\": [\n",
603
+ " 10,\n",
604
+ " 3,\n",
605
+ " 3,\n",
606
+ " 3,\n",
607
+ " 3,\n",
608
+ " 2,\n",
609
+ " 2\n",
610
+ " ],\n",
611
+ " \"conv_stride\": [\n",
612
+ " 5,\n",
613
+ " 2,\n",
614
+ " 2,\n",
615
+ " 2,\n",
616
+ " 2,\n",
617
+ " 2,\n",
618
+ " 2\n",
619
+ " ],\n",
620
+ " \"ctc_loss_reduction\": \"mean\",\n",
621
+ " \"ctc_zero_infinity\": false,\n",
622
+ " \"diversity_loss_weight\": 0.1,\n",
623
+ " \"do_stable_layer_norm\": true,\n",
624
+ " \"eos_token_id\": 2,\n",
625
+ " \"feat_extract_activation\": \"gelu\",\n",
626
+ " \"feat_extract_dropout\": 0.0,\n",
627
+ " \"feat_extract_norm\": \"layer\",\n",
628
+ " \"feat_proj_dropout\": 0.0,\n",
629
+ " \"feat_quantizer_dropout\": 0.0,\n",
630
+ " \"final_dropout\": 0.0,\n",
631
+ " \"hidden_act\": \"gelu\",\n",
632
+ " \"hidden_dropout\": 0.0,\n",
633
+ " \"hidden_size\": 1024,\n",
634
+ " \"initializer_range\": 0.02,\n",
635
+ " \"intermediate_size\": 4096,\n",
636
+ " \"layer_norm_eps\": 1e-05,\n",
637
+ " \"layerdrop\": 0.0,\n",
638
+ " \"mask_feature_length\": 64,\n",
639
+ " \"mask_feature_min_masks\": 0,\n",
640
+ " \"mask_feature_prob\": 0.25,\n",
641
+ " \"mask_time_length\": 10,\n",
642
+ " \"mask_time_min_masks\": 2,\n",
643
+ " \"mask_time_prob\": 0.75,\n",
644
+ " \"model_type\": \"wav2vec2\",\n",
645
+ " \"num_adapter_layers\": 3,\n",
646
+ " \"num_attention_heads\": 16,\n",
647
+ " \"num_codevector_groups\": 2,\n",
648
+ " \"num_codevectors_per_group\": 320,\n",
649
+ " \"num_conv_pos_embedding_groups\": 16,\n",
650
+ " \"num_conv_pos_embeddings\": 128,\n",
651
+ " \"num_feat_extract_layers\": 7,\n",
652
+ " \"num_hidden_layers\": 24,\n",
653
+ " \"num_negatives\": 100,\n",
654
+ " \"output_hidden_size\": 1024,\n",
655
+ " \"pad_token_id\": 47,\n",
656
+ " \"proj_codevector_dim\": 768,\n",
657
+ " \"tdnn_dilation\": [\n",
658
+ " 1,\n",
659
+ " 2,\n",
660
+ " 3,\n",
661
+ " 1,\n",
662
+ " 1\n",
663
+ " ],\n",
664
+ " \"tdnn_dim\": [\n",
665
+ " 512,\n",
666
+ " 512,\n",
667
+ " 512,\n",
668
+ " 512,\n",
669
+ " 1500\n",
670
+ " ],\n",
671
+ " \"tdnn_kernel\": [\n",
672
+ " 5,\n",
673
+ " 3,\n",
674
+ " 3,\n",
675
+ " 1,\n",
676
+ " 1\n",
677
+ " ],\n",
678
+ " \"torch_dtype\": \"float32\",\n",
679
+ " \"transformers_version\": \"4.16.0.dev0\",\n",
680
+ " \"use_weighted_layer_sum\": false,\n",
681
+ " \"vocab_size\": 50,\n",
682
+ " \"xvector_output_dim\": 512\n",
683
+ "}\n",
684
+ "\n",
685
+ "loading feature extractor configuration file ./wav2vec2-large-xls-r-300m-armenian/preprocessor_config.json\n",
686
+ "Feature extractor Wav2Vec2FeatureExtractor {\n",
687
+ " \"do_normalize\": true,\n",
688
+ " \"feature_extractor_type\": \"Wav2Vec2FeatureExtractor\",\n",
689
+ " \"feature_size\": 1,\n",
690
+ " \"padding_side\": \"right\",\n",
691
+ " \"padding_value\": 0,\n",
692
+ " \"return_attention_mask\": true,\n",
693
+ " \"sampling_rate\": 16000\n",
694
+ "}\n",
695
+ "\n",
696
+ "Didn't find file ./wav2vec2-large-xls-r-300m-armenian/tokenizer.json. We won't load it.\n",
697
+ "loading file ./wav2vec2-large-xls-r-300m-armenian/vocab.json\n",
698
+ "loading file ./wav2vec2-large-xls-r-300m-armenian/tokenizer_config.json\n",
699
+ "loading file ./wav2vec2-large-xls-r-300m-armenian/added_tokens.json\n",
700
+ "loading file ./wav2vec2-large-xls-r-300m-armenian/special_tokens_map.json\n",
701
+ "loading file None\n",
702
+ "Adding <s> to the vocabulary\n",
703
+ "Adding </s> to the vocabulary\n",
704
+ "Cloning https://huggingface.co/infinitejoy/wav2vec2-large-xls-r-300m-armenian into local empty directory.\n",
705
+ "01/24/2022 17:29:28 - WARNING - huggingface_hub.repository - Cloning https://huggingface.co/infinitejoy/wav2vec2-large-xls-r-300m-armenian into local empty directory.\n",
706
+ "Using amp half precision backend\n",
707
+ "The following columns in the training set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
708
+ "/opt/conda/lib/python3.8/site-packages/transformers/optimization.py:306: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use thePyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning\n",
709
+ " warnings.warn(\n",
710
+ "***** Running training *****\n",
711
+ " Num examples = 554\n",
712
+ " Num Epochs = 200\n",
713
+ " Instantaneous batch size per device = 32\n",
714
+ " Total train batch size (w. parallel, distributed & accumulation) = 32\n",
715
+ " Gradient Accumulation steps = 1\n",
716
+ " Total optimization steps = 3600\n",
717
+ "{'loss': 9.8118, 'learning_rate': 5.82e-05, 'epoch': 5.56} \n",
718
+ "{'loss': 3.4789, 'learning_rate': 0.0001182, 'epoch': 11.11} \n",
719
+ "{'loss': 3.114, 'learning_rate': 0.00017819999999999997, 'epoch': 16.67} \n",
720
+ "{'loss': 2.721, 'learning_rate': 0.0002382, 'epoch': 22.22} \n",
721
+ "{'loss': 1.7294, 'learning_rate': 0.0002982, 'epoch': 27.78} \n",
722
+ " 14%|█████▎ | 500/3600 [19:09<2:08:46, 2.49s/it]The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
723
+ "***** Running Evaluation *****\n",
724
+ " Num examples = 212\n",
725
+ " Batch size = 32\n",
726
+ "\n",
727
+ " 0%| | 0/7 [00:00<?, ?it/s]\u001b[A\n",
728
+ " 29%|████████████▊ | 2/7 [00:01<00:04, 1.15it/s]\u001b[A\n",
729
+ " 43%|███████████████████▎ | 3/7 [00:03<00:04, 1.08s/it]\u001b[A\n",
730
+ " 57%|█████████████████████████▋ | 4/7 [00:04<00:03, 1.25s/it]\u001b[A\n",
731
+ " 71%|████████████████████████████████▏ | 5/7 [00:06<00:02, 1.41s/it]\u001b[A\n",
732
+ " 86%|██████████████████████████████████████▌ | 6/7 [00:08<00:01, 1.54s/it]\u001b[A\n",
733
+ " \u001b[A\n",
734
+ "\u001b[A{'eval_loss': 0.8540233373641968, 'eval_wer': 0.9943609022556391, 'eval_runtime': 10.9769, 'eval_samples_per_second': 19.313, 'eval_steps_per_second': 0.638, 'epoch': 27.78}\n",
735
+ " 14%|█████▎ | 500/3600 [19:20<2:08:46, 2.49s/it]\n",
736
+ "100%|█████████████████████████████████████████████| 7/7 [00:09<00:00, 1.36s/it]\u001b[A\n",
737
+ " \u001b[ASaving model checkpoint to ./wav2vec2-large-xls-r-300m-armenian/checkpoint-500\n",
738
+ "Configuration saved in ./wav2vec2-large-xls-r-300m-armenian/checkpoint-500/config.json\n",
739
+ "Model weights saved in ./wav2vec2-large-xls-r-300m-armenian/checkpoint-500/pytorch_model.bin\n",
740
+ "Configuration saved in ./wav2vec2-large-xls-r-300m-armenian/checkpoint-500/preprocessor_config.json\n",
741
+ "Configuration saved in ./wav2vec2-large-xls-r-300m-armenian/preprocessor_config.json\n",
742
+ "{'loss': 1.351, 'learning_rate': 0.0002906129032258064, 'epoch': 33.33} \n",
743
+ " 17%|██████▌ | 624/3600 [24:31<1:48:11, 2.18s/it]"
744
+ ]
745
+ }
746
+ ],
747
+ "source": [
748
+ "!python run_speech_recognition_ctc.py \\\n",
749
+ "\t--dataset_name=\"mozilla-foundation/common_voice_7_0\" \\\n",
750
+ "\t--model_name_or_path=\"facebook/wav2vec2-xls-r-300m\" \\\n",
751
+ "\t--dataset_config_name=\"hy-AM\" \\\n",
752
+ "\t--output_dir=\"./wav2vec2-large-xls-r-300m-armenian\" \\\n",
753
+ "\t--overwrite_output_dir \\\n",
754
+ "\t--num_train_epochs=\"200\" \\\n",
755
+ "\t--per_device_train_batch_size=\"32\" \\\n",
756
+ "\t--per_device_eval_batch_size=\"32\" \\\n",
757
+ "\t--gradient_accumulation_steps=\"1\" \\\n",
758
+ "\t--learning_rate=\"3e-4\" \\\n",
759
+ "\t--warmup_steps=\"500\" \\\n",
760
+ "\t--length_column_name=\"input_length\" \\\n",
761
+ "\t--evaluation_strategy=\"steps\" \\\n",
762
+ "\t--text_column_name=\"sentence\" \\\n",
763
+ "\t--chars_to_ignore , ? . ! \\- \\; \\: \\\" “ % ‘ ” � \\' \\’ \\– \\\n",
764
+ "\t--save_steps=\"500\" \\\n",
765
+ "\t--eval_steps=\"500\" \\\n",
766
+ "\t--logging_steps=\"100\" \\\n",
767
+ "\t--layerdrop=\"0.0\" \\\n",
768
+ "\t--activation_dropout=\"0.1\" \\\n",
769
+ "\t--save_total_limit=\"2\" \\\n",
770
+ "\t--freeze_feature_encoder \\\n",
771
+ "\t--feat_proj_dropout=\"0.0\" \\\n",
772
+ "\t--mask_time_prob=\"0.75\" \\\n",
773
+ "\t--mask_time_length=\"10\" \\\n",
774
+ "\t--mask_feature_prob=\"0.25\" \\\n",
775
+ "\t--mask_feature_length=\"64\" \\\n",
776
+ "\t--gradient_checkpointing \\\n",
777
+ "\t--use_auth_token \\\n",
778
+ "\t--fp16 \\\n",
779
+ "\t--group_by_length \\\n",
780
+ "\t--do_train --do_eval \\\n",
781
+ " --push_to_hub"
782
+ ]
783
+ },
784
+ {
785
+ "cell_type": "code",
786
+ "execution_count": null,
787
+ "metadata": {},
788
+ "outputs": [],
789
+ "source": [
790
+ "!ls -ltr"
791
+ ]
792
+ },
793
+ {
794
+ "cell_type": "code",
795
+ "execution_count": null,
796
+ "metadata": {},
797
+ "outputs": [],
798
+ "source": [
799
+ "import pandas as pd\n",
800
+ "\n",
801
+ "df = pd.DataFrame([\n",
802
+ " {'eval_loss': 1.4175914525985718, 'eval_wer': 0.8282476024411508, 'eval_runtime': 5.6701, 'eval_samples_per_second': 25.044, 'eval_steps_per_second': 0.882, 'epoch': 41.67},\n",
803
+ " {'eval_loss': 1.791098952293396, 'eval_wer': 0.7733217088055798, 'eval_runtime': 5.4161, 'eval_samples_per_second': 26.218, 'eval_steps_per_second': 0.923, 'epoch': 125.0},\n",
804
+ " {'eval_loss': 1.761537790298462, 'eval_wer': 0.8169136878814298, 'eval_runtime': 5.7426, 'eval_samples_per_second': 24.728, 'eval_steps_per_second': 0.871, 'epoch': 166.67},\n",
805
+ " {'eval_loss': 1.9240303039550781, 'eval_wer': 0.8456843940714909, 'eval_runtime': 5.3949, 'eval_samples_per_second': 26.321, 'eval_steps_per_second': 0.927, 'epoch': 208.33},\n",
806
+ "])"
807
+ ]
808
+ },
809
+ {
810
+ "cell_type": "code",
811
+ "execution_count": 13,
812
+ "metadata": {},
813
+ "outputs": [],
814
+ "source": [
815
+ "# !zip -r wav2vec2-large-xls-r-300m-odia.zip wav2vec2-large-xls-r-300m-odia/\n",
816
+ "# !rm wav2vec2-large-xls-r-300m-odia.zip"
817
+ ]
818
+ },
819
+ {
820
+ "cell_type": "code",
821
+ "execution_count": 10,
822
+ "metadata": {},
823
+ "outputs": [
824
+ {
825
+ "name": "stdout",
826
+ "output_type": "stream",
827
+ "text": [
828
+ "Filesystem Size Used Avail Use% Mounted on\n",
829
+ "overlay 3.5T 557G 2.8T 17% /\n",
830
+ "tmpfs 64M 0 64M 0% /dev\n",
831
+ "tmpfs 87G 0 87G 0% /sys/fs/cgroup\n",
832
+ "tmpfs 87G 0 87G 0% /dev/shm\n",
833
+ "/dev/md0 3.5T 557G 2.8T 17% /etc/group\n",
834
+ "tmpfs 87G 12K 87G 1% /proc/driver/nvidia\n",
835
+ "/dev/vda1 49G 6.6G 42G 14% /usr/bin/nvidia-smi\n",
836
+ "udev 87G 0 87G 0% /dev/nvidia0\n",
837
+ "tmpfs 87G 0 87G 0% /proc/acpi\n",
838
+ "tmpfs 87G 0 87G 0% /proc/scsi\n",
839
+ "tmpfs 87G 0 87G 0% /sys/firmware\n"
840
+ ]
841
+ }
842
+ ],
843
+ "source": [
844
+ "!df -h"
845
+ ]
846
+ },
847
+ {
848
+ "cell_type": "code",
849
+ "execution_count": 6,
850
+ "metadata": {},
851
+ "outputs": [
852
+ {
853
+ "name": "stdout",
854
+ "output_type": "stream",
855
+ "text": [
856
+ "Downloading and preparing dataset common_voice/hy-AM to /workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/hy-AM/7.0.0/33e08856cfa0d0665e837bcad73ffd920a0bc713ce8c5fffb55dbdf1c084d5ba...\n"
857
+ ]
858
+ },
859
+ {
860
+ "data": {
861
+ "application/vnd.jupyter.widget-view+json": {
862
+ "model_id": "490374439642421092bd3b4fad8f2023",
863
+ "version_major": 2,
864
+ "version_minor": 0
865
+ },
866
+ "text/plain": [
867
+ "Downloading: 0%| | 0.00/59.0M [00:00<?, ?B/s]"
868
+ ]
869
+ },
870
+ "metadata": {},
871
+ "output_type": "display_data"
872
+ },
873
+ {
874
+ "data": {
875
+ "application/vnd.jupyter.widget-view+json": {
876
+ "model_id": "",
877
+ "version_major": 2,
878
+ "version_minor": 0
879
+ },
880
+ "text/plain": [
881
+ "0 examples [00:00, ? examples/s]"
882
+ ]
883
+ },
884
+ "metadata": {},
885
+ "output_type": "display_data"
886
+ },
887
+ {
888
+ "data": {
889
+ "application/vnd.jupyter.widget-view+json": {
890
+ "model_id": "",
891
+ "version_major": 2,
892
+ "version_minor": 0
893
+ },
894
+ "text/plain": [
895
+ "0 examples [00:00, ? examples/s]"
896
+ ]
897
+ },
898
+ "metadata": {},
899
+ "output_type": "display_data"
900
+ },
901
+ {
902
+ "data": {
903
+ "application/vnd.jupyter.widget-view+json": {
904
+ "model_id": "",
905
+ "version_major": 2,
906
+ "version_minor": 0
907
+ },
908
+ "text/plain": [
909
+ "0 examples [00:00, ? examples/s]"
910
+ ]
911
+ },
912
+ "metadata": {},
913
+ "output_type": "display_data"
914
+ },
915
+ {
916
+ "data": {
917
+ "application/vnd.jupyter.widget-view+json": {
918
+ "model_id": "",
919
+ "version_major": 2,
920
+ "version_minor": 0
921
+ },
922
+ "text/plain": [
923
+ "0 examples [00:00, ? examples/s]"
924
+ ]
925
+ },
926
+ "metadata": {},
927
+ "output_type": "display_data"
928
+ },
929
+ {
930
+ "data": {
931
+ "application/vnd.jupyter.widget-view+json": {
932
+ "model_id": "",
933
+ "version_major": 2,
934
+ "version_minor": 0
935
+ },
936
+ "text/plain": [
937
+ "0 examples [00:00, ? examples/s]"
938
+ ]
939
+ },
940
+ "metadata": {},
941
+ "output_type": "display_data"
942
+ },
943
+ {
944
+ "name": "stdout",
945
+ "output_type": "stream",
946
+ "text": [
947
+ "Dataset common_voice downloaded and prepared to /workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/hy-AM/7.0.0/33e08856cfa0d0665e837bcad73ffd920a0bc713ce8c5fffb55dbdf1c084d5ba. Subsequent calls will reuse this data.\n"
948
+ ]
949
+ },
950
+ {
951
+ "name": "stderr",
952
+ "output_type": "stream",
953
+ "text": [
954
+ "Reusing dataset common_voice (/workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/hy-AM/7.0.0/33e08856cfa0d0665e837bcad73ffd920a0bc713ce8c5fffb55dbdf1c084d5ba)\n"
955
+ ]
956
+ },
957
+ {
958
+ "name": "stdout",
959
+ "output_type": "stream",
960
+ "text": [
961
+ "554\n"
962
+ ]
963
+ }
964
+ ],
965
+ "source": [
966
+ "from datasets import load_dataset, load_metric, Audio\n",
967
+ "\n",
968
+ "common_voice_train = load_dataset(\"mozilla-foundation/common_voice_7_0\", \"hy-AM\", use_auth_token=True, split=\"train+validation\")\n",
969
+ "common_voice_test = load_dataset(\"mozilla-foundation/common_voice_7_0\", \"hy-AM\", use_auth_token=True, split=\"test\")\n",
970
+ "\n",
971
+ "print(len(common_voice_train))"
972
+ ]
973
+ },
974
+ {
975
+ "cell_type": "code",
976
+ "execution_count": 10,
977
+ "metadata": {},
978
+ "outputs": [
979
+ {
980
+ "data": {
981
+ "text/plain": [
982
+ "3462.5"
983
+ ]
984
+ },
985
+ "execution_count": 10,
986
+ "metadata": {},
987
+ "output_type": "execute_result"
988
+ }
989
+ ],
990
+ "source": [
991
+ "len(common_voice_train) * 200 / 32"
992
+ ]
993
+ },
994
+ {
995
+ "cell_type": "code",
996
+ "execution_count": 11,
997
+ "metadata": {},
998
+ "outputs": [],
999
+ "source": [
1000
+ "common_voice_train = common_voice_train.remove_columns([\"accent\", \"age\", \"client_id\", \"down_votes\", \"gender\", \"locale\", \"segment\", \"up_votes\"])\n",
1001
+ "common_voice_test = common_voice_test.remove_columns([\"accent\", \"age\", \"client_id\", \"down_votes\", \"gender\", \"locale\", \"segment\", \"up_votes\"])"
1002
+ ]
1003
+ },
1004
+ {
1005
+ "cell_type": "code",
1006
+ "execution_count": 12,
1007
+ "metadata": {},
1008
+ "outputs": [],
1009
+ "source": [
1010
+ "from datasets import ClassLabel\n",
1011
+ "import random\n",
1012
+ "import pandas as pd\n",
1013
+ "from IPython.display import display, HTML\n",
1014
+ "\n",
1015
+ "def show_random_elements(dataset, num_examples=10):\n",
1016
+ " assert num_examples <= len(dataset), \"Can't pick more elements than there are in the dataset.\"\n",
1017
+ " picks = []\n",
1018
+ " for _ in range(num_examples):\n",
1019
+ " pick = random.randint(0, len(dataset)-1)\n",
1020
+ " while pick in picks:\n",
1021
+ " pick = random.randint(0, len(dataset)-1)\n",
1022
+ " picks.append(pick)\n",
1023
+ " \n",
1024
+ " df = pd.DataFrame(dataset[picks])\n",
1025
+ " display(HTML(df.to_html()))"
1026
+ ]
1027
+ },
1028
+ {
1029
+ "cell_type": "code",
1030
+ "execution_count": 13,
1031
+ "metadata": {},
1032
+ "outputs": [
1033
+ {
1034
+ "data": {
1035
+ "text/html": [
1036
+ "<table border=\"1\" class=\"dataframe\">\n",
1037
+ " <thead>\n",
1038
+ " <tr style=\"text-align: right;\">\n",
1039
+ " <th></th>\n",
1040
+ " <th>sentence</th>\n",
1041
+ " </tr>\n",
1042
+ " </thead>\n",
1043
+ " <tbody>\n",
1044
+ " <tr>\n",
1045
+ " <th>0</th>\n",
1046
+ " <td>Ռեմիի մանկությունն անցնում է աղքատության և չքավորության մեջ։</td>\n",
1047
+ " </tr>\n",
1048
+ " <tr>\n",
1049
+ " <th>1</th>\n",
1050
+ " <td>Տղան դուրս չի գալիս կոմայից և մահանում է։</td>\n",
1051
+ " </tr>\n",
1052
+ " <tr>\n",
1053
+ " <th>2</th>\n",
1054
+ " <td>Հին հունական ողբերգության խորոսի տեքստերը հնչել են ասերգությամբ։</td>\n",
1055
+ " </tr>\n",
1056
+ " <tr>\n",
1057
+ " <th>3</th>\n",
1058
+ " <td>Այս դեպքում բուժումը վիրահատական է, իսկ դեղանյութն քիչ է արդյունավետ։</td>\n",
1059
+ " </tr>\n",
1060
+ " <tr>\n",
1061
+ " <th>4</th>\n",
1062
+ " <td>Կինը շատ զարմացավ, բայց կարեց այն։</td>\n",
1063
+ " </tr>\n",
1064
+ " <tr>\n",
1065
+ " <th>5</th>\n",
1066
+ " <td>Նախանձի և կատաղության մարմնավորում է։</td>\n",
1067
+ " </tr>\n",
1068
+ " <tr>\n",
1069
+ " <th>6</th>\n",
1070
+ " <td>Սովորել է տեղի միջնակարգ դպրոցում։</td>\n",
1071
+ " </tr>\n",
1072
+ " <tr>\n",
1073
+ " <th>7</th>\n",
1074
+ " <td>Կարելի է տեսնել, որ լուծումը կատարվել է տարբեր չափերով։</td>\n",
1075
+ " </tr>\n",
1076
+ " <tr>\n",
1077
+ " <th>8</th>\n",
1078
+ " <td>Մարմնի փոխադարձ խնամքը կարող է զուգակցվել յուրահատուկ ձայներով։</td>\n",
1079
+ " </tr>\n",
1080
+ " <tr>\n",
1081
+ " <th>9</th>\n",
1082
+ " <td>Նրա ծնողները ամենահայտնի և շատ սիրելի հերոսներ են։</td>\n",
1083
+ " </tr>\n",
1084
+ " </tbody>\n",
1085
+ "</table>"
1086
+ ],
1087
+ "text/plain": [
1088
+ "<IPython.core.display.HTML object>"
1089
+ ]
1090
+ },
1091
+ "metadata": {},
1092
+ "output_type": "display_data"
1093
+ }
1094
+ ],
1095
+ "source": [
1096
+ "show_random_elements(common_voice_train.remove_columns([\"path\", \"audio\"]), num_examples=10)"
1097
+ ]
1098
+ },
1099
+ {
1100
+ "cell_type": "code",
1101
+ "execution_count": 14,
1102
+ "metadata": {},
1103
+ "outputs": [],
1104
+ "source": [
1105
+ "import re\n",
1106
+ "chars_to_remove_regex = '[\\,\\?\\.\\!\\-\\;\\:\\\"\\“\\%\\‘\\”\\�\\'\\’\\–]'\n",
1107
+ "\n",
1108
+ "def remove_special_characters(batch):\n",
1109
+ " batch[\"sentence\"] = re.sub(chars_to_remove_regex, '', batch[\"sentence\"]).lower()\n",
1110
+ " return batch"
1111
+ ]
1112
+ },
1113
+ {
1114
+ "cell_type": "code",
1115
+ "execution_count": 15,
1116
+ "metadata": {},
1117
+ "outputs": [
1118
+ {
1119
+ "data": {
1120
+ "application/vnd.jupyter.widget-view+json": {
1121
+ "model_id": "0c428cc41f424758b526f216e04df4b4",
1122
+ "version_major": 2,
1123
+ "version_minor": 0
1124
+ },
1125
+ "text/plain": [
1126
+ " 0%| | 0/554 [00:00<?, ?ex/s]"
1127
+ ]
1128
+ },
1129
+ "metadata": {},
1130
+ "output_type": "display_data"
1131
+ },
1132
+ {
1133
+ "data": {
1134
+ "application/vnd.jupyter.widget-view+json": {
1135
+ "model_id": "c943bb86f3ea4aada759fbaf939e6ec1",
1136
+ "version_major": 2,
1137
+ "version_minor": 0
1138
+ },
1139
+ "text/plain": [
1140
+ " 0%| | 0/212 [00:00<?, ?ex/s]"
1141
+ ]
1142
+ },
1143
+ "metadata": {},
1144
+ "output_type": "display_data"
1145
+ }
1146
+ ],
1147
+ "source": [
1148
+ "common_voice_train = common_voice_train.map(remove_special_characters)\n",
1149
+ "common_voice_test = common_voice_test.map(remove_special_characters)"
1150
+ ]
1151
+ },
1152
+ {
1153
+ "cell_type": "code",
1154
+ "execution_count": 16,
1155
+ "metadata": {},
1156
+ "outputs": [],
1157
+ "source": [
1158
+ "def replace_hatted_characters(batch):\n",
1159
+ " batch[\"sentence\"] = re.sub('[â]', 'a', batch[\"sentence\"])\n",
1160
+ " batch[\"sentence\"] = re.sub('[î]', 'i', batch[\"sentence\"])\n",
1161
+ " batch[\"sentence\"] = re.sub('[ô]', 'o', batch[\"sentence\"])\n",
1162
+ " batch[\"sentence\"] = re.sub('[û]', 'u', batch[\"sentence\"])\n",
1163
+ " return batch"
1164
+ ]
1165
+ },
1166
+ {
1167
+ "cell_type": "code",
1168
+ "execution_count": 17,
1169
+ "metadata": {},
1170
+ "outputs": [
1171
+ {
1172
+ "data": {
1173
+ "application/vnd.jupyter.widget-view+json": {
1174
+ "model_id": "34e4cbdef1784315ab5e030b8a4396a1",
1175
+ "version_major": 2,
1176
+ "version_minor": 0
1177
+ },
1178
+ "text/plain": [
1179
+ " 0%| | 0/554 [00:00<?, ?ex/s]"
1180
+ ]
1181
+ },
1182
+ "metadata": {},
1183
+ "output_type": "display_data"
1184
+ },
1185
+ {
1186
+ "data": {
1187
+ "application/vnd.jupyter.widget-view+json": {
1188
+ "model_id": "50fb675cff214b4781c219a3eafcefc4",
1189
+ "version_major": 2,
1190
+ "version_minor": 0
1191
+ },
1192
+ "text/plain": [
1193
+ " 0%| | 0/212 [00:00<?, ?ex/s]"
1194
+ ]
1195
+ },
1196
+ "metadata": {},
1197
+ "output_type": "display_data"
1198
+ }
1199
+ ],
1200
+ "source": [
1201
+ "common_voice_train = common_voice_train.map(replace_hatted_characters)\n",
1202
+ "common_voice_test = common_voice_test.map(replace_hatted_characters)"
1203
+ ]
1204
+ },
1205
+ {
1206
+ "cell_type": "code",
1207
+ "execution_count": 18,
1208
+ "metadata": {},
1209
+ "outputs": [],
1210
+ "source": [
1211
+ "def extract_all_chars(batch):\n",
1212
+ " all_text = \" \".join(batch[\"sentence\"])\n",
1213
+ " vocab = list(set(all_text))\n",
1214
+ " return {\"vocab\": [vocab], \"all_text\": [all_text]}"
1215
+ ]
1216
+ },
1217
+ {
1218
+ "cell_type": "code",
1219
+ "execution_count": 19,
1220
+ "metadata": {},
1221
+ "outputs": [
1222
+ {
1223
+ "data": {
1224
+ "application/vnd.jupyter.widget-view+json": {
1225
+ "model_id": "d6098793a0d24b78b9045454ecfd13a1",
1226
+ "version_major": 2,
1227
+ "version_minor": 0
1228
+ },
1229
+ "text/plain": [
1230
+ " 0%| | 0/1 [00:00<?, ?ba/s]"
1231
+ ]
1232
+ },
1233
+ "metadata": {},
1234
+ "output_type": "display_data"
1235
+ },
1236
+ {
1237
+ "data": {
1238
+ "application/vnd.jupyter.widget-view+json": {
1239
+ "model_id": "8895c99f81514315956418f4189363ca",
1240
+ "version_major": 2,
1241
+ "version_minor": 0
1242
+ },
1243
+ "text/plain": [
1244
+ " 0%| | 0/1 [00:00<?, ?ba/s]"
1245
+ ]
1246
+ },
1247
+ "metadata": {},
1248
+ "output_type": "display_data"
1249
+ }
1250
+ ],
1251
+ "source": [
1252
+ "vocab_train = common_voice_train.map(extract_all_chars, batched=True, batch_size=-1, keep_in_memory=True, remove_columns=common_voice_train.column_names)\n",
1253
+ "vocab_test = common_voice_test.map(extract_all_chars, batched=True, batch_size=-1, keep_in_memory=True, remove_columns=common_voice_test.column_names)"
1254
+ ]
1255
+ },
1256
+ {
1257
+ "cell_type": "code",
1258
+ "execution_count": 20,
1259
+ "metadata": {},
1260
+ "outputs": [],
1261
+ "source": [
1262
+ "vocab_list = list(set(vocab_train[\"vocab\"][0]) | set(vocab_test[\"vocab\"][0]))"
1263
+ ]
1264
+ },
1265
+ {
1266
+ "cell_type": "code",
1267
+ "execution_count": 21,
1268
+ "metadata": {},
1269
+ "outputs": [
1270
+ {
1271
+ "data": {
1272
+ "text/plain": [
1273
+ "{' ': 0,\n",
1274
+ " '(': 1,\n",
1275
+ " ')': 2,\n",
1276
+ " '«': 3,\n",
1277
+ " '»': 4,\n",
1278
+ " '՛': 5,\n",
1279
+ " '՝': 6,\n",
1280
+ " '՞': 7,\n",
1281
+ " 'ա': 8,\n",
1282
+ " 'բ': 9,\n",
1283
+ " 'գ': 10,\n",
1284
+ " 'դ': 11,\n",
1285
+ " 'ե': 12,\n",
1286
+ " 'զ': 13,\n",
1287
+ " 'է': 14,\n",
1288
+ " 'ը': 15,\n",
1289
+ " 'թ': 16,\n",
1290
+ " 'ժ': 17,\n",
1291
+ " 'ի': 18,\n",
1292
+ " 'լ': 19,\n",
1293
+ " 'խ': 20,\n",
1294
+ " 'ծ': 21,\n",
1295
+ " 'կ': 22,\n",
1296
+ " 'հ': 23,\n",
1297
+ " 'ձ': 24,\n",
1298
+ " 'ղ': 25,\n",
1299
+ " 'ճ': 26,\n",
1300
+ " 'մ': 27,\n",
1301
+ " 'յ': 28,\n",
1302
+ " 'ն': 29,\n",
1303
+ " 'շ': 30,\n",
1304
+ " 'ո': 31,\n",
1305
+ " 'չ': 32,\n",
1306
+ " 'պ': 33,\n",
1307
+ " 'ջ': 34,\n",
1308
+ " 'ռ': 35,\n",
1309
+ " 'ս': 36,\n",
1310
+ " 'վ': 37,\n",
1311
+ " 'տ': 38,\n",
1312
+ " 'ր': 39,\n",
1313
+ " 'ց': 40,\n",
1314
+ " 'ւ': 41,\n",
1315
+ " 'փ': 42,\n",
1316
+ " 'ք': 43,\n",
1317
+ " 'օ': 44,\n",
1318
+ " 'ֆ': 45,\n",
1319
+ " 'և': 46,\n",
1320
+ " '։': 47}"
1321
+ ]
1322
+ },
1323
+ "execution_count": 21,
1324
+ "metadata": {},
1325
+ "output_type": "execute_result"
1326
+ }
1327
+ ],
1328
+ "source": [
1329
+ "vocab_dict = {v: k for k, v in enumerate(sorted(vocab_list))}\n",
1330
+ "vocab_dict"
1331
+ ]
1332
+ },
1333
+ {
1334
+ "cell_type": "code",
1335
+ "execution_count": 31,
1336
+ "metadata": {},
1337
+ "outputs": [
1338
+ {
1339
+ "name": "stdout",
1340
+ "output_type": "stream",
1341
+ "text": [
1342
+ "--2022-01-23 02:32:51-- https://raw.githubusercontent.com/huggingface/transformers/master/examples/research_projects/robust-speech-event/eval.py\n",
1343
+ "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.110.133, ...\n",
1344
+ "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.\n",
1345
+ "HTTP request sent, awaiting response... 200 OK\n",
1346
+ "Length: 4419 (4.3K) [text/plain]\n",
1347
+ "Saving to: ‘eval.py’\n",
1348
+ "\n",
1349
+ "eval.py 100%[===================>] 4.32K --.-KB/s in 0s \n",
1350
+ "\n",
1351
+ "2022-01-23 02:32:51 (18.3 MB/s) - ‘eval.py’ saved [4419/4419]\n",
1352
+ "\n",
1353
+ "total 1232640\n",
1354
+ "drwxr-xr-x 2 ovh ovh 4096 Jan 22 18:04 checkpoint-5500\n",
1355
+ "drwxr-xr-x 2 ovh ovh 4096 Jan 22 18:20 checkpoint-6000\n",
1356
+ "-rw-r--r-- 1 ovh ovh 195 Jan 22 18:22 train_results.json\n",
1357
+ "-rw-r--r-- 1 ovh ovh 10758 Jan 22 18:22 trainer_state.json\n",
1358
+ "-rw-r--r-- 1 ovh ovh 222 Jan 22 18:22 eval_results.json\n",
1359
+ "-rw-r--r-- 1 ovh ovh 2033 Jan 22 18:22 config.json\n",
1360
+ "-rw-r--r-- 1 ovh ovh 395 Jan 22 18:22 all_results.json\n",
1361
+ "-rw-r--r-- 1 ovh ovh 1262165553 Jan 22 18:22 pytorch_model.bin\n",
1362
+ "-rw-r--r-- 1 ovh ovh 3055 Jan 22 18:22 training_args.bin\n",
1363
+ "-rw-r--r-- 1 ovh ovh 212 Jan 22 18:22 preprocessor_config.json\n",
1364
+ "-rw-r--r-- 1 ovh ovh 4419 Jan 23 02:32 eval.py\n"
1365
+ ]
1366
+ }
1367
+ ],
1368
+ "source": [
1369
+ "!wget -O eval.py https://raw.githubusercontent.com/huggingface/transformers/master/examples/research_projects/robust-speech-event/eval.py\n",
1370
+ "!cp eval.py wav2vec2-large-xls-r-300m-urdu\n",
1371
+ "!ls -ltr wav2vec2-large-xls-r-300m-urdu"
1372
+ ]
1373
+ },
1374
+ {
1375
+ "cell_type": "code",
1376
+ "execution_count": 32,
1377
+ "metadata": {},
1378
+ "outputs": [
1379
+ {
1380
+ "name": "stdout",
1381
+ "output_type": "stream",
1382
+ "text": [
1383
+ "Reusing dataset common_voice (/workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/ur/7.0.0/33e08856cfa0d0665e837bcad73ffd920a0bc713ce8c5fffb55dbdf1c084d5ba)\n",
1384
+ "Traceback (most recent call last):\n",
1385
+ " File \"eval.py\", line 128, in <module>\n",
1386
+ " main(args)\n",
1387
+ " File \"eval.py\", line 81, in main\n",
1388
+ " asr = pipeline(\"automatic-speech-recognition\", model=args.model_id)\n",
1389
+ " File \"/opt/conda/lib/python3.8/site-packages/transformers/pipelines/__init__.py\", line 590, in pipeline\n",
1390
+ " tokenizer = AutoTokenizer.from_pretrained(\n",
1391
+ " File \"/opt/conda/lib/python3.8/site-packages/transformers/models/auto/tokenization_auto.py\", line 566, in from_pretrained\n",
1392
+ " return tokenizer_class_py.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)\n",
1393
+ " File \"/opt/conda/lib/python3.8/site-packages/transformers/tokenization_utils_base.py\", line 1731, in from_pretrained\n",
1394
+ " raise EnvironmentError(msg)\n",
1395
+ "OSError: Can't load tokenizer for './'. Make sure that:\n",
1396
+ "\n",
1397
+ "- './' is a correct model identifier listed on 'https://huggingface.co/models'\n",
1398
+ " (make sure './' is not a path to a local directory with something else, in that case)\n",
1399
+ "\n",
1400
+ "- or './' is the correct path to a directory containing relevant tokenizer files\n",
1401
+ "\n",
1402
+ "\n"
1403
+ ]
1404
+ }
1405
+ ],
1406
+ "source": [
1407
+ "!cd wav2vec2-large-xls-r-300m-urdu; python eval.py --model_id ./ --dataset mozilla-foundation/common_voice_7_0 --config ur --split test --log_outputs"
1408
+ ]
1409
+ },
1410
+ {
1411
+ "cell_type": "code",
1412
+ "execution_count": 1,
1413
+ "metadata": {},
1414
+ "outputs": [
1415
+ {
1416
+ "data": {
1417
+ "application/vnd.jupyter.widget-view+json": {
1418
+ "model_id": "24592b0be30e4eafb1949cf09d1c4fb4",
1419
+ "version_major": 2,
1420
+ "version_minor": 0
1421
+ },
1422
+ "text/plain": [
1423
+ "Downloading: 0%| | 0.00/260 [00:00<?, ?B/s]"
1424
+ ]
1425
+ },
1426
+ "metadata": {},
1427
+ "output_type": "display_data"
1428
+ },
1429
+ {
1430
+ "data": {
1431
+ "application/vnd.jupyter.widget-view+json": {
1432
+ "model_id": "f9bf2ab0d2fa4d3f9235cc6d1ab772f1",
1433
+ "version_major": 2,
1434
+ "version_minor": 0
1435
+ },
1436
+ "text/plain": [
1437
+ "Downloading: 0%| | 0.00/574 [00:00<?, ?B/s]"
1438
+ ]
1439
+ },
1440
+ "metadata": {},
1441
+ "output_type": "display_data"
1442
+ },
1443
+ {
1444
+ "data": {
1445
+ "application/vnd.jupyter.widget-view+json": {
1446
+ "model_id": "b0791474a34043da8057e06741472ade",
1447
+ "version_major": 2,
1448
+ "version_minor": 0
1449
+ },
1450
+ "text/plain": [
1451
+ "Downloading: 0%| | 0.00/23.0 [00:00<?, ?B/s]"
1452
+ ]
1453
+ },
1454
+ "metadata": {},
1455
+ "output_type": "display_data"
1456
+ },
1457
+ {
1458
+ "data": {
1459
+ "application/vnd.jupyter.widget-view+json": {
1460
+ "model_id": "1ccbd582d616458b87c76ac8dc5b6b36",
1461
+ "version_major": 2,
1462
+ "version_minor": 0
1463
+ },
1464
+ "text/plain": [
1465
+ "Downloading: 0%| | 0.00/309 [00:00<?, ?B/s]"
1466
+ ]
1467
+ },
1468
+ "metadata": {},
1469
+ "output_type": "display_data"
1470
+ }
1471
+ ],
1472
+ "source": [
1473
+ "from transformers import AutoModelForCTC, Wav2Vec2Processor\n",
1474
+ "\n",
1475
+ "model = AutoModelForCTC.from_pretrained(\"infinitejoy/wav2vec2-large-xls-r-300m-urdu\")\n",
1476
+ "processor = Wav2Vec2Processor.from_pretrained(\"infinitejoy/wav2vec2-large-xls-r-300m-urdu\")\n",
1477
+ "\n"
1478
+ ]
1479
+ },
1480
+ {
1481
+ "cell_type": "code",
1482
+ "execution_count": null,
1483
+ "metadata": {},
1484
+ "outputs": [],
1485
+ "source": []
1486
+ }
1487
+ ],
1488
+ "metadata": {
1489
+ "accelerator": "GPU",
1490
+ "colab": {
1491
+ "authorship_tag": "ABX9TyM3OaMlm9YQtKpl28c8gBBd",
1492
+ "include_colab_link": true,
1493
+ "name": "DebugOVHTransformers.ipynb",
1494
+ "provenance": []
1495
+ },
1496
+ "kernelspec": {
1497
+ "display_name": "Python 3",
1498
+ "language": "python",
1499
+ "name": "python3"
1500
+ },
1501
+ "language_info": {
1502
+ "codemirror_mode": {
1503
+ "name": "ipython",
1504
+ "version": 3
1505
+ },
1506
+ "file_extension": ".py",
1507
+ "mimetype": "text/x-python",
1508
+ "name": "python",
1509
+ "nbconvert_exporter": "python",
1510
+ "pygments_lexer": "ipython3",
1511
+ "version": "3.8.8"
1512
+ }
1513
+ },
1514
+ "nbformat": 4,
1515
+ "nbformat_minor": 4
1516
+ }