[Model][Perf] IndexTTS2: drop per-step hidden D2H in latent mode (#8478)

Signed-off-by: ztyan <191593482+vivivi-111@users.noreply.github.com>
This commit is contained in:
ztyan authored and GitHub committed 2026-10-05 20:20:25 +08:00
1 parent 6dd0d1f931
commit 091b256674
2 files changed
+12 -11

No files matched your search

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
from types import SimpleNamespace
@@ -215,8 +215,8 @@ def test_mel_head_preserves_official_checkpoint_bias_and_hidden_payload_policy(
assert seen["bias"] is True
assert talker.mel_head.bias is not None
assert talker.omni_pooler_payload_include_hidden is use_gpt_latent
assert talker.omni_payload_at_request_end is (model_type == "indextts2_5")
assert talker.omni_pooler_payload_include_hidden is False
assert talker.omni_payload_at_request_end is True
def test_v2_load_weights_loads_exact_mel_head_bias_parameter(monkeypatch):
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""IndexTTS2 Stage 0: GPT-2 AR Talker with vLLM-native PagedAttention.
Predicts mel codes autoregressively and collects hidden_states as latent
@@ -158,17 +158,18 @@ class IndexTTS2TalkerForConditionalGeneration(nn.Module):
self.has_postprocess = True
self.requires_raw_input_tokens = True
self.enable_update_additional_information = True
# Stage 1 consumes the hidden-state stream only in the legacy
# ``use_gpt_latent`` mode. IndexTTS 2.5 transports mel codes plus
# reference conditioning, so asking the generic runner to include
# hidden states would add a synchronous [num_tokens, model_dim] D2H
# copy on every decode step without adding anything to the payload.
self.omni_pooler_payload_include_hidden = self.use_gpt_latent
# S2Mel never reads the generic pooler ``hidden`` key: latent mode
# ships the aligned GPT latent as ``hidden_states.latent`` from
# make_omni_output, and no-latent mode needs no hidden state at all.
# Including it would add a synchronous [num_tokens, model_dim] D2H
# copy plus a CPU-side concat on every decode step, which also
# serializes async scheduling.
self.omni_pooler_payload_include_hidden = False
# S2Mel consumes the complete sequence only at request end. In latent
# mode the runner retains aligned code/latent deltas on GPU; no-latent
# mode reuses the CPU output-token history and retains only conditioning
# metadata here.
self.omni_payload_at_request_end = self.config.model_type == "indextts2_5"
self.omni_payload_at_request_end = True
self.omni_request_end_token_ids = ()
self._speaker_cache = get_speaker_cache()
self.gpu_resident_buffer_keys: set[tuple[str, str]] = {