• Stefy Lanza (nextime / spora )'s avatar
    voice: cache the F5-TTS engine and trim over-long references · 45cc7306
    Stefy Lanza (nextime / spora ) authored
    Two costs on every cloned line.
    
    F5TTS(device=…) was constructed per request, so the model and its vocoder were
    loaded from scratch for each line of dialogue — seconds of latency and a fresh VRAM
    allocation every time. seed-vc next door already keeps a singleton; F5 now does
    too, rebuilt only if the device changes, and registered with
    register_external_vram_releaser so the manager can reclaim it like the LoRA base
    cache and the OCR engines.
    
    And nothing capped the reference. F5-TTS prompts on the clip and gains nothing past
    roughly 15 s, while a saved profile can hold minutes — the character studio uploads
    90 s. Both the /v1/audio/clone path and the dialog path now trim to
    MAX_REF_SECONDS (15, override with CODERAI_F5_MAX_REF_SECONDS), leaving anything
    already short untouched.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_0182DhR1eFNPQyGmDrpHbedY
    45cc7306
video.py 211 KB