class_docstr: Base class for encoder decoder CTC-based models.
class_docstr_tok: ["Base","class","for","encoder","decoder","CTC-based","models","."]
docstr: Forward pass of the model.
  Args:
      input_signal: Tensor that represents a batch of raw audio signals,
          of shape [B, T]. T here represents timesteps, with 1 second of audio represented as
          `self.sample_rate` number of floating point values.
      input_signal_length: Vector of length B, that contains the individual lengths of the audio
          sequences.
      processed_signal: Tensor that represents a batch of processed audio signals,
          of shape (B, D, T) that has undergone processing via some DALI preprocessor.
      processed_signal_length: Vector of length B, that contains the individual lengths of the
          processed audio sequences.
  Returns:
      A tuple of 3 elements -
      1) The log probabilities tensor of shape [B, T, D].
      2) The lengths of the acoustic sequence after propagation through the encoder, of shape [B].
      3) The greedy token predictions of the model of shape [B, T] (via argmax)
docstr_tok: ["Forward","pass","of","the","model",".","Args",":","input_signal",":","Tensor","that","represents","a","batch","of","raw","audio","signals",",","of","shape","[","B",",","T","]",".","T","here","represents","timesteps",",","with","1","second","of","audio","represented","as","`","self.sample_rate","`","number","of","floating","point","values",".","input_signal_length",":","Vector","of","length","B",",","that","contains","the","individual","lengths","of","the","audio","sequences",".","processed_signal",":","Tensor","that","represents","a","batch","of","processed","audio","signals",",","of","shape","(","B",",","D",",","T",")","that","has","undergone","processing","via","some","DALI","preprocessor",".","processed_signal_length",":","Vector","of","length","B",",","that","contains","the","individual","lengths","of","the","processed","audio","sequences",".","Returns",":","A","tuple","of","3","elements","-","1",")","The","log","probabilities","tensor","of","shape","[","B",",","T",",","D","]",".","2",")","The","lengths","of","the","acoustic","sequence","after","propagation","through","the","encoder",",","of","shape","[","B","]",".","3",")","The","greedy","token","predictions","of","the","model","of","shape","[","B",",","T","]","(","via","argmax",")"]
code: def forward(
      self,
      input_signal=None,
      input_signal_length=None,
      processed_signal=None,
      processed_signal_length=None,
      transcript=None,
      transcript_length=None,
  ):
      """
      Forward pass of the model.
      Args:
          input_signal: Tensor that represents a batch of raw audio signals,
              of shape [B, T]. T here represents timesteps, with 1 second of audio represented as
              `self.sample_rate` number of floating point values.
          input_signal_length: Vector of length B, that contains the individual lengths of the audio
              sequences.
          processed_signal: Tensor that represents a batch of processed audio signals,
              of shape (B, D, T) that has undergone processing via some DALI preprocessor.
          processed_signal_length: Vector of length B, that contains the individual lengths of the
              processed audio sequences.
      Returns:
          A tuple of 3 elements -
          1) The log probabilities tensor of shape [B, T, D].
          2) The lengths of the acoustic sequence after propagation through the encoder, of shape [B].
          3) The greedy token predictions of the model of shape [B, T] (via argmax)
      """
      has_input_signal = (
          input_signal is not None and input_signal_length is not None
      )
      has_processed_signal = (
          processed_signal is not None
          and processed_signal_length is not None
      )
      if (has_input_signal ^ has_processed_signal) == False:
          raise ValueError(
              f"{self} Arguments ``input_signal`` and ``input_signal_length`` are mutually exclusive "
              " with ``processed_signal`` and ``processed_signal_len`` arguments."
          )
  
      if not has_processed_signal:
          processed_signal, processed_signal_length = self.preprocessor(
              input_signal=input_signal, length=input_signal_length
          )
  
      if self.spec_augmentation is not None and self.training:
          processed_signal = self.spec_augmentation(
              input_spec=processed_signal,
              length=processed_signal_length,
          )
  
      encoded, encoded_len = self.encoder(
          audio_signal=processed_signal, length=processed_signal_length
      )
  
      enc_states = encoded.permute(0, 2, 1)
      enc_states = self.adapter(enc_states)
      enc_mask = lens_to_mask(encoded_len, enc_states.shape[1]).to(
          enc_states.dtype
      )
      if self.use_transf_encoder:
          enc_states = self.transf_encoder(
              encoder_states=enc_states, encoder_mask=enc_mask
          )
  
      transf_log_probs = None
      if transcript is not None:
          dec_mask = lens_to_mask(
              transcript_length, transcript.shape[1]
          ).to(transcript.dtype)
          dec_states = self.transf_decoder(
              input_ids=transcript,
              decoder_mask=dec_mask,
              encoder_embeddings=enc_states,
              encoder_mask=enc_mask,
          )
          transf_log_probs = self.log_softmax(hidden_states=dec_states)
  
      return transf_log_probs, encoded_len, enc_states, enc_mask
  
imports: import itertools
  import json
  import os
  import tempfile
  from math import ceil
  from typing import Dict, List, Optional, Union
  import editdistance
  import torch
  import torch.distributed
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from tqdm.auto import tqdm
  from nemo.collections.asr.data import audio_to_text_dataset
  from nemo.collections.asr.data.audio_to_text_dali import DALIOutputs
  from nemo.collections.asr.data.audio_to_text_lhotse import LhotseSpeechToTextBpeDataset
  from nemo.collections.asr.models.asr_model import ASRModel, ExportableEncDecModel
  from nemo.collections.asr.parts.mixins import ASRBPEMixin
  from nemo.collections.asr.parts.utils.audio_utils import ChannelSelectorType
  from nemo.collections.common.data.lhotse import get_lhotse_dataloader_from_config
  from nemo.collections.common.losses import SmoothedCrossEntropyLoss
  from nemo.collections.common.metrics import GlobalAverageLossMetric
  from nemo.collections.common.parts import transformer_weights_init
  from nemo.core.classes.common import typecheck
  from nemo.core.neural_types import AudioSignal, ChannelType, LabelsType, LengthsType, LogprobsType, MaskType, NeuralType, SpectrogramType
  from nemo.utils import logging
label_desc: Use image node_id 9 for calling the EncDecTransfModelBPE obj's underlying member method code with example usage: obj.forward(input_signal, input_signal_length, processed_signal, processed_signal_length, transcript, transcript_length) and returns: transf_log_probs,  encoded_len,  enc_states,  enc_mask