[Bugfix][Qwen3-TTS] Decode full payload from model buffer (#8132)

Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
Sy03 authored and GitHub committed 2026-09-25 10:03:58 +08:00
1 parent f46c958b67
commit 551a03102f
2 files changed
+30

No files matched your search

@@ -25,6 +25,7 @@ class _FakeDecoder(nn.Module):
self.total_upsample = total_upsample
self.decode_calls: list[dict[str, object]] = []
self.batched_decode_calls: list[dict[str, object]] = []
self.batched_decode_codes: list[torch.Tensor] = []
self.decode_codes: list[torch.Tensor] = []
self.cudagraph_calls: list[dict[str, int | torch.device]] = []
@@ -64,6 +65,7 @@ class _FakeDecoder(nn.Module):
left_context_size: int = 25,
max_batch_size: int = 0,
) -> list[torch.Tensor]:
self.batched_decode_codes.append(codes.detach().cpu().clone())
self.batched_decode_calls.append(
{
"chunk_size": chunk_size,
@@ -203,6 +205,26 @@ def test_forward_uses_decoder_audio_contract_without_context():
torch.testing.assert_close(audio, expected)
def test_forward_reads_current_model_intermediate_buffer_for_full_payload():
"""Full-payload sync mode must decode connector codec ids, not placeholders."""
model = _make_model()
placeholder_ids = torch.zeros(12, dtype=torch.long)
payload_codes = torch.arange(12, dtype=torch.long) + 17
model.forward(
input_ids=placeholder_ids,
runtime_additional_information=[],
model_intermediate_buffer=[
{
"codes": {"audio": payload_codes},
"meta": {"left_context_size": 0},
}
],
)
torch.testing.assert_close(model.decoder.batched_decode_codes[-1], payload_codes.reshape(1, _NUM_QUANTIZERS, 6))
@pytest.mark.parametrize("skipped_length", [0, 1], ids=["empty", "malformed"])
def test_stateless_batch_uses_original_request_index_for_left_context(skipped_length):
model = _make_model()