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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ############################################################################
|
| 2 |
+
# Model: Streaming E2E Conformer-Transducer ASR
|
| 3 |
+
# Encoder: Conformer
|
| 4 |
+
# Decoder: LSTM + greedy search
|
| 5 |
+
# Tokens: BPE with unigram
|
| 6 |
+
# losses: Transducer + CTC (optional) + CE (optional)
|
| 7 |
+
# Training: Librispeech 960h
|
| 8 |
+
# Authors: Sylvain de Langen 2023, Titouan Parcollet 2023, Abdel HEBA, Mirco Ravanelli, Sung-Lin Yeh 2020
|
| 9 |
+
# ############################################################################
|
| 10 |
+
|
| 11 |
+
save_folder: !ref librispeech-streaming-conformer-transducer
|
| 12 |
+
|
| 13 |
+
# Training parameters
|
| 14 |
+
# To make Transformers converge, the global bath size should be large enough.
|
| 15 |
+
# The global batch size is computed as batch_size * n_gpus * grad_accumulation_factor.
|
| 16 |
+
# Empirically, we found that this value should be >= 128.
|
| 17 |
+
# Please, set your parameters accordingly.
|
| 18 |
+
number_of_epochs: 50
|
| 19 |
+
warmup_steps: 25000
|
| 20 |
+
num_workers: 4
|
| 21 |
+
batch_size_valid: 4
|
| 22 |
+
lr: 0.0008
|
| 23 |
+
weight_decay: 0.01
|
| 24 |
+
number_of_ctc_epochs: 40
|
| 25 |
+
ctc_weight: 0.3 # Multitask with CTC for the encoder (0.0 = disabled)
|
| 26 |
+
ce_weight: 0.0 # Multitask with CE for the decoder (0.0 = disabled)
|
| 27 |
+
max_grad_norm: 5.0
|
| 28 |
+
loss_reduction: 'batchmean'
|
| 29 |
+
precision: fp32 # bf16, fp16 or fp32
|
| 30 |
+
|
| 31 |
+
# The batch size is used if and only if dynamic batching is set to False
|
| 32 |
+
# Validation and testing are done with fixed batches and not dynamic batching.
|
| 33 |
+
batch_size: 8
|
| 34 |
+
grad_accumulation_factor: 4
|
| 35 |
+
sorting: ascending
|
| 36 |
+
avg_checkpoints: 10 # Number of checkpoints to average for evaluation
|
| 37 |
+
|
| 38 |
+
# Feature parameters
|
| 39 |
+
sample_rate: 16000
|
| 40 |
+
n_fft: 512
|
| 41 |
+
n_mels: 80
|
| 42 |
+
win_length: 32
|
| 43 |
+
|
| 44 |
+
# Streaming
|
| 45 |
+
streaming: True # controls all Dynamic Chunk Training & chunk size & left context mechanisms
|
| 46 |
+
|
| 47 |
+
# This setup works well for 3090 24GB GPU, adapt it to your needs.
|
| 48 |
+
# Adjust grad_accumulation_factor depending on the DDP node count (here 3)
|
| 49 |
+
# Or turn it off (but training speed will decrease)
|
| 50 |
+
dynamic_batching: True
|
| 51 |
+
max_batch_len: 250
|
| 52 |
+
max_batch_len_val: 50 # we reduce it as the beam is much wider (VRAM)
|
| 53 |
+
num_bucket: 200
|
| 54 |
+
|
| 55 |
+
dynamic_batch_sampler:
|
| 56 |
+
max_batch_len: !ref <max_batch_len>
|
| 57 |
+
max_batch_len_val: !ref <max_batch_len_val>
|
| 58 |
+
num_buckets: !ref <num_bucket>
|
| 59 |
+
shuffle_ex: True # if true re-creates batches at each epoch shuffling examples.
|
| 60 |
+
batch_ordering: random
|
| 61 |
+
max_batch_ex: 256
|
| 62 |
+
|
| 63 |
+
# Model parameters
|
| 64 |
+
# Transformer
|
| 65 |
+
d_model: 512
|
| 66 |
+
joint_dim: 640
|
| 67 |
+
nhead: 8
|
| 68 |
+
num_encoder_layers: 12
|
| 69 |
+
num_decoder_layers: 0
|
| 70 |
+
d_ffn: 2048
|
| 71 |
+
transformer_dropout: 0.1
|
| 72 |
+
activation: !name:torch.nn.GELU
|
| 73 |
+
output_neurons: 1000
|
| 74 |
+
dec_dim: 512
|
| 75 |
+
dec_emb_dropout: 0.2
|
| 76 |
+
dec_dropout: 0.1
|
| 77 |
+
|
| 78 |
+
# Decoding parameters
|
| 79 |
+
blank_index: 0
|
| 80 |
+
bos_index: 0
|
| 81 |
+
eos_index: 0
|
| 82 |
+
pad_index: 0
|
| 83 |
+
beam_size: 10
|
| 84 |
+
nbest: 1
|
| 85 |
+
# by default {state,expand}_beam = 2.3 as mention in paper
|
| 86 |
+
# https://arxiv.org/abs/1904.02619
|
| 87 |
+
state_beam: 2.3
|
| 88 |
+
expand_beam: 2.3
|
| 89 |
+
lm_weight: 0.50
|
| 90 |
+
|
| 91 |
+
epoch_counter: !new:speechbrain.utils.epoch_loop.EpochCounter
|
| 92 |
+
limit: !ref <number_of_epochs>
|
| 93 |
+
|
| 94 |
+
normalize: !new:speechbrain.processing.features.InputNormalization
|
| 95 |
+
norm_type: global
|
| 96 |
+
update_until_epoch: 4
|
| 97 |
+
|
| 98 |
+
compute_features: !new:speechbrain.lobes.features.Fbank
|
| 99 |
+
sample_rate: !ref <sample_rate>
|
| 100 |
+
n_fft: !ref <n_fft>
|
| 101 |
+
n_mels: !ref <n_mels>
|
| 102 |
+
win_length: !ref <win_length>
|
| 103 |
+
|
| 104 |
+
CNN: !new:speechbrain.lobes.models.convolution.ConvolutionFrontEnd
|
| 105 |
+
input_shape: (8, 10, 80)
|
| 106 |
+
num_blocks: 2
|
| 107 |
+
num_layers_per_block: 1
|
| 108 |
+
out_channels: (64, 32)
|
| 109 |
+
kernel_sizes: (3, 3)
|
| 110 |
+
strides: (2, 2)
|
| 111 |
+
residuals: (False, False)
|
| 112 |
+
|
| 113 |
+
Transformer: !new:speechbrain.lobes.models.transformer.TransformerASR.TransformerASR # yamllint disable-line rule:line-length
|
| 114 |
+
input_size: 640
|
| 115 |
+
tgt_vocab: !ref <output_neurons>
|
| 116 |
+
d_model: !ref <d_model>
|
| 117 |
+
nhead: !ref <nhead>
|
| 118 |
+
num_encoder_layers: !ref <num_encoder_layers>
|
| 119 |
+
num_decoder_layers: !ref <num_decoder_layers>
|
| 120 |
+
d_ffn: !ref <d_ffn>
|
| 121 |
+
dropout: !ref <transformer_dropout>
|
| 122 |
+
activation: !ref <activation>
|
| 123 |
+
encoder_module: conformer
|
| 124 |
+
attention_type: RelPosMHAXL
|
| 125 |
+
normalize_before: True
|
| 126 |
+
causal: False
|
| 127 |
+
|
| 128 |
+
# We must call an encoder wrapper so the decoder isn't run (we don't have any)
|
| 129 |
+
enc: !new:speechbrain.lobes.models.transformer.TransformerASR.EncoderWrapper
|
| 130 |
+
transformer: !ref <Transformer>
|
| 131 |
+
|
| 132 |
+
# For MTL CTC over the encoder
|
| 133 |
+
proj_ctc: !new:speechbrain.nnet.linear.Linear
|
| 134 |
+
input_size: !ref <joint_dim>
|
| 135 |
+
n_neurons: !ref <output_neurons>
|
| 136 |
+
|
| 137 |
+
# Define some projection layers to make sure that enc and dec
|
| 138 |
+
# output dim are the same before joining
|
| 139 |
+
proj_enc: !new:speechbrain.nnet.linear.Linear
|
| 140 |
+
input_size: !ref <d_model>
|
| 141 |
+
n_neurons: !ref <joint_dim>
|
| 142 |
+
bias: False
|
| 143 |
+
|
| 144 |
+
proj_dec: !new:speechbrain.nnet.linear.Linear
|
| 145 |
+
input_size: !ref <dec_dim>
|
| 146 |
+
n_neurons: !ref <joint_dim>
|
| 147 |
+
bias: False
|
| 148 |
+
|
| 149 |
+
# Uncomment for MTL with CTC
|
| 150 |
+
ctc_cost: !name:speechbrain.nnet.losses.ctc_loss
|
| 151 |
+
blank_index: !ref <blank_index>
|
| 152 |
+
reduction: !ref <loss_reduction>
|
| 153 |
+
|
| 154 |
+
emb: !new:speechbrain.nnet.embedding.Embedding
|
| 155 |
+
num_embeddings: !ref <output_neurons>
|
| 156 |
+
consider_as_one_hot: True
|
| 157 |
+
blank_id: !ref <blank_index>
|
| 158 |
+
|
| 159 |
+
dec: !new:speechbrain.nnet.RNN.LSTM
|
| 160 |
+
input_shape: [null, null, !ref <output_neurons> - 1]
|
| 161 |
+
hidden_size: !ref <dec_dim>
|
| 162 |
+
num_layers: 1
|
| 163 |
+
re_init: True
|
| 164 |
+
|
| 165 |
+
Tjoint: !new:speechbrain.nnet.transducer.transducer_joint.Transducer_joint
|
| 166 |
+
joint: sum # joint [sum | concat]
|
| 167 |
+
nonlinearity: !ref <activation>
|
| 168 |
+
|
| 169 |
+
transducer_lin: !new:speechbrain.nnet.linear.Linear
|
| 170 |
+
input_size: !ref <joint_dim>
|
| 171 |
+
n_neurons: !ref <output_neurons>
|
| 172 |
+
bias: False
|
| 173 |
+
|
| 174 |
+
log_softmax: !new:speechbrain.nnet.activations.Softmax
|
| 175 |
+
apply_log: True
|
| 176 |
+
|
| 177 |
+
# for MTL
|
| 178 |
+
# update model if any HEAD module is added
|
| 179 |
+
modules:
|
| 180 |
+
CNN: !ref <CNN>
|
| 181 |
+
enc: !ref <enc>
|
| 182 |
+
emb: !ref <emb>
|
| 183 |
+
dec: !ref <dec>
|
| 184 |
+
Tjoint: !ref <Tjoint>
|
| 185 |
+
transducer_lin: !ref <transducer_lin>
|
| 186 |
+
normalize: !ref <normalize>
|
| 187 |
+
proj_ctc: !ref <proj_ctc>
|
| 188 |
+
proj_dec: !ref <proj_dec>
|
| 189 |
+
proj_enc: !ref <proj_enc>
|
| 190 |
+
# dec_lin: !ref <dec_lin>
|
| 191 |
+
|
| 192 |
+
# for MTL
|
| 193 |
+
# update model if any HEAD module is added
|
| 194 |
+
model: !new:torch.nn.ModuleList
|
| 195 |
+
- [!ref <CNN>, !ref <enc>, !ref <emb>, !ref <dec>, !ref <proj_enc>, !ref <proj_dec>, !ref <proj_ctc>, !ref <transducer_lin>]
|
| 196 |
+
|
| 197 |
+
# Tokenizer initialization
|
| 198 |
+
tokenizer: !new:sentencepiece.SentencePieceProcessor
|
| 199 |
+
|
| 200 |
+
Greedysearcher: !new:speechbrain.decoders.transducer.TransducerBeamSearcher
|
| 201 |
+
decode_network_lst: [!ref <emb>, !ref <dec>, !ref <proj_dec>]
|
| 202 |
+
tjoint: !ref <Tjoint>
|
| 203 |
+
classifier_network: [!ref <transducer_lin>]
|
| 204 |
+
blank_id: !ref <blank_index>
|
| 205 |
+
beam_size: 1
|
| 206 |
+
nbest: 1
|
| 207 |
+
|
| 208 |
+
Beamsearcher: !new:speechbrain.decoders.transducer.TransducerBeamSearcher
|
| 209 |
+
decode_network_lst: [!ref <emb>, !ref <dec>, !ref <proj_dec>]
|
| 210 |
+
tjoint: !ref <Tjoint>
|
| 211 |
+
classifier_network: [!ref <transducer_lin>]
|
| 212 |
+
blank_id: !ref <blank_index>
|
| 213 |
+
beam_size: !ref <beam_size>
|
| 214 |
+
nbest: !ref <nbest>
|
| 215 |
+
# FIXME: when lm pretrained, use this
|
| 216 |
+
# lm_module: !ref <lm_model>
|
| 217 |
+
# lm_weight: !ref <lm_weight>
|
| 218 |
+
state_beam: !ref <state_beam>
|
| 219 |
+
expand_beam: !ref <expand_beam>
|
| 220 |
+
|
| 221 |
+
pretrainer: !new:speechbrain.utils.parameter_transfer.Pretrainer
|
| 222 |
+
collect_in: !ref <save_folder>
|
| 223 |
+
loadables:
|
| 224 |
+
model: !ref <model>
|
| 225 |
+
normalizer: !ref <normalize>
|
| 226 |
+
tokenizer: !ref <tokenizer>
|
| 227 |
+
|
| 228 |
+
# inference stuff
|
| 229 |
+
|
| 230 |
+
make_tokenizer_streaming_context: !name:speechbrain.tokenizers.SentencePiece.SentencePieceDecoderStreamingContext
|
| 231 |
+
tokenizer_decode_streaming: !name:speechbrain.tokenizers.SentencePiece.spm_decode_preserve_leading_space
|
| 232 |
+
|
| 233 |
+
fea_streaming_extractor: !new:speechbrain.lobes.features.StreamingFeatureWrapper
|
| 234 |
+
module: !new:speechbrain.lobes.models.convolution.ConformerFeatureExtractorWrapper
|
| 235 |
+
- !ref <compute_features>
|
| 236 |
+
- !ref <normalize>
|
| 237 |
+
- !ref <CNN>
|
| 238 |
+
# don't consider normalization as part of the input filter chain
|
| 239 |
+
properties: !!python/object/apply:speechbrain.utils.filter_analysis.stack_filter_properties
|
| 240 |
+
- [!ref <compute_features>, !ref <CNN>]
|
| 241 |
+
|