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EDED
|
| 2 |
+
HPARAMS_NEEDED: ["wav2vec_output_dim", "emb_size", "dec_neurons", "dec_layers", "output_neurons", "log_softmax", "tokenizer"]
|
| 3 |
+
# Modules Needed
|
| 4 |
+
MODULES_NEEDED: ["encoder_w2v2", "embedding", "ctc_lin", "seq_lin", "lm_model"]
|
| 5 |
+
|
| 6 |
+
# Pretrain folder (HuggingFace)
|
| 7 |
+
output_folder: !ref output_folder_seq2seq_cv_podcast_arhiv_augmentation
|
| 8 |
+
pretrained_path: Macedonian-ASR/wav2vec2-aed-macedonian-asr
|
| 9 |
+
# wav2vec2_hub: facebook/wav2vec2-large-xlsr-53
|
| 10 |
+
wav2vec2_hub: jonatasgrosman/wav2vec2-large-xlsr-53-russian
|
| 11 |
+
save_folder: !ref <output_folder>/save
|
| 12 |
+
wav2vec2_folder: !ref <save_folder>/wav2vec2_checkpoint
|
| 13 |
+
|
| 14 |
+
####################### Training Parameters ####################################
|
| 15 |
+
|
| 16 |
+
####################### Model Parameters #######################################
|
| 17 |
+
dropout: 0.15
|
| 18 |
+
wav2vec_output_dim: 1024
|
| 19 |
+
emb_size: 128
|
| 20 |
+
dec_neurons: 1024
|
| 21 |
+
dec_layers: 1
|
| 22 |
+
|
| 23 |
+
output_neurons: 1000
|
| 24 |
+
blank_index: 0
|
| 25 |
+
bos_index: 1
|
| 26 |
+
eos_index: 2
|
| 27 |
+
unk_index: 0
|
| 28 |
+
|
| 29 |
+
# Decoding parameters
|
| 30 |
+
min_decode_ratio: 0.0
|
| 31 |
+
max_decode_ratio: 1.0
|
| 32 |
+
valid_beam_size: 10
|
| 33 |
+
test_beam_size: 20
|
| 34 |
+
using_eos_threshold: True
|
| 35 |
+
eos_threshold: 1.5
|
| 36 |
+
using_max_attn_shift: False
|
| 37 |
+
max_attn_shift: 700
|
| 38 |
+
length_normalization: True
|
| 39 |
+
temperature: 1.0
|
| 40 |
+
temperature_lm: 1.4
|
| 41 |
+
# Scoring parameters
|
| 42 |
+
coverage_penalty: 1.5
|
| 43 |
+
lm_weight: 0.2
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# This is the RNNLM that is used according to the Huggingface repository
|
| 47 |
+
# NB: It has to match the pre-trained RNNLM!!
|
| 48 |
+
lm_model: !new:speechbrain.lobes.models.RNNLM.RNNLM
|
| 49 |
+
output_neurons: !ref <output_neurons>
|
| 50 |
+
embedding_dim: !ref <emb_size>
|
| 51 |
+
activation: !name:torch.nn.LeakyReLU
|
| 52 |
+
dropout: 0.0
|
| 53 |
+
rnn_layers: 3
|
| 54 |
+
rnn_neurons: 2048
|
| 55 |
+
dnn_blocks: 2
|
| 56 |
+
dnn_neurons: 1024
|
| 57 |
+
return_hidden: True # For inference
|
| 58 |
+
|
| 59 |
+
# Wav2vec2 encoder
|
| 60 |
+
encoder_w2v2: !new:speechbrain.lobes.models.huggingface_transformers.wav2vec2.Wav2Vec2
|
| 61 |
+
source: !ref <wav2vec2_hub>
|
| 62 |
+
output_norm: True
|
| 63 |
+
freeze: False
|
| 64 |
+
freeze_feature_extractor: True
|
| 65 |
+
save_path: !ref <wav2vec2_folder>
|
| 66 |
+
output_all_hiddens: False
|
| 67 |
+
|
| 68 |
+
embedding: !new:speechbrain.nnet.embedding.Embedding
|
| 69 |
+
num_embeddings: !ref <output_neurons>
|
| 70 |
+
embedding_dim: !ref <emb_size>
|
| 71 |
+
|
| 72 |
+
# Attention-based RNN decoder.
|
| 73 |
+
decoder: !new:speechbrain.nnet.RNN.AttentionalRNNDecoder
|
| 74 |
+
enc_dim: !ref <wav2vec_output_dim>
|
| 75 |
+
input_size: !ref <emb_size>
|
| 76 |
+
rnn_type: gru
|
| 77 |
+
attn_type: location
|
| 78 |
+
hidden_size: !ref <dec_neurons>
|
| 79 |
+
attn_dim: 512
|
| 80 |
+
num_layers: !ref <dec_layers>
|
| 81 |
+
scaling: 1.0
|
| 82 |
+
channels: 10
|
| 83 |
+
kernel_size: 100
|
| 84 |
+
re_init: True
|
| 85 |
+
dropout: !ref <dropout>
|
| 86 |
+
|
| 87 |
+
ctc_lin: !new:speechbrain.nnet.linear.Linear
|
| 88 |
+
input_size: !ref <wav2vec_output_dim>
|
| 89 |
+
n_neurons: !ref <output_neurons>
|
| 90 |
+
|
| 91 |
+
seq_lin: !new:speechbrain.nnet.linear.Linear
|
| 92 |
+
input_size: !ref <dec_neurons>
|
| 93 |
+
n_neurons: !ref <output_neurons>
|
| 94 |
+
|
| 95 |
+
log_softmax: !new:speechbrain.nnet.activations.Softmax
|
| 96 |
+
apply_log: True
|
| 97 |
+
|
| 98 |
+
tokenizer: !new:sentencepiece.SentencePieceProcessor
|
| 99 |
+
model_file: 1000_unigram.model
|
| 100 |
+
|
| 101 |
+
modules:
|
| 102 |
+
encoder_w2v2: !ref <encoder_w2v2>
|
| 103 |
+
embedding: !ref <embedding>
|
| 104 |
+
decoder: !ref <decoder>
|
| 105 |
+
ctc_lin: !ref <ctc_lin>
|
| 106 |
+
seq_lin: !ref <seq_lin>
|
| 107 |
+
lm_model: !ref <lm_model>
|
| 108 |
+
|
| 109 |
+
model: !new:torch.nn.ModuleList
|
| 110 |
+
- [!ref <encoder_w2v2>, !ref <embedding>, !ref <decoder>, !ref <ctc_lin>, !ref <seq_lin>]
|
| 111 |
+
|
| 112 |
+
############################## Decoding & optimiser ############################
|
| 113 |
+
coverage_scorer: !new:speechbrain.decoders.scorer.CoverageScorer
|
| 114 |
+
vocab_size: !ref <output_neurons>
|
| 115 |
+
|
| 116 |
+
rnnlm_scorer: !new:speechbrain.decoders.scorer.RNNLMScorer
|
| 117 |
+
language_model: !ref <lm_model>
|
| 118 |
+
temperature: !ref <temperature_lm>
|
| 119 |
+
|
| 120 |
+
scorer: !new:speechbrain.decoders.scorer.ScorerBuilder
|
| 121 |
+
full_scorers: [!ref <coverage_scorer>]
|
| 122 |
+
weights:
|
| 123 |
+
coverage: !ref <coverage_penalty>
|
| 124 |
+
|
| 125 |
+
scorer_lm: !new:speechbrain.decoders.scorer.ScorerBuilder
|
| 126 |
+
full_scorers: [!ref <rnnlm_scorer>,
|
| 127 |
+
!ref <coverage_scorer>]
|
| 128 |
+
weights:
|
| 129 |
+
rnnlm: !ref <lm_weight>
|
| 130 |
+
coverage: !ref <coverage_penalty>
|
| 131 |
+
|
| 132 |
+
test_search: !new:speechbrain.decoders.S2SRNNBeamSearcher
|
| 133 |
+
embedding: !ref <embedding>
|
| 134 |
+
decoder: !ref <decoder>
|
| 135 |
+
linear: !ref <seq_lin>
|
| 136 |
+
bos_index: !ref <bos_index>
|
| 137 |
+
eos_index: !ref <eos_index>
|
| 138 |
+
min_decode_ratio: !ref <min_decode_ratio>
|
| 139 |
+
max_decode_ratio: !ref <max_decode_ratio>
|
| 140 |
+
beam_size: !ref <test_beam_size>
|
| 141 |
+
eos_threshold: !ref <eos_threshold>
|
| 142 |
+
using_max_attn_shift: !ref <using_max_attn_shift>
|
| 143 |
+
max_attn_shift: !ref <max_attn_shift>
|
| 144 |
+
temperature: !ref <temperature>
|
| 145 |
+
scorer: !ref <scorer_lm>
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
############################## Logging and Pretrainer ##########################
|
| 149 |
+
|
| 150 |
+
pretrainer: !new:speechbrain.utils.parameter_transfer.Pretrainer
|
| 151 |
+
loadables:
|
| 152 |
+
model: !ref <model>
|
| 153 |
+
lm: !ref <lm_model>
|
| 154 |
+
paths:
|
| 155 |
+
model: !ref <pretrained_path>/model.ckpt
|
| 156 |
+
lm: !ref <pretrained_path>/lm.ckpt
|