docstr: Forward pass that uses both text and voice in either text conditioning mode or voice conditioning mode
  (actuated by `text_first`).
  
  speech_conditioning_input: MEL float tensor, (b,1024)
  text_inputs: long tensor, (b,t)
  text_lengths: long tensor, (b,)
  mel_inputs:  long tensor, (b,m)
  wav_lengths: long tensor, (b,)
  raw_mels: MEL float tensor (b,80,s)
  
  If return_attentions is specified, only logits are returned.
  If return_latent is specified, loss & logits are not computed or returned. Only the predicted latents are returned.
  If clip_inputs is True, the inputs will be clipped to the smallest input size across each input modality.
code: def forward(
      self,
      speech_conditioning_latent,
      text_inputs,
      text_lengths,
      mel_codes,
      wav_lengths,
      types=None,
      text_first=True,
      raw_mels=None,
      return_attentions=False,
      return_latent=False,
      clip_inputs=True,
  ):
      """
      Forward pass that uses both text and voice in either text conditioning mode or voice conditioning mode
      (actuated by `text_first`).
  
      speech_conditioning_input: MEL float tensor, (b,1024)
      text_inputs: long tensor, (b,t)
      text_lengths: long tensor, (b,)
      mel_inputs:  long tensor, (b,m)
      wav_lengths: long tensor, (b,)
      raw_mels: MEL float tensor (b,80,s)
  
      If return_attentions is specified, only logits are returned.
      If return_latent is specified, loss & logits are not computed or returned. Only the predicted latents are returned.
      If clip_inputs is True, the inputs will be clipped to the smallest input size across each input modality.
      """
      # Types are expressed by expanding the text embedding space.
      if types is not None:
          text_inputs = text_inputs * (1 + types).unsqueeze(-1)
  
      if clip_inputs:
          # This model will receive micro-batches with a ton of padding for both the text and MELs. Ameliorate this by
          # chopping the inputs by the maximum actual length.
          max_text_len = text_lengths.max()
          text_inputs = text_inputs[:, :max_text_len]
          max_mel_len = wav_lengths.max() // self.mel_length_compression
          mel_codes = mel_codes[:, :max_mel_len]
          if raw_mels is not None:
              raw_mels = raw_mels[:, :, : max_mel_len * 4]
      mel_codes = self.set_mel_padding(mel_codes, wav_lengths)
      text_inputs = F.pad(
          text_inputs, (0, 1), value=self.stop_text_token
      )
      mel_codes = F.pad(mel_codes, (0, 1), value=self.stop_mel_token)
  
      conds = speech_conditioning_latent.unsqueeze(1)
      text_inputs, text_targets = self.build_aligned_inputs_and_targets(
          text_inputs, self.start_text_token, self.stop_text_token
      )
      text_emb = self.text_embedding(
          text_inputs
      ) + self.text_pos_embedding(text_inputs)
      mel_codes, mel_targets = self.build_aligned_inputs_and_targets(
          mel_codes, self.start_mel_token, self.stop_mel_token
      )
      if raw_mels is not None:
          mel_inp = F.pad(raw_mels, (0, 8))
      else:
          mel_inp = mel_codes
      mel_emb = self.mel_embedding(mel_inp)
      mel_emb = mel_emb + self.mel_pos_embedding(mel_codes)
  
      if text_first:
          text_logits, mel_logits = self.get_logits(
              conds,
              text_emb,
              self.text_head,
              mel_emb,
              self.mel_head,
              get_attns=return_attentions,
              return_latent=return_latent,
          )
          if return_latent:
              return mel_logits[
                  :, :-2
              ]  # Despite the name, these are not logits. Strip off the two tokens added by this forward pass.
      else:
          mel_logits, text_logits = self.get_logits(
              conds,
              mel_emb,
              self.mel_head,
              text_emb,
              self.text_head,
              get_attns=return_attentions,
              return_latent=return_latent,
          )
          if return_latent:
              return text_logits[
                  :, :-2
              ]  # Despite the name, these are not logits. Strip off the two tokens added by this forward pass.
  
      if return_attentions:
          return mel_logits
      loss_text = F.cross_entropy(text_logits, text_targets.long())
      loss_mel = F.cross_entropy(mel_logits, mel_targets.long())
      return loss_text.mean(), loss_mel.mean(), mel_logits
  
imports: import functools
  import torch
  import torch.nn
  import torch.nn.functional
  from transformers import GPT2Config, GPT2PreTrainedModel, LogitsProcessorList
  from transformers.modeling_outputs import CausalLMOutputWithCrossAttentions
  from TTS.tts.layers.tortoise.arch_utils import AttentionBlock, TypicalLogitsWarper
label_desc: Use image node_id 7 for calling the UnifiedVoice obj's underlying member method code with example usage: obj.forward(speech_conditioning_latent, text_inputs, text_lengths, mel_codes, wav_lengths, types, text_first, raw_mels, return_attentions, return_latent, clip_inputs) and returns: loss_text,  loss_mel,  mel_logits, mel_logits, mel_logits, text_logits