mpenagar commited on
Commit
177a846
1 Parent(s): 25369ab

Initial release

Browse files
README.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: facebook/wav2vec2-xls-r-300m
4
+ tags:
5
+ - automatic-speech-recognition
6
+ - gttsehu/basque_parliament_1
7
+ - generated_from_trainer
8
+ metrics:
9
+ - wer
10
+ model-index:
11
+ - name: facebook/wav2vec2-xls-r-300m
12
+ results: []
13
+ ---
14
+
15
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
16
+ should probably proofread and complete it, then remove this comment. -->
17
+
18
+ # facebook/wav2vec2-xls-r-300m
19
+
20
+ This model is a fine-tuned version of [facebook/wav2vec2-xls-r-300m](https://huggingface.co/facebook/wav2vec2-xls-r-300m) on the GTTSEHU/BASQUE_PARLIAMENT_1 - NA dataset.
21
+ It achieves the following results on the evaluation set:
22
+ - Loss: 0.0846
23
+ - Wer: 0.0367
24
+ - Cer: 0.0132
25
+
26
+ ## Model description
27
+
28
+ More information needed
29
+
30
+ ## Intended uses & limitations
31
+
32
+ More information needed
33
+
34
+ ## Training and evaluation data
35
+
36
+ More information needed
37
+
38
+ ## Training procedure
39
+
40
+ ### Training hyperparameters
41
+
42
+ The following hyperparameters were used during training:
43
+ - learning_rate: 0.0001
44
+ - train_batch_size: 4
45
+ - eval_batch_size: 4
46
+ - seed: 42
47
+ - distributed_type: multi-GPU
48
+ - num_devices: 4
49
+ - gradient_accumulation_steps: 2
50
+ - total_train_batch_size: 32
51
+ - total_eval_batch_size: 16
52
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
53
+ - lr_scheduler_type: linear
54
+ - lr_scheduler_warmup_steps: 1000
55
+ - num_epochs: 6.0
56
+ - mixed_precision_training: Native AMP
57
+
58
+ ### Training results
59
+
60
+ | Training Loss | Epoch | Step | Validation Loss | Wer | Cer |
61
+ |:-------------:|:-----:|:------:|:---------------:|:------:|:------:|
62
+ | 0.7054 | 0.19 | 4000 | 0.1011 | 0.0871 | 0.0227 |
63
+ | 0.0856 | 0.39 | 8000 | 0.0995 | 0.0747 | 0.0207 |
64
+ | 0.075 | 0.58 | 12000 | 0.0868 | 0.0647 | 0.0185 |
65
+ | 0.0694 | 0.77 | 16000 | 0.0853 | 0.0619 | 0.0183 |
66
+ | 0.0658 | 0.97 | 20000 | 0.0778 | 0.0573 | 0.0171 |
67
+ | 0.0589 | 1.16 | 24000 | 0.0821 | 0.0546 | 0.0166 |
68
+ | 0.0572 | 1.35 | 28000 | 0.0827 | 0.0558 | 0.0170 |
69
+ | 0.0551 | 1.55 | 32000 | 0.0830 | 0.0533 | 0.0169 |
70
+ | 0.054 | 1.74 | 36000 | 0.0788 | 0.0512 | 0.0162 |
71
+ | 0.0524 | 1.93 | 40000 | 0.0783 | 0.0489 | 0.0156 |
72
+ | 0.048 | 2.13 | 44000 | 0.0861 | 0.0492 | 0.0160 |
73
+ | 0.046 | 2.32 | 48000 | 0.0763 | 0.0494 | 0.0154 |
74
+ | 0.0456 | 2.51 | 52000 | 0.0835 | 0.0471 | 0.0153 |
75
+ | 0.0439 | 2.71 | 56000 | 0.0790 | 0.0469 | 0.0152 |
76
+ | 0.0436 | 2.9 | 60000 | 0.0832 | 0.0472 | 0.0155 |
77
+ | 0.0406 | 3.09 | 64000 | 0.0810 | 0.0442 | 0.0148 |
78
+ | 0.0386 | 3.29 | 68000 | 0.0810 | 0.0436 | 0.0146 |
79
+ | 0.038 | 3.48 | 72000 | 0.0778 | 0.0430 | 0.0143 |
80
+ | 0.0373 | 3.67 | 76000 | 0.0785 | 0.0430 | 0.0144 |
81
+ | 0.0363 | 3.87 | 80000 | 0.0788 | 0.0421 | 0.0144 |
82
+ | 0.0348 | 4.06 | 84000 | 0.0823 | 0.0423 | 0.0144 |
83
+ | 0.0323 | 4.25 | 88000 | 0.0819 | 0.0407 | 0.0143 |
84
+ | 0.0319 | 4.45 | 92000 | 0.0809 | 0.0410 | 0.0142 |
85
+ | 0.0314 | 4.64 | 96000 | 0.0821 | 0.0400 | 0.0138 |
86
+ | 0.0306 | 4.83 | 100000 | 0.0813 | 0.0389 | 0.0137 |
87
+ | 0.0295 | 5.03 | 104000 | 0.0820 | 0.0377 | 0.0131 |
88
+ | 0.0275 | 5.22 | 108000 | 0.0866 | 0.0378 | 0.0137 |
89
+ | 0.0267 | 5.41 | 112000 | 0.0831 | 0.0376 | 0.0134 |
90
+ | 0.0264 | 5.61 | 116000 | 0.0845 | 0.0369 | 0.0132 |
91
+ | 0.0258 | 5.8 | 120000 | 0.0859 | 0.0370 | 0.0133 |
92
+ | 0.0254 | 6.0 | 124000 | 0.0846 | 0.0367 | 0.0132 |
93
+
94
+
95
+ ### Framework versions
96
+
97
+ - Transformers 4.36.0.dev0
98
+ - Pytorch 2.1.1+cu121
99
+ - Datasets 2.15.1.dev0
100
+ - Tokenizers 0.15.0
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "</s>": 37,
3
+ "<s>": 36
4
+ }
all_results.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 6.0,
3
+ "eval_cer": 0.013241340046945509,
4
+ "eval_loss": 0.08458653092384338,
5
+ "eval_runtime": 66.2816,
6
+ "eval_samples": 4095,
7
+ "eval_samples_per_second": 61.782,
8
+ "eval_steps_per_second": 3.862,
9
+ "eval_wer": 0.03668088068923506,
10
+ "train_loss": 0.0650978993577199,
11
+ "train_runtime": 137826.0599,
12
+ "train_samples": 661871,
13
+ "train_samples_per_second": 28.813,
14
+ "train_steps_per_second": 0.9
15
+ }
config.json ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/wav2vec2-xls-r-300m",
3
+ "activation_dropout": 0.1,
4
+ "adapter_attn_dim": null,
5
+ "adapter_kernel_size": 3,
6
+ "adapter_stride": 2,
7
+ "add_adapter": false,
8
+ "apply_spec_augment": true,
9
+ "architectures": [
10
+ "Wav2Vec2ForCTC"
11
+ ],
12
+ "attention_dropout": 0.0,
13
+ "bos_token_id": 1,
14
+ "classifier_proj_size": 256,
15
+ "codevector_dim": 768,
16
+ "contrastive_logits_temperature": 0.1,
17
+ "conv_bias": true,
18
+ "conv_dim": [
19
+ 512,
20
+ 512,
21
+ 512,
22
+ 512,
23
+ 512,
24
+ 512,
25
+ 512
26
+ ],
27
+ "conv_kernel": [
28
+ 10,
29
+ 3,
30
+ 3,
31
+ 3,
32
+ 3,
33
+ 2,
34
+ 2
35
+ ],
36
+ "conv_stride": [
37
+ 5,
38
+ 2,
39
+ 2,
40
+ 2,
41
+ 2,
42
+ 2,
43
+ 2
44
+ ],
45
+ "ctc_loss_reduction": "mean",
46
+ "ctc_zero_infinity": false,
47
+ "diversity_loss_weight": 0.1,
48
+ "do_stable_layer_norm": true,
49
+ "eos_token_id": 2,
50
+ "feat_extract_activation": "gelu",
51
+ "feat_extract_dropout": 0.0,
52
+ "feat_extract_norm": "layer",
53
+ "feat_proj_dropout": 0.0,
54
+ "feat_quantizer_dropout": 0.0,
55
+ "final_dropout": 0.0,
56
+ "hidden_act": "gelu",
57
+ "hidden_dropout": 0.0,
58
+ "hidden_size": 1024,
59
+ "initializer_range": 0.02,
60
+ "intermediate_size": 4096,
61
+ "layer_norm_eps": 1e-05,
62
+ "layerdrop": 0.0,
63
+ "mask_feature_length": 10,
64
+ "mask_feature_min_masks": 0,
65
+ "mask_feature_prob": 0.0,
66
+ "mask_time_length": 10,
67
+ "mask_time_min_masks": 2,
68
+ "mask_time_prob": 0.05,
69
+ "model_type": "wav2vec2",
70
+ "num_adapter_layers": 3,
71
+ "num_attention_heads": 16,
72
+ "num_codevector_groups": 2,
73
+ "num_codevectors_per_group": 320,
74
+ "num_conv_pos_embedding_groups": 16,
75
+ "num_conv_pos_embeddings": 128,
76
+ "num_feat_extract_layers": 7,
77
+ "num_hidden_layers": 24,
78
+ "num_negatives": 100,
79
+ "output_hidden_size": 1024,
80
+ "pad_token_id": 35,
81
+ "proj_codevector_dim": 768,
82
+ "tdnn_dilation": [
83
+ 1,
84
+ 2,
85
+ 3,
86
+ 1,
87
+ 1
88
+ ],
89
+ "tdnn_dim": [
90
+ 512,
91
+ 512,
92
+ 512,
93
+ 512,
94
+ 1500
95
+ ],
96
+ "tdnn_kernel": [
97
+ 5,
98
+ 3,
99
+ 3,
100
+ 1,
101
+ 1
102
+ ],
103
+ "torch_dtype": "float32",
104
+ "transformers_version": "4.36.0.dev0",
105
+ "use_weighted_layer_sum": false,
106
+ "vocab_size": 38,
107
+ "xvector_output_dim": 512
108
+ }
eval_results.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 6.0,
3
+ "eval_cer": 0.013241340046945509,
4
+ "eval_loss": 0.08458653092384338,
5
+ "eval_runtime": 66.2816,
6
+ "eval_samples": 4095,
7
+ "eval_samples_per_second": 61.782,
8
+ "eval_steps_per_second": 3.862,
9
+ "eval_wer": 0.03668088068923506
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d54894561858baf756dc2f8aa113d9cb6325470b86e7d7a2682984b686c7232
3
+ size 1261963280
preprocessor_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
4
+ "feature_size": 1,
5
+ "padding_side": "right",
6
+ "padding_value": 0,
7
+ "return_attention_mask": true,
8
+ "sampling_rate": 16000
9
+ }
run.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -eu
3
+
4
+ # --ddp_timeout DDP_TIMEOUT
5
+ # Overrides the default timeout for distributed training
6
+ # (value should be given in seconds). (default: 1800)
7
+ # --ddp_timeout 18000 --> 300min
8
+
9
+ accelerate launch \
10
+ run_speech_recognition_ctc_bnb.py \
11
+ --ddp_timeout 180000 \
12
+ --activation_dropout="0.1" \
13
+ --dataset_name="gttsehu/basque_parliament_1" \
14
+ --do_train --do_eval \
15
+ --eval_metrics wer cer \
16
+ --eval_split_name="validation" \
17
+ --eval_steps="4000" \
18
+ --evaluation_strategy="steps" \
19
+ --fp16 \
20
+ --freeze_feature_encoder \
21
+ --gradient_accumulation_steps="2" \
22
+ --gradient_checkpointing \
23
+ --group_by_length \
24
+ --learning_rate="1e-4" \
25
+ --length_column_name="input_length" \
26
+ --logging_steps="4000" \
27
+ --model_name_or_path="facebook/wav2vec2-xls-r-300m" \
28
+ --num_train_epochs="6" \
29
+ --output_dir="./" \
30
+ --overwrite_output_dir \
31
+ --preprocessing_num_workers=32 \
32
+ --per_device_train_batch_size="4" \
33
+ --per_device_eval_batch_size="4" \
34
+ --save_strategy="no" \
35
+ --text_column_name="sentence" \
36
+ --train_split_name="train_clean" \
37
+ --warmup_steps="1000" \
38
+
run_speech_recognition_ctc_bnb.py ADDED
@@ -0,0 +1,782 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding=utf-8
3
+ # Copyright 2021 The HuggingFace Inc. team. All rights reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+
16
+ """ Fine-tuning a 🤗 Transformers CTC model for automatic speech recognition"""
17
+
18
+ import functools
19
+ import json
20
+ import logging
21
+ import os
22
+ import re
23
+ import sys
24
+ import warnings
25
+ from dataclasses import dataclass, field
26
+ from typing import Dict, List, Optional, Union
27
+
28
+ import bitsandbytes as bnb
29
+ import datasets
30
+ import numpy as np
31
+ import torch
32
+ from datasets import DatasetDict, load_dataset, load_metric
33
+
34
+ import transformers
35
+ from transformers import (
36
+ AutoConfig,
37
+ AutoFeatureExtractor,
38
+ AutoModelForCTC,
39
+ AutoProcessor,
40
+ AutoTokenizer,
41
+ HfArgumentParser,
42
+ Trainer,
43
+ TrainingArguments,
44
+ Wav2Vec2Processor,
45
+ set_seed,
46
+ )
47
+ from transformers.trainer_pt_utils import get_parameter_names
48
+ from transformers.trainer_utils import get_last_checkpoint, is_main_process
49
+ from transformers.utils import check_min_version
50
+ from transformers.utils.versions import require_version
51
+
52
+
53
+ # Will error if the minimal version of Transformers is not installed. Remove at your own risks.
54
+ check_min_version("4.16.0.dev0")
55
+
56
+ require_version("datasets>=1.13.3", "To fix: pip install -r examples/pytorch/text-classification/requirements.txt")
57
+
58
+
59
+ logger = logging.getLogger(__name__)
60
+
61
+
62
+ def list_field(default=None, metadata=None):
63
+ return field(default_factory=lambda: default, metadata=metadata)
64
+
65
+
66
+ @dataclass
67
+ class ModelArguments:
68
+ """
69
+ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from.
70
+ """
71
+
72
+ model_name_or_path: str = field(
73
+ metadata={"help": "Path to pretrained model or model identifier from huggingface.co/models"}
74
+ )
75
+ tokenizer_name_or_path: Optional[str] = field(
76
+ default=None,
77
+ metadata={"help": "Path to pretrained tokenizer or tokenizer identifier from huggingface.co/models"},
78
+ )
79
+ cache_dir: Optional[str] = field(
80
+ default=None,
81
+ metadata={"help": "Where do you want to store the pretrained models downloaded from huggingface.co"},
82
+ )
83
+ freeze_feature_encoder: bool = field(
84
+ default=True, metadata={"help": "Whether to freeze the feature encoder layers of the model."}
85
+ )
86
+ attention_dropout: float = field(
87
+ default=0.0, metadata={"help": "The dropout ratio for the attention probabilities."}
88
+ )
89
+ activation_dropout: float = field(
90
+ default=0.0, metadata={"help": "The dropout ratio for activations inside the fully connected layer."}
91
+ )
92
+ feat_proj_dropout: float = field(default=0.0, metadata={"help": "The dropout ratio for the projected features."})
93
+ hidden_dropout: float = field(
94
+ default=0.0,
95
+ metadata={
96
+ "help": "The dropout probability for all fully connected layers in the embeddings, encoder, and pooler."
97
+ },
98
+ )
99
+ final_dropout: float = field(
100
+ default=0.0,
101
+ metadata={"help": "The dropout probability for the final projection layer."},
102
+ )
103
+ mask_time_prob: float = field(
104
+ default=0.05,
105
+ metadata={
106
+ "help": (
107
+ "Probability of each feature vector along the time axis to be chosen as the start of the vector "
108
+ "span to be masked. Approximately ``mask_time_prob * sequence_length // mask_time_length`` feature "
109
+ "vectors will be masked along the time axis."
110
+ )
111
+ },
112
+ )
113
+ mask_time_length: int = field(
114
+ default=10,
115
+ metadata={"help": "Length of vector span to mask along the time axis."},
116
+ )
117
+ mask_feature_prob: float = field(
118
+ default=0.0,
119
+ metadata={
120
+ "help": (
121
+ "Probability of each feature vector along the feature axis to be chosen as the start of the vectorspan"
122
+ " to be masked. Approximately ``mask_feature_prob * sequence_length // mask_feature_length`` feature"
123
+ " bins will be masked along the time axis."
124
+ )
125
+ },
126
+ )
127
+ mask_feature_length: int = field(
128
+ default=10,
129
+ metadata={"help": "Length of vector span to mask along the feature axis."},
130
+ )
131
+ layerdrop: float = field(default=0.0, metadata={"help": "The LayerDrop probability."})
132
+ ctc_loss_reduction: Optional[str] = field(
133
+ default="mean", metadata={"help": "The way the ctc loss should be reduced. Should be one of 'mean' or 'sum'."}
134
+ )
135
+
136
+
137
+ @dataclass
138
+ class DataTrainingArguments:
139
+ """
140
+ Arguments pertaining to what data we are going to input our model for training and eval.
141
+
142
+ Using `HfArgumentParser` we can turn this class
143
+ into argparse arguments to be able to specify them on
144
+ the command line.
145
+ """
146
+
147
+ dataset_name: str = field(
148
+ metadata={"help": "The configuration name of the dataset to use (via the datasets library)."}
149
+ )
150
+ dataset_config_name: str = field(
151
+ default=None, metadata={"help": "The configuration name of the dataset to use (via the datasets library)."}
152
+ )
153
+ train_split_name: str = field(
154
+ default="train+validation",
155
+ metadata={
156
+ "help": "The name of the training data set split to use (via the datasets library). Defaults to 'train'"
157
+ },
158
+ )
159
+ eval_split_name: str = field(
160
+ default="test",
161
+ metadata={
162
+ "help": "The name of the training data set split to use (via the datasets library). Defaults to 'train'"
163
+ },
164
+ )
165
+ audio_column_name: str = field(
166
+ default="audio",
167
+ metadata={"help": "The name of the dataset column containing the audio data. Defaults to 'audio'"},
168
+ )
169
+ text_column_name: str = field(
170
+ default="text",
171
+ metadata={"help": "The name of the dataset column containing the text data. Defaults to 'text'"},
172
+ )
173
+ overwrite_cache: bool = field(
174
+ default=False, metadata={"help": "Overwrite the cached preprocessed datasets or not."}
175
+ )
176
+ preprocessing_num_workers: Optional[int] = field(
177
+ default=None,
178
+ metadata={"help": "The number of processes to use for the preprocessing."},
179
+ )
180
+ max_train_samples: Optional[int] = field(
181
+ default=None,
182
+ metadata={
183
+ "help": (
184
+ "For debugging purposes or quicker training, truncate the number of training examples to this "
185
+ "value if set."
186
+ )
187
+ },
188
+ )
189
+ max_eval_samples: Optional[int] = field(
190
+ default=None,
191
+ metadata={
192
+ "help": (
193
+ "For debugging purposes or quicker training, truncate the number of validation examples to this "
194
+ "value if set."
195
+ )
196
+ },
197
+ )
198
+ chars_to_ignore: Optional[List[str]] = list_field(
199
+ default=None,
200
+ metadata={"help": "A list of characters to remove from the transcripts."},
201
+ )
202
+ eval_metrics: List[str] = list_field(
203
+ default=["wer"],
204
+ metadata={"help": "A list of metrics the model should be evaluated on. E.g. `'wer cer'`"},
205
+ )
206
+ max_duration_in_seconds: float = field(
207
+ default=20.0,
208
+ metadata={
209
+ "help": (
210
+ "Filter audio files that are longer than `max_duration_in_seconds` seconds to"
211
+ " 'max_duration_in_seconds`"
212
+ )
213
+ },
214
+ )
215
+ min_duration_in_seconds: float = field(
216
+ default=0.0, metadata={"help": "Filter audio files that are shorter than `min_duration_in_seconds` seconds"}
217
+ )
218
+ preprocessing_only: bool = field(
219
+ default=False,
220
+ metadata={
221
+ "help": (
222
+ "Whether to only do data preprocessing and skip training. This is especially useful when data"
223
+ " preprocessing errors out in distributed training due to timeout. In this case, one should run the"
224
+ " preprocessing in a non-distributed setup with `preprocessing_only=True` so that the cached datasets"
225
+ " can consequently be loaded in distributed training"
226
+ )
227
+ },
228
+ )
229
+ use_auth_token: bool = field(
230
+ default=False,
231
+ metadata={
232
+ "help": (
233
+ "If :obj:`True`, will use the token generated when running"
234
+ ":obj:`huggingface-cli login` as HTTP bearer authorization for remote files."
235
+ )
236
+ },
237
+ )
238
+ unk_token: str = field(
239
+ default="[UNK]",
240
+ metadata={"help": "The unk token for the tokenizer"},
241
+ )
242
+ pad_token: str = field(
243
+ default="[PAD]",
244
+ metadata={"help": "The padding token for the tokenizer"},
245
+ )
246
+ word_delimiter_token: str = field(
247
+ default="|",
248
+ metadata={"help": "The word delimiter token for the tokenizer"},
249
+ )
250
+ phoneme_language: Optional[str] = field(
251
+ default=None,
252
+ metadata={
253
+ "help": (
254
+ "The target language that should be used be"
255
+ " passed to the tokenizer for tokenization. Note that"
256
+ " this is only relevant if the model classifies the"
257
+ " input audio to a sequence of phoneme sequences."
258
+ )
259
+ },
260
+ )
261
+
262
+
263
+ @dataclass
264
+ class DataCollatorCTCWithPadding:
265
+ """
266
+ Data collator that will dynamically pad the inputs received.
267
+ Args:
268
+ processor (:class:`~transformers.AutoProcessor`)
269
+ The processor used for proccessing the data.
270
+ padding (:obj:`bool`, :obj:`str` or :class:`~transformers.tokenization_utils_base.PaddingStrategy`, `optional`, defaults to :obj:`True`):
271
+ Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
272
+ among:
273
+ * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
274
+ sequence if provided).
275
+ * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the
276
+ maximum acceptable input length for the model if that argument is not provided.
277
+ * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of
278
+ different lengths).
279
+ max_length (:obj:`int`, `optional`):
280
+ Maximum length of the ``input_values`` of the returned list and optionally padding length (see above).
281
+ max_length_labels (:obj:`int`, `optional`):
282
+ Maximum length of the ``labels`` returned list and optionally padding length (see above).
283
+ pad_to_multiple_of (:obj:`int`, `optional`):
284
+ If set will pad the sequence to a multiple of the provided value.
285
+ This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability >=
286
+ 7.5 (Volta).
287
+ """
288
+
289
+ processor: AutoProcessor
290
+ padding: Union[bool, str] = "longest"
291
+ pad_to_multiple_of: Optional[int] = None
292
+ pad_to_multiple_of_labels: Optional[int] = None
293
+
294
+ def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:
295
+ # split inputs and labels since they have to be of different lengths and need
296
+ # different padding methods
297
+ input_features = [{"input_values": feature["input_values"]} for feature in features]
298
+ label_features = [{"input_ids": feature["labels"]} for feature in features]
299
+
300
+ batch = self.processor.pad(
301
+ input_features,
302
+ padding=self.padding,
303
+ pad_to_multiple_of=self.pad_to_multiple_of,
304
+ return_tensors="pt",
305
+ )
306
+
307
+ labels_batch = self.processor.pad(
308
+ labels=label_features,
309
+ padding=self.padding,
310
+ pad_to_multiple_of=self.pad_to_multiple_of_labels,
311
+ return_tensors="pt",
312
+ )
313
+
314
+ # replace padding with -100 to ignore loss correctly
315
+ labels = labels_batch["input_ids"].masked_fill(labels_batch.attention_mask.ne(1), -100)
316
+
317
+ batch["labels"] = labels
318
+
319
+ return batch
320
+
321
+
322
+ def create_vocabulary_from_data(
323
+ datasets: DatasetDict,
324
+ word_delimiter_token: Optional[str] = None,
325
+ unk_token: Optional[str] = None,
326
+ pad_token: Optional[str] = None,
327
+ ):
328
+ # Given training and test labels create vocabulary
329
+ def extract_all_chars(batch):
330
+ all_text = " ".join(batch["target_text"])
331
+ vocab = list(set(all_text))
332
+ return {"vocab": [vocab], "all_text": [all_text]}
333
+
334
+ vocabs = datasets.map(
335
+ extract_all_chars,
336
+ batched=True,
337
+ batch_size=-1,
338
+ keep_in_memory=True,
339
+ remove_columns=datasets["train"].column_names,
340
+ )
341
+
342
+ # take union of all unique characters in each dataset
343
+ vocab_set = functools.reduce(
344
+ lambda vocab_1, vocab_2: set(vocab_1["vocab"][0]) | set(vocab_2["vocab"][0]), vocabs.values()
345
+ )
346
+
347
+ vocab_dict = {v: k for k, v in enumerate(sorted(vocab_set))}
348
+
349
+ # replace white space with delimiter token
350
+ if word_delimiter_token is not None:
351
+ vocab_dict[word_delimiter_token] = vocab_dict[" "]
352
+ del vocab_dict[" "]
353
+
354
+ # add unk and pad token
355
+ if unk_token is not None:
356
+ vocab_dict[unk_token] = len(vocab_dict)
357
+
358
+ if pad_token is not None:
359
+ vocab_dict[pad_token] = len(vocab_dict)
360
+
361
+ return vocab_dict
362
+
363
+
364
+ def main():
365
+ # See all possible arguments in src/transformers/training_args.py
366
+ # or by passing the --help flag to this script.
367
+ # We now keep distinct sets of args, for a cleaner separation of concerns.
368
+
369
+ parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments))
370
+ if len(sys.argv) == 2 and sys.argv[1].endswith(".json"):
371
+ # If we pass only one argument to the script and it's the path to a json file,
372
+ # let's parse it to get our arguments.
373
+ model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1]))
374
+ else:
375
+ model_args, data_args, training_args = parser.parse_args_into_dataclasses()
376
+
377
+ # Detecting last checkpoint.
378
+ last_checkpoint = None
379
+ if os.path.isdir(training_args.output_dir) and training_args.do_train and not training_args.overwrite_output_dir:
380
+ last_checkpoint = get_last_checkpoint(training_args.output_dir)
381
+ if last_checkpoint is None and len(os.listdir(training_args.output_dir)) > 0:
382
+ raise ValueError(
383
+ f"Output directory ({training_args.output_dir}) already exists and is not empty. "
384
+ "Use --overwrite_output_dir to overcome."
385
+ )
386
+ elif last_checkpoint is not None:
387
+ logger.info(
388
+ f"Checkpoint detected, resuming training at {last_checkpoint}. To avoid this behavior, change "
389
+ "the `--output_dir` or add `--overwrite_output_dir` to train from scratch."
390
+ )
391
+
392
+ # Setup logging
393
+ logging.basicConfig(
394
+ format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
395
+ datefmt="%m/%d/%Y %H:%M:%S",
396
+ handlers=[logging.StreamHandler(sys.stdout)],
397
+ )
398
+ logger.setLevel(logging.INFO if is_main_process(training_args.local_rank) else logging.WARN)
399
+
400
+ # Log on each process the small summary:
401
+ logger.warning(
402
+ f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}, "
403
+ f"distributed training: {bool(training_args.local_rank != -1)}, 16-bits training: {training_args.fp16}"
404
+ )
405
+ # Set the verbosity to info of the Transformers logger (on main process only):
406
+ if is_main_process(training_args.local_rank):
407
+ transformers.utils.logging.set_verbosity_info()
408
+ logger.info("Training/evaluation parameters %s", training_args)
409
+
410
+ # Set seed before initializing model.
411
+ set_seed(training_args.seed)
412
+
413
+ # 1. First, let's load the dataset
414
+ raw_datasets = DatasetDict()
415
+
416
+ if training_args.do_train:
417
+ raw_datasets["train"] = load_dataset(
418
+ data_args.dataset_name,
419
+ data_args.dataset_config_name,
420
+ split=data_args.train_split_name,
421
+ use_auth_token=data_args.use_auth_token,
422
+ )
423
+
424
+ if data_args.audio_column_name not in raw_datasets["train"].column_names:
425
+ raise ValueError(
426
+ f"--audio_column_name '{data_args.audio_column_name}' not found in dataset '{data_args.dataset_name}'."
427
+ " Make sure to set `--audio_column_name` to the correct audio column - one of"
428
+ f" {', '.join(raw_datasets['train'].column_names)}."
429
+ )
430
+
431
+ if data_args.text_column_name not in raw_datasets["train"].column_names:
432
+ raise ValueError(
433
+ f"--text_column_name {data_args.text_column_name} not found in dataset '{data_args.dataset_name}'. "
434
+ "Make sure to set `--text_column_name` to the correct text column - one of "
435
+ f"{', '.join(raw_datasets['train'].column_names)}."
436
+ )
437
+
438
+ if data_args.max_train_samples is not None:
439
+ raw_datasets["train"] = raw_datasets["train"].select(range(data_args.max_train_samples))
440
+
441
+ if training_args.do_eval:
442
+ raw_datasets["eval"] = load_dataset(
443
+ data_args.dataset_name,
444
+ data_args.dataset_config_name,
445
+ split=data_args.eval_split_name,
446
+ use_auth_token=data_args.use_auth_token,
447
+ )
448
+
449
+ if data_args.max_eval_samples is not None:
450
+ raw_datasets["eval"] = raw_datasets["eval"].select(range(data_args.max_eval_samples))
451
+
452
+ # 2. We remove some special characters from the datasets
453
+ # that make training complicated and do not help in transcribing the speech
454
+ # E.g. characters, such as `,` and `.` do not really have an acoustic characteristic
455
+ # that could be easily picked up by the model
456
+ chars_to_ignore_regex = (
457
+ f'[{"".join(data_args.chars_to_ignore)}]' if data_args.chars_to_ignore is not None else None
458
+ )
459
+ text_column_name = data_args.text_column_name
460
+
461
+ def remove_special_characters(batch):
462
+ if chars_to_ignore_regex is not None:
463
+ batch["target_text"] = re.sub(chars_to_ignore_regex, "", batch[text_column_name]).lower() + " "
464
+ else:
465
+ batch["target_text"] = batch[text_column_name].lower() + " "
466
+ return batch
467
+
468
+ with training_args.main_process_first(desc="dataset map special characters removal"):
469
+ raw_datasets = raw_datasets.map(
470
+ remove_special_characters,
471
+ remove_columns=[text_column_name],
472
+ desc="remove special characters from datasets",
473
+ )
474
+
475
+ # save special tokens for tokenizer
476
+ word_delimiter_token = data_args.word_delimiter_token
477
+ unk_token = data_args.unk_token
478
+ pad_token = data_args.pad_token
479
+
480
+ # 3. Next, let's load the config as we might need it to create
481
+ # the tokenizer
482
+ # load config
483
+ config = AutoConfig.from_pretrained(
484
+ model_args.model_name_or_path, cache_dir=model_args.cache_dir, use_auth_token=data_args.use_auth_token
485
+ )
486
+
487
+ # 4. Next, if no tokenizer file is defined,
488
+ # we create the vocabulary of the model by extracting all unique characters from
489
+ # the training and evaluation datasets
490
+ # We need to make sure that only first rank saves vocabulary
491
+ # make sure all processes wait until vocab is created
492
+ tokenizer_name_or_path = model_args.tokenizer_name_or_path
493
+ tokenizer_kwargs = {}
494
+ if tokenizer_name_or_path is None:
495
+ # save vocab in training output dir
496
+ tokenizer_name_or_path = training_args.output_dir
497
+
498
+ vocab_file = os.path.join(tokenizer_name_or_path, "vocab.json")
499
+
500
+ with training_args.main_process_first():
501
+ if training_args.overwrite_output_dir and os.path.isfile(vocab_file):
502
+ os.remove(vocab_file)
503
+
504
+ with training_args.main_process_first(desc="dataset map vocabulary creation"):
505
+ if not os.path.isfile(vocab_file):
506
+ os.makedirs(tokenizer_name_or_path, exist_ok=True)
507
+ vocab_dict = create_vocabulary_from_data(
508
+ raw_datasets,
509
+ word_delimiter_token=word_delimiter_token,
510
+ unk_token=unk_token,
511
+ pad_token=pad_token,
512
+ )
513
+
514
+ # save vocab dict to be loaded into tokenizer
515
+ with open(vocab_file, "w") as file:
516
+ json.dump(vocab_dict, file)
517
+
518
+ # if tokenizer has just been created
519
+ # it is defined by `tokenizer_class` if present in config else by `model_type`
520
+ tokenizer_kwargs = {
521
+ "config": config if config.tokenizer_class is not None else None,
522
+ "tokenizer_type": config.model_type if config.tokenizer_class is None else None,
523
+ "unk_token": unk_token,
524
+ "pad_token": pad_token,
525
+ "word_delimiter_token": word_delimiter_token,
526
+ }
527
+
528
+ # 5. Now we can instantiate the feature extractor, tokenizer and model
529
+ # Note for distributed training, the .from_pretrained methods guarantee that only
530
+ # one local process can concurrently download model & vocab.
531
+
532
+ # load feature_extractor and tokenizer
533
+ tokenizer = AutoTokenizer.from_pretrained(
534
+ tokenizer_name_or_path,
535
+ use_auth_token=data_args.use_auth_token,
536
+ **tokenizer_kwargs,
537
+ )
538
+ feature_extractor = AutoFeatureExtractor.from_pretrained(
539
+ model_args.model_name_or_path, cache_dir=model_args.cache_dir, use_auth_token=data_args.use_auth_token
540
+ )
541
+
542
+ # adapt config
543
+ config.update(
544
+ {
545
+ "feat_proj_dropout": model_args.feat_proj_dropout,
546
+ "attention_dropout": model_args.attention_dropout,
547
+ "hidden_dropout": model_args.hidden_dropout,
548
+ "final_dropout": model_args.final_dropout,
549
+ "mask_time_prob": model_args.mask_time_prob,
550
+ "mask_time_length": model_args.mask_time_length,
551
+ "mask_feature_prob": model_args.mask_feature_prob,
552
+ "mask_feature_length": model_args.mask_feature_length,
553
+ "gradient_checkpointing": training_args.gradient_checkpointing,
554
+ "layerdrop": model_args.layerdrop,
555
+ "ctc_loss_reduction": model_args.ctc_loss_reduction,
556
+ "pad_token_id": tokenizer.pad_token_id,
557
+ "vocab_size": len(tokenizer),
558
+ "activation_dropout": model_args.activation_dropout,
559
+ }
560
+ )
561
+
562
+ # create model
563
+ model = AutoModelForCTC.from_pretrained(
564
+ model_args.model_name_or_path,
565
+ cache_dir=model_args.cache_dir,
566
+ config=config,
567
+ use_auth_token=data_args.use_auth_token,
568
+ )
569
+
570
+ # freeze encoder
571
+ if model_args.freeze_feature_encoder:
572
+ model.freeze_feature_encoder()
573
+
574
+ # 6. Now we preprocess the datasets including loading the audio, resampling and normalization
575
+ # Thankfully, `datasets` takes care of automatically loading and resampling the audio,
576
+ # so that we just need to set the correct target sampling rate and normalize the input
577
+ # via the `feature_extractor`
578
+
579
+ # make sure that dataset decodes audio with correct sampling rate
580
+ dataset_sampling_rate = next(iter(raw_datasets.values())).features[data_args.audio_column_name].sampling_rate
581
+ if dataset_sampling_rate != feature_extractor.sampling_rate:
582
+ raw_datasets = raw_datasets.cast_column(
583
+ data_args.audio_column_name, datasets.features.Audio(sampling_rate=feature_extractor.sampling_rate)
584
+ )
585
+
586
+ # derive max & min input length for sample rate & max duration
587
+ max_input_length = data_args.max_duration_in_seconds * feature_extractor.sampling_rate
588
+ min_input_length = data_args.min_duration_in_seconds * feature_extractor.sampling_rate
589
+ audio_column_name = data_args.audio_column_name
590
+ num_workers = data_args.preprocessing_num_workers
591
+
592
+ # `phoneme_language` is only relevant if the model is fine-tuned on phoneme classification
593
+ phoneme_language = data_args.phoneme_language
594
+
595
+ # Preprocessing the datasets.
596
+ # We need to read the audio files as arrays and tokenize the targets.
597
+ def prepare_dataset(batch):
598
+ # load audio
599
+ sample = batch[audio_column_name]
600
+
601
+ inputs = feature_extractor(sample["array"], sampling_rate=sample["sampling_rate"])
602
+ batch["input_values"] = inputs.input_values[0]
603
+ batch["input_length"] = len(batch["input_values"])
604
+
605
+ # encode targets
606
+ additional_kwargs = {}
607
+ if phoneme_language is not None:
608
+ additional_kwargs["phonemizer_lang"] = phoneme_language
609
+
610
+ batch["labels"] = tokenizer(batch["target_text"], **additional_kwargs).input_ids
611
+ return batch
612
+
613
+ with training_args.main_process_first(desc="dataset map preprocessing"):
614
+ vectorized_datasets = raw_datasets.map(
615
+ prepare_dataset,
616
+ remove_columns=next(iter(raw_datasets.values())).column_names,
617
+ num_proc=num_workers,
618
+ desc="preprocess datasets",
619
+ )
620
+
621
+ def is_audio_in_length_range(length):
622
+ return length > min_input_length and length < max_input_length
623
+
624
+ # filter data that is shorter than min_input_length
625
+ vectorized_datasets = vectorized_datasets.filter(
626
+ is_audio_in_length_range,
627
+ num_proc=num_workers,
628
+ input_columns=["input_length"],
629
+ )
630
+
631
+ # 7. Next, we can prepare the training.
632
+ # Let's use word error rate (WER) as our evaluation metric,
633
+ # instantiate a data collator and the trainer
634
+
635
+ # Define evaluation metrics during training, *i.e.* word error rate, character error rate
636
+ eval_metrics = {metric: load_metric(metric) for metric in data_args.eval_metrics}
637
+
638
+ # for large datasets it is advised to run the preprocessing on a
639
+ # single machine first with ``args.preprocessing_only`` since there will mostly likely
640
+ # be a timeout when running the script in distributed mode.
641
+ # In a second step ``args.preprocessing_only`` can then be set to `False` to load the
642
+ # cached dataset
643
+ if data_args.preprocessing_only:
644
+ logger.info(f"Data preprocessing finished. Files cached at {vectorized_datasets.cache_files}")
645
+ return
646
+
647
+ def compute_metrics(pred):
648
+ pred_logits = pred.predictions
649
+ pred_ids = np.argmax(pred_logits, axis=-1)
650
+
651
+ pred.label_ids[pred.label_ids == -100] = tokenizer.pad_token_id
652
+
653
+ pred_str = tokenizer.batch_decode(pred_ids)
654
+ # we do not want to group tokens when computing the metrics
655
+ label_str = tokenizer.batch_decode(pred.label_ids, group_tokens=False)
656
+
657
+ metrics = {k: v.compute(predictions=pred_str, references=label_str) for k, v in eval_metrics.items()}
658
+
659
+ return metrics
660
+
661
+ # Now save everything to be able to create a single processor later
662
+ # make sure all processes wait until data is saved
663
+ with training_args.main_process_first():
664
+ if is_main_process(training_args.local_rank):
665
+ # save feature extractor, tokenizer and config
666
+ feature_extractor.save_pretrained(training_args.output_dir)
667
+ tokenizer.save_pretrained(training_args.output_dir)
668
+ config.save_pretrained(training_args.output_dir)
669
+
670
+ try:
671
+ processor = AutoProcessor.from_pretrained(training_args.output_dir)
672
+ except (OSError, KeyError):
673
+ warnings.warn(
674
+ "Loading a processor from a feature extractor config that does not"
675
+ " include a `processor_class` attribute is deprecated and will be removed in v5. Please add the following "
676
+ " attribute to your `preprocessor_config.json` file to suppress this warning: "
677
+ " `'processor_class': 'Wav2Vec2Processor'`",
678
+ FutureWarning,
679
+ )
680
+ processor = Wav2Vec2Processor.from_pretrained(training_args.output_dir)
681
+
682
+ # Instantiate custom data collator
683
+ data_collator = DataCollatorCTCWithPadding(processor=processor)
684
+
685
+ decay_parameters = get_parameter_names(model, [torch.nn.LayerNorm])
686
+ decay_parameters = [name for name in decay_parameters if "bias" not in name]
687
+ optimizer_grouped_parameters = [
688
+ {
689
+ "params": [p for n, p in model.named_parameters() if n in decay_parameters],
690
+ "weight_decay": training_args.weight_decay,
691
+ },
692
+ {
693
+ "params": [p for n, p in model.named_parameters() if n not in decay_parameters],
694
+ "weight_decay": 0.0,
695
+ },
696
+ ]
697
+ optimizer = bnb.optim.Adam8bit(
698
+ params=optimizer_grouped_parameters,
699
+ lr=training_args.learning_rate,
700
+ betas=(training_args.adam_beta1, training_args.adam_beta2),
701
+ eps=training_args.adam_epsilon,
702
+ )
703
+
704
+ optimizers = (optimizer, None)
705
+
706
+ # Initialize Trainer
707
+ trainer = Trainer(
708
+ model=model,
709
+ data_collator=data_collator,
710
+ args=training_args,
711
+ compute_metrics=compute_metrics,
712
+ train_dataset=vectorized_datasets["train"] if training_args.do_train else None,
713
+ eval_dataset=vectorized_datasets["eval"] if training_args.do_eval else None,
714
+ tokenizer=feature_extractor,
715
+ optimizers=optimizers,
716
+ )
717
+
718
+ # 8. Finally, we can start training
719
+
720
+ # Training
721
+ if training_args.do_train:
722
+ # use last checkpoint if exist
723
+ if last_checkpoint is not None:
724
+ checkpoint = last_checkpoint
725
+ elif os.path.isdir(model_args.model_name_or_path):
726
+ checkpoint = model_args.model_name_or_path
727
+ else:
728
+ checkpoint = None
729
+
730
+ train_result = trainer.train(resume_from_checkpoint=checkpoint)
731
+ trainer.save_model()
732
+
733
+ metrics = train_result.metrics
734
+ max_train_samples = (
735
+ data_args.max_train_samples
736
+ if data_args.max_train_samples is not None
737
+ else len(vectorized_datasets["train"])
738
+ )
739
+ metrics["train_samples"] = min(max_train_samples, len(vectorized_datasets["train"]))
740
+
741
+ trainer.log_metrics("train", metrics)
742
+ trainer.save_metrics("train", metrics)
743
+ trainer.save_state()
744
+
745
+ # Evaluation
746
+ results = {}
747
+ if training_args.do_eval:
748
+ logger.info("*** Evaluate ***")
749
+ metrics = trainer.evaluate()
750
+ max_eval_samples = (
751
+ data_args.max_eval_samples if data_args.max_eval_samples is not None else len(vectorized_datasets["eval"])
752
+ )
753
+ metrics["eval_samples"] = min(max_eval_samples, len(vectorized_datasets["eval"]))
754
+
755
+ trainer.log_metrics("eval", metrics)
756
+ trainer.save_metrics("eval", metrics)
757
+
758
+ # Write model card and (optionally) push to hub
759
+ config_name = data_args.dataset_config_name if data_args.dataset_config_name is not None else "na"
760
+ kwargs = {
761
+ "finetuned_from": model_args.model_name_or_path,
762
+ "tasks": "automatic-speech-recognition",
763
+ "tags": ["automatic-speech-recognition", data_args.dataset_name],
764
+ "dataset_args": (
765
+ f"Config: {config_name}, Training split: {data_args.train_split_name}, Eval split:"
766
+ f" {data_args.eval_split_name}"
767
+ ),
768
+ "dataset": f"{data_args.dataset_name.upper()} - {config_name.upper()}",
769
+ }
770
+ if "common_voice" in data_args.dataset_name:
771
+ kwargs["language"] = config_name
772
+
773
+ if training_args.push_to_hub:
774
+ trainer.push_to_hub(**kwargs)
775
+ else:
776
+ trainer.create_model_card(**kwargs)
777
+
778
+ return results
779
+
780
+
781
+ if __name__ == "__main__":
782
+ main()
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "pad_token": "[PAD]",
5
+ "unk_token": "[UNK]"
6
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "34": {
4
+ "content": "[UNK]",
5
+ "lstrip": true,
6
+ "normalized": false,
7
+ "rstrip": true,
8
+ "single_word": false,
9
+ "special": false
10
+ },
11
+ "35": {
12
+ "content": "[PAD]",
13
+ "lstrip": true,
14
+ "normalized": false,
15
+ "rstrip": true,
16
+ "single_word": false,
17
+ "special": false
18
+ },
19
+ "36": {
20
+ "content": "<s>",
21
+ "lstrip": false,
22
+ "normalized": true,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "37": {
28
+ "content": "</s>",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ }
35
+ },
36
+ "bos_token": "<s>",
37
+ "clean_up_tokenization_spaces": true,
38
+ "do_lower_case": false,
39
+ "eos_token": "</s>",
40
+ "model_max_length": 1000000000000000019884624838656,
41
+ "pad_token": "[PAD]",
42
+ "replace_word_delimiter_char": " ",
43
+ "target_lang": null,
44
+ "tokenizer_class": "Wav2Vec2CTCTokenizer",
45
+ "unk_token": "[UNK]",
46
+ "word_delimiter_token": "|"
47
+ }
train_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 6.0,
3
+ "train_loss": 0.0650978993577199,
4
+ "train_runtime": 137826.0599,
5
+ "train_samples": 661871,
6
+ "train_samples_per_second": 28.813,
7
+ "train_steps_per_second": 0.9
8
+ }
trainer_state.json ADDED
@@ -0,0 +1,525 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 5.999854956849663,
5
+ "eval_steps": 4000,
6
+ "global_step": 124098,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.19,
13
+ "learning_rate": 9.756372971128695e-05,
14
+ "loss": 0.7054,
15
+ "step": 4000
16
+ },
17
+ {
18
+ "epoch": 0.19,
19
+ "eval_cer": 0.02274243901983751,
20
+ "eval_loss": 0.10111288726329803,
21
+ "eval_runtime": 66.987,
22
+ "eval_samples_per_second": 61.131,
23
+ "eval_steps_per_second": 3.822,
24
+ "eval_wer": 0.08709714849302352,
25
+ "step": 4000
26
+ },
27
+ {
28
+ "epoch": 0.39,
29
+ "learning_rate": 9.431509853937514e-05,
30
+ "loss": 0.0856,
31
+ "step": 8000
32
+ },
33
+ {
34
+ "epoch": 0.39,
35
+ "eval_cer": 0.020731155298169313,
36
+ "eval_loss": 0.09945787489414215,
37
+ "eval_runtime": 67.6612,
38
+ "eval_samples_per_second": 60.522,
39
+ "eval_steps_per_second": 3.784,
40
+ "eval_wer": 0.07468163490267746,
41
+ "step": 8000
42
+ },
43
+ {
44
+ "epoch": 0.58,
45
+ "learning_rate": 9.106727972834653e-05,
46
+ "loss": 0.075,
47
+ "step": 12000
48
+ },
49
+ {
50
+ "epoch": 0.58,
51
+ "eval_cer": 0.018470211068126987,
52
+ "eval_loss": 0.08679623156785965,
53
+ "eval_runtime": 72.7557,
54
+ "eval_samples_per_second": 56.284,
55
+ "eval_steps_per_second": 3.519,
56
+ "eval_wer": 0.06474632320946828,
57
+ "step": 12000
58
+ },
59
+ {
60
+ "epoch": 0.77,
61
+ "learning_rate": 8.781864855643472e-05,
62
+ "loss": 0.0694,
63
+ "step": 16000
64
+ },
65
+ {
66
+ "epoch": 0.77,
67
+ "eval_cer": 0.01828354900579119,
68
+ "eval_loss": 0.08532032370567322,
69
+ "eval_runtime": 71.0749,
70
+ "eval_samples_per_second": 57.615,
71
+ "eval_steps_per_second": 3.602,
72
+ "eval_wer": 0.06190351869579091,
73
+ "step": 16000
74
+ },
75
+ {
76
+ "epoch": 0.97,
77
+ "learning_rate": 8.45708297454061e-05,
78
+ "loss": 0.0658,
79
+ "step": 20000
80
+ },
81
+ {
82
+ "epoch": 0.97,
83
+ "eval_cer": 0.017056245945933333,
84
+ "eval_loss": 0.0778348445892334,
85
+ "eval_runtime": 68.8966,
86
+ "eval_samples_per_second": 59.437,
87
+ "eval_steps_per_second": 3.716,
88
+ "eval_wer": 0.057262205204072755,
89
+ "step": 20000
90
+ },
91
+ {
92
+ "epoch": 1.16,
93
+ "learning_rate": 8.13230109343775e-05,
94
+ "loss": 0.0589,
95
+ "step": 24000
96
+ },
97
+ {
98
+ "epoch": 1.16,
99
+ "eval_cer": 0.016645589408794584,
100
+ "eval_loss": 0.08211962133646011,
101
+ "eval_runtime": 71.5048,
102
+ "eval_samples_per_second": 57.269,
103
+ "eval_steps_per_second": 3.58,
104
+ "eval_wer": 0.05463696226031967,
105
+ "step": 24000
106
+ },
107
+ {
108
+ "epoch": 1.35,
109
+ "learning_rate": 7.807437976246568e-05,
110
+ "loss": 0.0572,
111
+ "step": 28000
112
+ },
113
+ {
114
+ "epoch": 1.35,
115
+ "eval_cer": 0.0169955807756742,
116
+ "eval_loss": 0.08269500732421875,
117
+ "eval_runtime": 64.9267,
118
+ "eval_samples_per_second": 63.071,
119
+ "eval_steps_per_second": 3.943,
120
+ "eval_wer": 0.05579729063324921,
121
+ "step": 28000
122
+ },
123
+ {
124
+ "epoch": 1.55,
125
+ "learning_rate": 7.482656095143708e-05,
126
+ "loss": 0.0551,
127
+ "step": 32000
128
+ },
129
+ {
130
+ "epoch": 1.55,
131
+ "eval_cer": 0.016853250953143155,
132
+ "eval_loss": 0.08304612338542938,
133
+ "eval_runtime": 67.5544,
134
+ "eval_samples_per_second": 60.618,
135
+ "eval_steps_per_second": 3.79,
136
+ "eval_wer": 0.05333159284077394,
137
+ "step": 32000
138
+ },
139
+ {
140
+ "epoch": 1.74,
141
+ "learning_rate": 7.157874214040847e-05,
142
+ "loss": 0.054,
143
+ "step": 36000
144
+ },
145
+ {
146
+ "epoch": 1.74,
147
+ "eval_cer": 0.016157934770942316,
148
+ "eval_loss": 0.0788031816482544,
149
+ "eval_runtime": 68.7321,
150
+ "eval_samples_per_second": 59.579,
151
+ "eval_steps_per_second": 3.725,
152
+ "eval_wer": 0.05122849766483915,
153
+ "step": 36000
154
+ },
155
+ {
156
+ "epoch": 1.93,
157
+ "learning_rate": 6.832929860761345e-05,
158
+ "loss": 0.0524,
159
+ "step": 40000
160
+ },
161
+ {
162
+ "epoch": 1.93,
163
+ "eval_cer": 0.015562949447246968,
164
+ "eval_loss": 0.07834739238023758,
165
+ "eval_runtime": 66.4802,
166
+ "eval_samples_per_second": 61.597,
167
+ "eval_steps_per_second": 3.851,
168
+ "eval_wer": 0.04893684912830331,
169
+ "step": 40000
170
+ },
171
+ {
172
+ "epoch": 2.13,
173
+ "learning_rate": 6.508147979658484e-05,
174
+ "loss": 0.048,
175
+ "step": 44000
176
+ },
177
+ {
178
+ "epoch": 2.13,
179
+ "eval_cer": 0.016024938051528062,
180
+ "eval_loss": 0.08605939149856567,
181
+ "eval_runtime": 68.4968,
182
+ "eval_samples_per_second": 59.784,
183
+ "eval_steps_per_second": 3.737,
184
+ "eval_wer": 0.04918341890755084,
185
+ "step": 44000
186
+ },
187
+ {
188
+ "epoch": 2.32,
189
+ "learning_rate": 6.183284862467303e-05,
190
+ "loss": 0.046,
191
+ "step": 48000
192
+ },
193
+ {
194
+ "epoch": 2.32,
195
+ "eval_cer": 0.015420619624715923,
196
+ "eval_loss": 0.07625599950551987,
197
+ "eval_runtime": 73.2954,
198
+ "eval_samples_per_second": 55.87,
199
+ "eval_steps_per_second": 3.493,
200
+ "eval_wer": 0.049400980477475126,
201
+ "step": 48000
202
+ },
203
+ {
204
+ "epoch": 2.51,
205
+ "learning_rate": 5.8584217452761215e-05,
206
+ "loss": 0.0456,
207
+ "step": 52000
208
+ },
209
+ {
210
+ "epoch": 2.51,
211
+ "eval_cer": 0.015303955835756052,
212
+ "eval_loss": 0.08352649956941605,
213
+ "eval_runtime": 71.5001,
214
+ "eval_samples_per_second": 57.273,
215
+ "eval_steps_per_second": 3.58,
216
+ "eval_wer": 0.047094827836277664,
217
+ "step": 52000
218
+ },
219
+ {
220
+ "epoch": 2.71,
221
+ "learning_rate": 5.53363986417326e-05,
222
+ "loss": 0.0439,
223
+ "step": 56000
224
+ },
225
+ {
226
+ "epoch": 2.71,
227
+ "eval_cer": 0.015152292910108217,
228
+ "eval_loss": 0.07897598296403885,
229
+ "eval_runtime": 71.5932,
230
+ "eval_samples_per_second": 57.198,
231
+ "eval_steps_per_second": 3.576,
232
+ "eval_wer": 0.04686276216169176,
233
+ "step": 56000
234
+ },
235
+ {
236
+ "epoch": 2.9,
237
+ "learning_rate": 5.2088579830704e-05,
238
+ "loss": 0.0436,
239
+ "step": 60000
240
+ },
241
+ {
242
+ "epoch": 2.9,
243
+ "eval_cer": 0.0155349501378966,
244
+ "eval_loss": 0.08321597427129745,
245
+ "eval_runtime": 69.796,
246
+ "eval_samples_per_second": 58.671,
247
+ "eval_steps_per_second": 3.668,
248
+ "eval_wer": 0.047196356568909,
249
+ "step": 60000
250
+ },
251
+ {
252
+ "epoch": 3.09,
253
+ "learning_rate": 4.8840761019675384e-05,
254
+ "loss": 0.0406,
255
+ "step": 64000
256
+ },
257
+ {
258
+ "epoch": 3.09,
259
+ "eval_cer": 0.014837300679916562,
260
+ "eval_loss": 0.08103086799383163,
261
+ "eval_runtime": 69.1811,
262
+ "eval_samples_per_second": 59.192,
263
+ "eval_steps_per_second": 3.7,
264
+ "eval_wer": 0.04416499869463058,
265
+ "step": 64000
266
+ },
267
+ {
268
+ "epoch": 3.29,
269
+ "learning_rate": 4.559212984776357e-05,
270
+ "loss": 0.0386,
271
+ "step": 68000
272
+ },
273
+ {
274
+ "epoch": 3.29,
275
+ "eval_cer": 0.014624972584009594,
276
+ "eval_loss": 0.08100830018520355,
277
+ "eval_runtime": 72.8594,
278
+ "eval_samples_per_second": 56.204,
279
+ "eval_steps_per_second": 3.514,
280
+ "eval_wer": 0.043628346822150665,
281
+ "step": 68000
282
+ },
283
+ {
284
+ "epoch": 3.48,
285
+ "learning_rate": 4.234349867585176e-05,
286
+ "loss": 0.038,
287
+ "step": 72000
288
+ },
289
+ {
290
+ "epoch": 3.48,
291
+ "eval_cer": 0.014267981389792385,
292
+ "eval_loss": 0.07782719284296036,
293
+ "eval_runtime": 73.706,
294
+ "eval_samples_per_second": 55.559,
295
+ "eval_steps_per_second": 3.473,
296
+ "eval_wer": 0.04301917442636266,
297
+ "step": 72000
298
+ },
299
+ {
300
+ "epoch": 3.67,
301
+ "learning_rate": 3.909567986482315e-05,
302
+ "loss": 0.0373,
303
+ "step": 76000
304
+ },
305
+ {
306
+ "epoch": 3.67,
307
+ "eval_cer": 0.014431310694336206,
308
+ "eval_loss": 0.07849407941102982,
309
+ "eval_runtime": 74.4035,
310
+ "eval_samples_per_second": 55.038,
311
+ "eval_steps_per_second": 3.441,
312
+ "eval_wer": 0.042975662112377806,
313
+ "step": 76000
314
+ },
315
+ {
316
+ "epoch": 3.87,
317
+ "learning_rate": 3.584786105379454e-05,
318
+ "loss": 0.0363,
319
+ "step": 80000
320
+ },
321
+ {
322
+ "epoch": 3.87,
323
+ "eval_cer": 0.014375312075635468,
324
+ "eval_loss": 0.07884030044078827,
325
+ "eval_runtime": 68.8676,
326
+ "eval_samples_per_second": 59.462,
327
+ "eval_steps_per_second": 3.717,
328
+ "eval_wer": 0.042119919937342265,
329
+ "step": 80000
330
+ },
331
+ {
332
+ "epoch": 4.06,
333
+ "learning_rate": 3.259922988188273e-05,
334
+ "loss": 0.0348,
335
+ "step": 84000
336
+ },
337
+ {
338
+ "epoch": 4.06,
339
+ "eval_cer": 0.01435431259362269,
340
+ "eval_loss": 0.08232194930315018,
341
+ "eval_runtime": 67.1145,
342
+ "eval_samples_per_second": 61.015,
343
+ "eval_steps_per_second": 3.814,
344
+ "eval_wer": 0.04232297740260494,
345
+ "step": 84000
346
+ },
347
+ {
348
+ "epoch": 4.25,
349
+ "learning_rate": 2.935059870997092e-05,
350
+ "loss": 0.0323,
351
+ "step": 88000
352
+ },
353
+ {
354
+ "epoch": 4.25,
355
+ "eval_cer": 0.014316980181155532,
356
+ "eval_loss": 0.08194055408239365,
357
+ "eval_runtime": 76.1231,
358
+ "eval_samples_per_second": 53.794,
359
+ "eval_steps_per_second": 3.363,
360
+ "eval_wer": 0.04068401357584196,
361
+ "step": 88000
362
+ },
363
+ {
364
+ "epoch": 4.45,
365
+ "learning_rate": 2.610277989894231e-05,
366
+ "loss": 0.0319,
367
+ "step": 92000
368
+ },
369
+ {
370
+ "epoch": 4.45,
371
+ "eval_cer": 0.014167650531286895,
372
+ "eval_loss": 0.08085062354803085,
373
+ "eval_runtime": 74.2762,
374
+ "eval_samples_per_second": 55.132,
375
+ "eval_steps_per_second": 3.447,
376
+ "eval_wer": 0.041032112087720826,
377
+ "step": 92000
378
+ },
379
+ {
380
+ "epoch": 4.64,
381
+ "learning_rate": 2.2854148727030496e-05,
382
+ "loss": 0.0314,
383
+ "step": 96000
384
+ },
385
+ {
386
+ "epoch": 4.64,
387
+ "eval_cer": 0.01383399209486166,
388
+ "eval_loss": 0.08210451155900955,
389
+ "eval_runtime": 73.1195,
390
+ "eval_samples_per_second": 56.004,
391
+ "eval_steps_per_second": 3.501,
392
+ "eval_wer": 0.040045832970730715,
393
+ "step": 96000
394
+ },
395
+ {
396
+ "epoch": 4.83,
397
+ "learning_rate": 1.9606329916001885e-05,
398
+ "loss": 0.0306,
399
+ "step": 100000
400
+ },
401
+ {
402
+ "epoch": 4.83,
403
+ "eval_cer": 0.013700995375447406,
404
+ "eval_loss": 0.08130906522274017,
405
+ "eval_runtime": 70.4204,
406
+ "eval_samples_per_second": 58.151,
407
+ "eval_steps_per_second": 3.635,
408
+ "eval_wer": 0.03885649638847794,
409
+ "step": 100000
410
+ },
411
+ {
412
+ "epoch": 5.03,
413
+ "learning_rate": 1.6358511104973274e-05,
414
+ "loss": 0.0295,
415
+ "step": 104000
416
+ },
417
+ {
418
+ "epoch": 5.03,
419
+ "eval_cer": 0.013115343154868847,
420
+ "eval_loss": 0.0819702297449112,
421
+ "eval_runtime": 67.1904,
422
+ "eval_samples_per_second": 60.946,
423
+ "eval_steps_per_second": 3.81,
424
+ "eval_wer": 0.037710672120210016,
425
+ "step": 104000
426
+ },
427
+ {
428
+ "epoch": 5.22,
429
+ "learning_rate": 1.3109879933061465e-05,
430
+ "loss": 0.0275,
431
+ "step": 108000
432
+ },
433
+ {
434
+ "epoch": 5.22,
435
+ "eval_cer": 0.013700995375447406,
436
+ "eval_loss": 0.08659966289997101,
437
+ "eval_runtime": 75.5877,
438
+ "eval_samples_per_second": 54.176,
439
+ "eval_steps_per_second": 3.387,
440
+ "eval_wer": 0.037826704957502975,
441
+ "step": 108000
442
+ },
443
+ {
444
+ "epoch": 5.41,
445
+ "learning_rate": 9.862061122032852e-06,
446
+ "loss": 0.0267,
447
+ "step": 112000
448
+ },
449
+ {
450
+ "epoch": 5.41,
451
+ "eval_cer": 0.013351004008567788,
452
+ "eval_loss": 0.08306384831666946,
453
+ "eval_runtime": 71.1622,
454
+ "eval_samples_per_second": 57.545,
455
+ "eval_steps_per_second": 3.597,
456
+ "eval_wer": 0.03755112696893221,
457
+ "step": 112000
458
+ },
459
+ {
460
+ "epoch": 5.61,
461
+ "learning_rate": 6.6134299501210415e-06,
462
+ "loss": 0.0264,
463
+ "step": 116000
464
+ },
465
+ {
466
+ "epoch": 5.61,
467
+ "eval_cer": 0.013194674531361559,
468
+ "eval_loss": 0.08454854041337967,
469
+ "eval_runtime": 69.2173,
470
+ "eval_samples_per_second": 59.162,
471
+ "eval_steps_per_second": 3.698,
472
+ "eval_wer": 0.03691294636382096,
473
+ "step": 116000
474
+ },
475
+ {
476
+ "epoch": 5.8,
477
+ "learning_rate": 3.364798778209232e-06,
478
+ "loss": 0.0258,
479
+ "step": 120000
480
+ },
481
+ {
482
+ "epoch": 5.8,
483
+ "eval_cer": 0.013325337974996616,
484
+ "eval_loss": 0.08589179813861847,
485
+ "eval_runtime": 73.5677,
486
+ "eval_samples_per_second": 55.663,
487
+ "eval_steps_per_second": 3.48,
488
+ "eval_wer": 0.037028979201113914,
489
+ "step": 120000
490
+ },
491
+ {
492
+ "epoch": 6.0,
493
+ "learning_rate": 1.1616760629742156e-07,
494
+ "loss": 0.0254,
495
+ "step": 124000
496
+ },
497
+ {
498
+ "epoch": 6.0,
499
+ "eval_cer": 0.013243673322724706,
500
+ "eval_loss": 0.0846036821603775,
501
+ "eval_runtime": 67.6027,
502
+ "eval_samples_per_second": 60.575,
503
+ "eval_steps_per_second": 3.787,
504
+ "eval_wer": 0.03666637658457343,
505
+ "step": 124000
506
+ },
507
+ {
508
+ "epoch": 6.0,
509
+ "step": 124098,
510
+ "total_flos": 8.637354948645209e+20,
511
+ "train_loss": 0.0650978993577199,
512
+ "train_runtime": 137826.0599,
513
+ "train_samples_per_second": 28.813,
514
+ "train_steps_per_second": 0.9
515
+ }
516
+ ],
517
+ "logging_steps": 4000,
518
+ "max_steps": 124098,
519
+ "num_input_tokens_seen": 0,
520
+ "num_train_epochs": 6,
521
+ "save_steps": 500,
522
+ "total_flos": 8.637354948645209e+20,
523
+ "trial_name": null,
524
+ "trial_params": null
525
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0cc3aee957fc10a03e8a751b8a3885b4e2923a93e1274aab78dfbedc4c85271d
3
+ size 4600
vocab.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "[PAD]": 35,
3
+ "[UNK]": 34,
4
+ "a": 1,
5
+ "b": 2,
6
+ "c": 3,
7
+ "d": 4,
8
+ "e": 5,
9
+ "f": 6,
10
+ "g": 7,
11
+ "h": 8,
12
+ "i": 9,
13
+ "j": 10,
14
+ "k": 11,
15
+ "l": 12,
16
+ "m": 13,
17
+ "n": 14,
18
+ "o": 15,
19
+ "p": 16,
20
+ "q": 17,
21
+ "r": 18,
22
+ "s": 19,
23
+ "t": 20,
24
+ "u": 21,
25
+ "v": 22,
26
+ "w": 23,
27
+ "x": 24,
28
+ "y": 25,
29
+ "z": 26,
30
+ "|": 0,
31
+ "á": 27,
32
+ "é": 28,
33
+ "í": 29,
34
+ "ñ": 30,
35
+ "ó": 31,
36
+ "ú": 32,
37
+ "ü": 33
38
+ }