datasetsANDmodels/speechbrain-stt
02
1# ############################################################################2# Model: Streaming E2E Conformer-Transducer ASR3# Encoder: Conformer4# Decoder: LSTM + greedy search5# Tokens: BPE with unigram6# losses: Transducer + CTC (optional) + CE (optional)7# Training: Librispeech 960h8# Authors: Sylvain de Langen 2023, Titouan Parcollet 20239# ############################################################################10 11save_folder: !ref librispeech-streaming-conformer-transducer12 13# Feature parameters14sample_rate: 1600015n_fft: 51216n_mels: 8017win_length: 3218 19# Streaming20streaming: True # controls all Dynamic Chunk Training & chunk size & left context mechanisms21 22# Model parameters23# Transformer24d_model: 51225joint_dim: 64026nhead: 827num_encoder_layers: 1228num_decoder_layers: 029d_ffn: 204830transformer_dropout: 0.131activation: !name:torch.nn.GELU32output_neurons: 100033dec_dim: 51234dec_emb_dropout: 0.235dec_dropout: 0.136 37# Decoding parameters38blank_index: 039bos_index: 040eos_index: 041pad_index: 042beam_size: 1043nbest: 144# by default {state,expand}_beam = 2.3 as mention in paper45# https://arxiv.org/abs/1904.0261946state_beam: 2.347expand_beam: 2.348lm_weight: 0.5049 50normalize: !new:speechbrain.processing.features.InputNormalization51 norm_type: global52 update_until_epoch: 453 54compute_features: !new:speechbrain.lobes.features.Fbank55 sample_rate: !ref <sample_rate>56 n_fft: !ref <n_fft>57 n_mels: !ref <n_mels>58 win_length: !ref <win_length>59 60CNN: !new:speechbrain.lobes.models.convolution.ConvolutionFrontEnd61 input_shape: (8, 10, 80)62 num_blocks: 263 num_layers_per_block: 164 out_channels: (64, 32)65 kernel_sizes: (3, 3)66 strides: (2, 2)67 residuals: (False, False)68 69Transformer: !new:speechbrain.lobes.models.transformer.TransformerASR.TransformerASR # yamllint disable-line rule:line-length70 input_size: 64071 tgt_vocab: !ref <output_neurons>72 d_model: !ref <d_model>73 nhead: !ref <nhead>74 num_encoder_layers: !ref <num_encoder_layers>75 num_decoder_layers: !ref <num_decoder_layers>76 d_ffn: !ref <d_ffn>77 dropout: !ref <transformer_dropout>78 activation: !ref <activation>79 encoder_module: conformer80 attention_type: RelPosMHAXL81 normalize_before: True82 causal: False83 84# We must call an encoder wrapper so the decoder isn't run (we don't have any)85enc: !new:speechbrain.lobes.models.transformer.TransformerASR.EncoderWrapper86 transformer: !ref <Transformer>87 88# For MTL CTC over the encoder89proj_ctc: !new:speechbrain.nnet.linear.Linear90 input_size: !ref <joint_dim>91 n_neurons: !ref <output_neurons>92 93# Define some projection layers to make sure that enc and dec94# output dim are the same before joining95proj_enc: !new:speechbrain.nnet.linear.Linear96 input_size: !ref <d_model>97 n_neurons: !ref <joint_dim>98 bias: False99 100proj_dec: !new:speechbrain.nnet.linear.Linear101 input_size: !ref <dec_dim>102 n_neurons: !ref <joint_dim>103 bias: False104 105emb: !new:speechbrain.nnet.embedding.Embedding106 num_embeddings: !ref <output_neurons>107 consider_as_one_hot: True108 blank_id: !ref <blank_index>109 110dec: !new:speechbrain.nnet.RNN.LSTM111 input_shape: [null, null, !ref <output_neurons> - 1]112 hidden_size: !ref <dec_dim>113 num_layers: 1114 re_init: True115 116Tjoint: !new:speechbrain.nnet.transducer.transducer_joint.Transducer_joint117 joint: sum # joint [sum | concat]118 nonlinearity: !ref <activation>119 120transducer_lin: !new:speechbrain.nnet.linear.Linear121 input_size: !ref <joint_dim>122 n_neurons: !ref <output_neurons>123 bias: False124 125modules:126 CNN: !ref <CNN>127 enc: !ref <enc>128 emb: !ref <emb>129 dec: !ref <dec>130 Tjoint: !ref <Tjoint>131 transducer_lin: !ref <transducer_lin>132 normalize: !ref <normalize>133 proj_ctc: !ref <proj_ctc>134 proj_dec: !ref <proj_dec>135 proj_enc: !ref <proj_enc>136 137model: !new:torch.nn.ModuleList138 - [!ref <CNN>, !ref <enc>, !ref <emb>, !ref <dec>, !ref <proj_enc>, !ref <proj_dec>, !ref <proj_ctc>, !ref <transducer_lin>]139 140# Tokenizer initialization141tokenizer: !new:sentencepiece.SentencePieceProcessor142 143Greedysearcher: !new:speechbrain.decoders.transducer.TransducerBeamSearcher144 decode_network_lst: [!ref <emb>, !ref <dec>, !ref <proj_dec>]145 tjoint: !ref <Tjoint>146 classifier_network: [!ref <transducer_lin>]147 blank_id: !ref <blank_index>148 beam_size: 1149 nbest: 1150 151Beamsearcher: !new:speechbrain.decoders.transducer.TransducerBeamSearcher152 decode_network_lst: [!ref <emb>, !ref <dec>, !ref <proj_dec>]153 tjoint: !ref <Tjoint>154 classifier_network: [!ref <transducer_lin>]155 blank_id: !ref <blank_index>156 beam_size: !ref <beam_size>157 nbest: !ref <nbest>158 # lm_module: !ref <lm_model>159 # lm_weight: !ref <lm_weight>160 state_beam: !ref <state_beam>161 expand_beam: !ref <expand_beam>162 163pretrainer: !new:speechbrain.utils.parameter_transfer.Pretrainer164 collect_in: !ref <save_folder>165 loadables:166 model: !ref <model>167 normalizer: !ref <normalize>168 tokenizer: !ref <tokenizer>169 170# inference stuff171 172make_tokenizer_streaming_context: !name:speechbrain.tokenizers.SentencePiece.SentencePieceDecoderStreamingContext173tokenizer_decode_streaming: !name:speechbrain.tokenizers.SentencePiece.spm_decode_preserve_leading_space174 175make_decoder_streaming_context: !name:speechbrain.decoders.transducer.TransducerGreedySearcherStreamingContext # default constructor176decoding_function: !name:speechbrain.decoders.transducer.TransducerBeamSearcher.transducer_greedy_decode_streaming177 - !ref <Greedysearcher> # self178 179fea_streaming_extractor: !new:speechbrain.lobes.features.StreamingFeatureWrapper180 module: !new:speechbrain.nnet.containers.LengthsCapableSequential181 - !ref <compute_features>182 - !ref <normalize>183 - !ref <CNN>184 # don't consider normalization as part of the input filter chain.185 # normalization will operate at chunk level, which mismatches training186 # somewhat, but does not appear to result in noticeable degradation.187 properties: !apply:speechbrain.utils.filter_analysis.stack_filter_properties188 - [!ref <compute_features>, !ref <CNN>]189 