From 6b801c13e225e03270fc7260a530f5295a2f1c11 Mon Sep 17 00:00:00 2001 From: Jhen-Jie Hong Date: Mon, 9 Nov 2026 11:03:03 +0800 Subject: [PATCH] audio_lm: the codebook family's needs_voice ignores the last request's voice caps.needs_voice of a Qwen3-TTS Base talker read audio_lm_decode_speaker, which tts_build sets to each request's voice. After one generation with a cloned voice the caps reported needs_voice = false while tts_format still refuses a request without a voice, so a host that checks the caps before each request sent the next one without a voice and got "this is a voice-clone model and needs a voice". It now checks the model's default voice, as the flow and token families do. The host smoke checks that the caps are the same after a generation. --- common/audio_lm_family_codebook.cpp | 3 ++- tests/e2e/audio_lm_host_smoke.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/audio_lm_family_codebook.cpp b/common/audio_lm_family_codebook.cpp index 8fd14ca..a329f76 100644 --- a/common/audio_lm_family_codebook.cpp +++ b/common/audio_lm_family_codebook.cpp @@ -23,7 +23,8 @@ class codebook_family : public alm_family { out->takes_ref_audio = audio_lm_codec_can_speaker_from_audio(alm_); out->takes_ref_text = out->takes_ref_audio && audio_lm_talker_has_projection(alm_); out->takes_instruct = meta_true("codec.lm.qwen3tts.takes_instruct"); - out->needs_voice = audio_lm_talker_has_projection(alm_) && !talker_voice(audio_lm_decode_speaker(alm_)); + // The model's default voice, not the last request's (decode_speaker). + out->needs_voice = audio_lm_talker_has_projection(alm_) && !talker_voice(audio_lm_resolve_speaker(alm_, nullptr)); const char * sr = audio_lm_meta_str(alm_, "codec.sample_rate"); out->sample_rate = sr ? std::atoi(sr) : 24000; } diff --git a/tests/e2e/audio_lm_host_smoke.py b/tests/e2e/audio_lm_host_smoke.py index 074f773..cea990f 100644 --- a/tests/e2e/audio_lm_host_smoke.py +++ b/tests/e2e/audio_lm_host_smoke.py @@ -219,6 +219,7 @@ def main() -> int: alm = codec_cpp.AudioLM(case["codec"], backbone_path=case["backbone"] if case.get("backbone_path") else None) bb = Backbone(case["backbone"], alm, max_frames=400) try: + caps = alm.caps req = {} if "ref" in case: # a cloned voice: create, save, reload wav, txt = case["ref"] @@ -229,6 +230,8 @@ def main() -> int: voice = alm.load_voice(Path(d) / "voice.gguf") req["voice"] = voice audio, sr, frames, stop = synthesize(alm, bb, case["text"], case["sampling"], **req) + # Caps describe the model, not the last request's voice. + assert alm.caps == caps, f"caps changed after a generation: {caps} -> {alm.caps}" except Exception as e: print(f"[FAIL] {name}: {e}") failed += 1