Repository navigation
chatterbox: cache prepared voice-conversion targets - #1253
Conversation
Chatterbox VC prepared the target voice (speaker embedding, prompt features and tokens) on every request, even when converting into the same voice again, as a server does for every sentence of one speaker. The session now keeps prepared targets in memory, keyed by the target audio, in chatterbox.vc_reference_cache_slots slots (default 1, 0 turns it off), like conditionals_cache_slots does for cloning. Settings and source audio are still checked before any target is prepared.
|
@magnus-dev-melin One issue is that a cache miss prepares the target voice before validating the source audio and conversion settings. With a negative guidance value, I got the same error in about 0.5 ms on main and 39 ms on this PR. Please validate the source and settings before preparing the target. |
On a cache miss the session prepared the target voice before the conversion settings and source audio were checked, so an invalid request failed only after that work. The session now validates them first.
|
Thanks, fixed in 0536593: on a cache miss the session now validates the settings and source audio before preparing the target ( |
|
@magnus-dev-melin Merged. Thanks for the quick turnaround! |
Chatterbox VC prepares the target voice (speaker embedding, prompt mel and prompt tokens) on every request, even when converting into the same voice again, which is what a server converting a speaker's sentences one by one does. The session now keeps prepared targets in memory, keyed by the target audio, in
chatterbox.vc_reference_cache_slotsslots (default 1,0turns reuse off), the waychatterbox.conditionals_cache_slotsdoes for cloning.ChatterboxVCComponentgainsprepare_target()and aconvert()overload that takes a prepared target; the existingconvert(source, target_voice, config)is unchanged for callers and still checks settings and source audio before preparing the target. Model-local; no framework changes. Option added tomodel_specs/chatterbox.json, the loader option list anddocs/tts.md.Affects performance and repeatability: with the cache off, outputs are identical to
main; with it on, a request gives the outputmaingives the first time (details below).Validation (macOS, M1 Max, Metal,
chatterbox_q8_0as"task": "vc",num_inference_steps3, legacy server,seed7). The same 15/v1/tasks/runrequests after one warm-up: one target voice for 9 conversions of 3 sources, then two target voices taking turns 6 times, against amainbuild and this branch with 0, 1 and 2 slots, twice in alternating order:mainmainin both rounds. With the cache on, the first request matchedmain, and repeating a request gave the same output again; onmaina repeated request with the same seed gave a slightly different output after each new preparation, so cached results are also repeatable.model_spec_system_test,cli_request_options_testandtools/check_loader_catalog_sync.pypass.Not measured: CUDA/Vulkan (the change is backend-independent), and the parallel runtime beyond building.