class_docstr: ⓍTTS model implementation.
  
  ❗ Currently it only supports inference.
  
  Examples:
      >>> from TTS.tts.configs.xtts_config import XttsConfig
      >>> from TTS.tts.models.xtts import Xtts
      >>> config = XttsConfig()
      >>> model = Xtts.inif_from_config(config)
      >>> model.load_checkpoint(config, checkpoint_dir="paths/to/models_dir/", eval=True)
class_docstr_tok: ["\u24cdTTS","model","implementation",".","\u2757","Currently","it","only","supports","inference",".","Examples",":",">",">",">","from","TTS.tts.configs.xtts_config","import","XttsConfig",">",">",">","from","TTS.tts.models.xtts","import","Xtts",">",">",">","config","=","XttsConfig","(",")",">",">",">","model","=","Xtts.inif_from_config","(","config",")",">",">",">","model.load_checkpoint","(","config",",","checkpoint_dir=","''","paths\/to\/models_dir\/","''",",","eval=True",")"]
code: def inference(
      self,
      text,
      language,
      gpt_cond_latent,
      speaker_embedding,
      # GPT inference
      temperature=0.75,
      length_penalty=1.0,
      repetition_penalty=10.0,
      top_k=50,
      top_p=0.85,
      do_sample=True,
      num_beams=1,
      speed=1.0,
      enable_text_splitting=False,
      **hf_generate_kwargs,
  ):
      language = language.split("-")[0]  # remove the country code
      length_scale = 1.0 / max(speed, 0.05)
      gpt_cond_latent = gpt_cond_latent.to(self.device)
      speaker_embedding = speaker_embedding.to(self.device)
      if enable_text_splitting:
          text = split_sentence(
              text, language, self.tokenizer.char_limits[language]
          )
      else:
          text = [text]
  
      wavs = []
      gpt_latents_list = []
      for sent in text:
          sent = sent.strip().lower()
          text_tokens = (
              torch.IntTensor(
                  self.tokenizer.encode(sent, lang=language)
              )
              .unsqueeze(0)
              .to(self.device)
          )
  
          assert (
              text_tokens.shape[-1] < self.args.gpt_max_text_tokens
          ), " ❗ XTTS can only generate text with a maximum of 400 tokens."
  
          with torch.no_grad():
              gpt_codes = self.gpt.generate(
                  cond_latents=gpt_cond_latent,
                  text_inputs=text_tokens,
                  input_tokens=None,
                  do_sample=do_sample,
                  top_p=top_p,
                  top_k=top_k,
                  temperature=temperature,
                  num_return_sequences=self.gpt_batch_size,
                  num_beams=num_beams,
                  length_penalty=length_penalty,
                  repetition_penalty=repetition_penalty,
                  output_attentions=False,
                  **hf_generate_kwargs,
              )
              expected_output_len = torch.tensor(
                  [gpt_codes.shape[-1] * self.gpt.code_stride_len],
                  device=text_tokens.device,
              )
  
              text_len = torch.tensor(
                  [text_tokens.shape[-1]], device=self.device
              )
              gpt_latents = self.gpt(
                  text_tokens,
                  text_len,
                  gpt_codes,
                  expected_output_len,
                  cond_latents=gpt_cond_latent,
                  return_attentions=False,
                  return_latent=True,
              )
  
              if length_scale != 1.0:
                  gpt_latents = F.interpolate(
                      gpt_latents.transpose(1, 2),
                      scale_factor=length_scale,
                      mode="linear",
                  ).transpose(1, 2)
  
              gpt_latents_list.append(gpt_latents.cpu())
              wavs.append(
                  self.hifigan_decoder(gpt_latents, g=speaker_embedding)
                  .cpu()
                  .squeeze()
              )
  
      return {
          "wav": torch.cat(wavs, dim=0).numpy(),
          "gpt_latents": torch.cat(gpt_latents_list, dim=1).numpy(),
          "speaker_embedding": speaker_embedding,
      }
  
imports: import os
  from dataclasses import dataclass
  import librosa
  import torch
  import torch.nn.functional
  import torchaudio
  from coqpit import Coqpit
  from TTS.tts.layers.xtts.gpt import GPT
  from TTS.tts.layers.xtts.hifigan_decoder import HifiDecoder
  from TTS.tts.layers.xtts.stream_generator import init_stream_support
  from TTS.tts.layers.xtts.tokenizer import VoiceBpeTokenizer, split_sentence
  from TTS.tts.layers.xtts.xtts_manager import SpeakerManager, LanguageManager
  from TTS.tts.models.base_tts import BaseTTS
  from TTS.utils.io import load_fsspec
label_desc: Use image node_id 9 for calling the Xtts obj's underlying member method code with example usage: obj.inference(text, language, gpt_cond_latent, speaker_embedding, temperature, length_penalty, repetition_penalty, top_k, top_p, do_sample, num_beams, speed, enable_text_splitting) and returns: dict