How VRAM-aware chunked voice conversion works
mainWhen performing audio-to-audio conversion, KokoClone uses chunked_voice_conversion in core/chunked_convert.py to manage memory for long recordings:
- VRAM Budget: On CUDA, chunks are sized so each forward pass uses at most 50% of total GPU memory (configurable via the
vram_fractionparameter). - RoPE Ceiling: The Kanade
mel_decoderTransformer has positional embeddings precomputed for 1,024 mel frames. Chunk windows are hard-capped below this limit (≈ 8.9s of source audio per chunk) with a 10% safety margin to prevent recomputation and quality degradation. - Overlap Smoothing: Each chunk includes a 0.5s overlap on both sides to suppress boundary artifacts.
- Single-Pass Vocoding: The full reassembled mel spectrogram is passed to the vocoder in one shot for clean waveform reconstruction.