# ############################################################################ # Model: E2E ASR with Transformer + wav2vec2 # Encoder: wav2vec Encoder # Decoder: Transformer Decoder + (CTC/ATT joint) beamsearch # Tokens: BPE with unigram # losses: CTC + KLdiv (Label Smoothing loss) # Training: AISHELL-1 # Authors: Jianyuan Zhong, Titouan Parcollet, Mirco Ravanelli # ############################################################################ # Feature parameters sample_rate: 16000 n_fft: 400 n_mels: 80 wav2vec2_hub: facebook/wav2vec2-large-100k-voxpopuli ####################### Model parameters ########################### # Transformer d_model: 256 nhead: 4 num_encoder_layers: 2 num_decoder_layers: 6 d_ffn: 2048 transformer_dropout: 0.1 activation: !name:torch.nn.GELU output_neurons: 5000 vocab_size: 5000 # Outputs blank_index: 0 label_smoothing: 0.1 pad_index: 0 bos_index: 1 eos_index: 2 unk_index: 0 # Decoding parameters min_decode_ratio: 0.0 max_decode_ratio: 1.0 valid_search_interval: 10 valid_beam_size: 10 test_beam_size: 10 ctc_weight_decode: 0.40 ############################## models ################################ wav2vec2: !new:speechbrain.lobes.models.huggingface_wav2vec.HuggingFaceWav2Vec2 source: !ref output_norm: True freeze: True save_path: model_checkpoints Transformer: !new:speechbrain.lobes.models.transformer.TransformerASR.TransformerASR # yamllint disable-line rule:line-length input_size: 1024 tgt_vocab: !ref d_model: !ref nhead: !ref num_encoder_layers: !ref num_decoder_layers: !ref d_ffn: !ref dropout: !ref activation: !ref normalize_before: True ctc_lin: !new:speechbrain.nnet.linear.Linear input_size: !ref n_neurons: !ref seq_lin: !new:speechbrain.nnet.linear.Linear input_size: !ref n_neurons: !ref tokenizer: !new:sentencepiece.SentencePieceProcessor asr_model: !new:torch.nn.ModuleList - [!ref , !ref , !ref ] # Here, we extract the encoder from the Transformer model Tencoder: !new:speechbrain.lobes.models.transformer.TransformerASR.EncoderWrapper transformer: !ref # We compose the inference (encoder) pipeline. encoder: !new:speechbrain.nnet.containers.LengthsCapableSequential input_shape: [null, null, !ref ] wav2vec2: !ref transformer_encoder: !ref ctc_scorer: !new:speechbrain.decoders.scorer.CTCScorer eos_index: !ref blank_index: !ref ctc_fc: !ref scorer: !new:speechbrain.decoders.scorer.ScorerBuilder full_scorers: [!ref ] weights: ctc: !ref decoder: !new:speechbrain.decoders.S2STransformerBeamSearcher modules: [!ref , !ref ] bos_index: !ref eos_index: !ref min_decode_ratio: !ref max_decode_ratio: !ref beam_size: !ref using_eos_threshold: False length_normalization: True scorer: !ref modules: encoder: !ref decoder: !ref log_softmax: !new:torch.nn.LogSoftmax dim: -1 pretrainer: !new:speechbrain.utils.parameter_transfer.Pretrainer loadables: wav2vec2: !ref model: !ref tokenizer: !ref