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",")"]
docstr: Handle chunk formatting in streaming mode
docstr_tok: ["Handle","chunk","formatting","in","streaming","mode"]
code: def handle_chunks(
      self, wav_gen, wav_gen_prev, wav_overlap, overlap_len
  ):
      """Handle chunk formatting in streaming mode"""
      wav_chunk = wav_gen[:-overlap_len]
      if wav_gen_prev is not None:
          wav_chunk = wav_gen[
              (wav_gen_prev.shape[0] - overlap_len) : -overlap_len
          ]
      if wav_overlap is not None:
          # cross fade the overlap section
          if overlap_len > len(wav_chunk):
              # wav_chunk is smaller than overlap_len, pass on last wav_gen
              if wav_gen_prev is not None:
                  wav_chunk = wav_gen[
                      (wav_gen_prev.shape[0] - overlap_len) :
                  ]
              else:
                  # not expecting will hit here as problem happens on last chunk
                  wav_chunk = wav_gen[-overlap_len:]
              return wav_chunk, wav_gen, None
          else:
              crossfade_wav = wav_chunk[:overlap_len]
              crossfade_wav = crossfade_wav * torch.linspace(
                  0.0, 1.0, overlap_len
              ).to(crossfade_wav.device)
              wav_chunk[:overlap_len] = wav_overlap * torch.linspace(
                  1.0, 0.0, overlap_len
              ).to(wav_overlap.device)
              wav_chunk[:overlap_len] += crossfade_wav
  
      wav_overlap = wav_gen[-overlap_len:]
      wav_gen_prev = wav_gen
      return wav_chunk, wav_gen_prev, wav_overlap
  
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 10 for calling the Xtts obj's underlying member method code with example usage: obj.handle_chunks(wav_gen, wav_gen_prev, wav_overlap, overlap_len) and returns: wav_chunk,  wav_gen_prev,  wav_overlap, wav_chunk,  wav_gen,  None