docstr: Args:
docstr_tok: ["Args",":"]
code: def __init__(
      self,
      start_text_token=261,
      stop_text_token=0,
      layers=8,
      model_dim=512,
      heads=8,
      max_text_tokens=120,
      max_mel_tokens=250,
      max_prompt_tokens=70,
      max_conditioning_inputs=1,
      code_stride_len=1024,
      number_text_tokens=256,
      num_audio_tokens=8194,
      start_audio_token=8192,
      stop_audio_token=8193,
      train_solo_embeddings=False,
      checkpointing=False,
      average_conditioning_embeddings=False,
      label_smoothing=0.0,
      use_perceiver_resampler=False,
      perceiver_cond_length_compression=256,
  ):
      """
      Args:
  
      """
      super().__init__()
  
      self.label_smoothing = label_smoothing
      self.number_text_tokens = number_text_tokens
      self.start_text_token = start_text_token
      self.stop_text_token = stop_text_token
      self.num_audio_tokens = num_audio_tokens
      self.start_audio_token = start_audio_token
      self.stop_audio_token = stop_audio_token
      self.start_prompt_token = start_audio_token
      self.stop_prompt_token = stop_audio_token
      self.layers = layers
      self.heads = heads
      self.model_dim = model_dim
      self.max_conditioning_inputs = max_conditioning_inputs
      self.max_gen_mel_tokens = (
          max_mel_tokens - self.max_conditioning_inputs - 2
      )
      self.max_mel_tokens = (
          -1
          if max_mel_tokens == -1
          else max_mel_tokens + 2 + self.max_conditioning_inputs
      )
      self.max_text_tokens = (
          -1 if max_text_tokens == -1 else max_text_tokens + 2
      )
      self.max_prompt_tokens = max_prompt_tokens
      self.code_stride_len = code_stride_len
      self.conditioning_encoder = ConditioningEncoder(
          80, model_dim, num_attn_heads=heads
      )
      self.conditioning_dropout = nn.Dropout1d(0.1)
      self.average_conditioning_embeddings = (
          average_conditioning_embeddings
      )
      self.use_perceiver_resampler = use_perceiver_resampler
      self.perceiver_cond_length_compression = (
          perceiver_cond_length_compression
      )
  
      self.text_embedding = nn.Embedding(
          self.number_text_tokens, model_dim
      )
      self.mel_embedding = nn.Embedding(
          self.num_audio_tokens, model_dim
      )
  
      (
          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,
          self.max_text_tokens,
          self.max_prompt_tokens,
          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)
      self.mel_head = nn.Linear(model_dim, self.num_audio_tokens)
  
      if self.use_perceiver_resampler:
          # XTTS v2
          self.conditioning_perceiver = PerceiverResampler(
              dim=model_dim,
              depth=2,
              dim_context=model_dim,
              num_latents=32,
              dim_head=64,
              heads=8,
              ff_mult=4,
              use_flash_attn=False,
          )
      else:
          # XTTS v1
          self.prompt_embedding = nn.Embedding(
              self.num_audio_tokens, model_dim
          )
          self.prompt_pos_embedding = LearnedPositionEmbeddings(
              24 * 9, model_dim
          )
  
imports: import functools
  import math
  import random
  import torch
  import torch.nn
  import torch.nn.functional
  from transformers import GPT2Config
  from TTS.tts.layers.xtts.gpt_inference import GPT2InferenceModel
  from TTS.tts.layers.xtts.latent_encoder import ConditioningEncoder
  from TTS.tts.layers.xtts.perceiver_encoder import PerceiverResampler
label_desc: Use image node_id 1 to create a new GPT object from inherited base classes: nn with example: obj = GPT(start_text_token, stop_text_token, layers, model_dim, heads, max_text_tokens, max_mel_tokens, max_prompt_tokens, max_conditioning_inputs, code_stride_len, number_text_tokens, num_audio_tokens, start_audio_token, stop_audio_token, train_solo_embeddings, checkpointing, average_conditioning_embeddings, label_smoothing, use_perceiver_resampler, perceiver_cond_length_compression)