docstr: Args:
      layers: Number of layers in transformer stack.
      model_dim: Operating dimensions of the transformer
      heads: Number of transformer heads. Must be divisible by model_dim. Recommend model_dim//64
      max_text_tokens: Maximum number of text tokens that will be encountered by model.
      max_mel_tokens: Maximum number of MEL tokens that will be encountered by model.
      max_conditioning_inputs: Maximum number of conditioning inputs provided to the model. If (1), conditioning input can be of format (b,80,s), otherwise (b,n,80,s).
      mel_length_compression: The factor between <number_input_samples> and <mel_tokens>. Used to compute MEL code padding given wav input length.
      number_text_tokens:
      start_text_token:
      stop_text_token:
      number_mel_codes:
      start_mel_token:
      stop_mel_token:
      train_solo_embeddings:
      use_mel_codes_as_input:
      checkpointing:
code: def __init__(
      self,
      layers=8,
      model_dim=512,
      heads=8,
      max_text_tokens=120,
      max_mel_tokens=250,
      max_conditioning_inputs=1,
      mel_length_compression=1024,
      number_text_tokens=256,
      start_text_token=None,
      number_mel_codes=8194,
      start_mel_token=8192,
      stop_mel_token=8193,
      train_solo_embeddings=False,
      use_mel_codes_as_input=True,
      checkpointing=True,
      types=1,
  ):
      """
      Args:
          layers: Number of layers in transformer stack.
          model_dim: Operating dimensions of the transformer
          heads: Number of transformer heads. Must be divisible by model_dim. Recommend model_dim//64
          max_text_tokens: Maximum number of text tokens that will be encountered by model.
          max_mel_tokens: Maximum number of MEL tokens that will be encountered by model.
          max_conditioning_inputs: Maximum number of conditioning inputs provided to the model. If (1), conditioning input can be of format (b,80,s), otherwise (b,n,80,s).
          mel_length_compression: The factor between <number_input_samples> and <mel_tokens>. Used to compute MEL code padding given wav input length.
          number_text_tokens:
          start_text_token:
          stop_text_token:
          number_mel_codes:
          start_mel_token:
          stop_mel_token:
          train_solo_embeddings:
          use_mel_codes_as_input:
          checkpointing:
      """
      super().__init__()
  
      self.number_text_tokens = number_text_tokens
      self.start_text_token = (
          number_text_tokens * types
          if start_text_token is None
          else start_text_token
      )
      self.stop_text_token = 0
      self.number_mel_codes = number_mel_codes
      self.start_mel_token = start_mel_token
      self.stop_mel_token = stop_mel_token
      self.layers = layers
      self.heads = heads
      self.max_mel_tokens = max_mel_tokens
      self.max_text_tokens = max_text_tokens
      self.model_dim = model_dim
      self.max_conditioning_inputs = max_conditioning_inputs
      self.mel_length_compression = mel_length_compression
      self.conditioning_encoder = ConditioningEncoder(
          80, model_dim, num_attn_heads=heads
      )
      self.text_embedding = nn.Embedding(
          self.number_text_tokens * types + 1, model_dim
      )
      if use_mel_codes_as_input:
          self.mel_embedding = nn.Embedding(
              self.number_mel_codes, model_dim
          )
      else:
          self.mel_embedding = MelEncoder(
              model_dim, resblocks_per_reduction=1
          )
      (
          self.gpt,
          self.mel_pos_embedding,
          self.text_pos_embedding,
          self.mel_layer_pos_embedding,
          self.text_layer_pos_embedding,
      ) = build_hf_gpt_transformer(
          layers,
          model_dim,
          heads,
          self.max_mel_tokens + 2 + self.max_conditioning_inputs,
          self.max_text_tokens + 2,
          checkpointing,
      )
      if train_solo_embeddings:
          self.mel_solo_embedding = nn.Parameter(
              torch.randn(1, 1, model_dim) * 0.02, requires_grad=True
          )
          self.text_solo_embedding = nn.Parameter(
              torch.randn(1, 1, model_dim) * 0.02, requires_grad=True
          )
      else:
          self.mel_solo_embedding = 0
          self.text_solo_embedding = 0
  
      self.final_norm = nn.LayerNorm(model_dim)
      self.text_head = nn.Linear(
          model_dim, self.number_text_tokens * types + 1
      )
      self.mel_head = nn.Linear(model_dim, self.number_mel_codes)
  
      # Initialize the embeddings per the GPT-2 scheme
      embeddings = [self.text_embedding]
      if use_mel_codes_as_input:
          embeddings.append(self.mel_embedding)
      for module in embeddings:
          module.weight.data.normal_(mean=0.0, std=0.02)
  
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 1 to create a new UnifiedVoice object from inherited base classes: nn with example: obj = UnifiedVoice(layers, model_dim, heads, max_text_tokens, max_mel_tokens, max_conditioning_inputs, mel_length_compression, number_text_tokens, start_text_token, number_mel_codes, start_mel_token, stop_mel_token, train_solo_embeddings, use_mel_codes_as_input, checkpointing, types)