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_stream(
      self,
      text,
      language,
      gpt_cond_latent,
      speaker_embedding,
      # Streaming
      stream_chunk_size=20,
      overlap_wav_len=1024,
      # GPT inference
      temperature=0.75,
      length_penalty=1.0,
      repetition_penalty=10.0,
      top_k=50,
      top_p=0.85,
      do_sample=True,
      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]
  
      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."
  
          fake_inputs = self.gpt.compute_embeddings(
              gpt_cond_latent.to(self.device),
              text_tokens,
          )
          gpt_generator = self.gpt.get_generator(
              fake_inputs=fake_inputs,
              top_k=top_k,
              top_p=top_p,
              temperature=temperature,
              do_sample=do_sample,
              num_beams=1,
              num_return_sequences=1,
              length_penalty=float(length_penalty),
              repetition_penalty=float(repetition_penalty),
              output_attentions=False,
              output_hidden_states=True,
              **hf_generate_kwargs,
          )
  
          last_tokens = []
          all_latents = []
          wav_gen_prev = None
          wav_overlap = None
          is_end = False
  
          while not is_end:
              try:
                  x, latent = next(gpt_generator)
                  last_tokens += [x]
                  all_latents += [latent]
              except StopIteration:
                  is_end = True
  
              if is_end or (
                  stream_chunk_size > 0
                  and len(last_tokens) >= stream_chunk_size
              ):
                  gpt_latents = torch.cat(all_latents, dim=0)[None, :]
                  if length_scale != 1.0:
                      gpt_latents = F.interpolate(
                          gpt_latents.transpose(1, 2),
                          scale_factor=length_scale,
                          mode="linear",
                      ).transpose(1, 2)
                  wav_gen = self.hifigan_decoder(
                      gpt_latents, g=speaker_embedding.to(self.device)
                  )
                  (
                      wav_chunk,
                      wav_gen_prev,
                      wav_overlap,
                  ) = self.handle_chunks(
                      wav_gen.squeeze(),
                      wav_gen_prev,
                      wav_overlap,
                      overlap_wav_len,
                  )
                  last_tokens = []
                  yield wav_chunk
  
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 11 for calling the Xtts obj's underlying member method code with example usage: obj.inference_stream(text, language, gpt_cond_latent, speaker_embedding, stream_chunk_size, overlap_wav_len, temperature, length_penalty, repetition_penalty, top_k, top_p, do_sample, speed, enable_text_splitting) without return types