Merge branch 'main' into fix/pr4709-review-followup
This commit is contained in:
525 files changed
+38790
-11106
No files matched your search
@@ -13,6 +13,7 @@ from vllm_omni.model_executor.models.common.qwen3_code_predictor import (
|
||||
CodePredictorWrapper,
|
||||
CodePredictorWrapperConfig,
|
||||
)
|
||||
from vllm_omni.platforms import current_omni_platform
|
||||
|
||||
from .configuration_qwen3_tts import Qwen3TTSTalkerCodePredictorConfig, Qwen3TTSTalkerConfig
|
||||
|
||||
@@ -21,7 +22,7 @@ Qwen3TTSTalkerCodePredictorModelVLLM = CodePredictorBaseModel
|
||||
|
||||
|
||||
class Qwen3TTSTalkerCodePredictorForConditionalGenerationVLLM(CodePredictorWrapper):
|
||||
"""Qwen3-TTS code predictor (CUDA graphs, per-call sampling, projection)."""
|
||||
"""Qwen3-TTS code predictor (per-call sampling, projection)."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -35,7 +36,7 @@ class Qwen3TTSTalkerCodePredictorForConditionalGenerationVLLM(CodePredictorWrapp
|
||||
vllm_config=vllm_config,
|
||||
cp_config=config,
|
||||
wrapper_config=CodePredictorWrapperConfig(
|
||||
use_cuda_graphs=True,
|
||||
use_cuda_graphs=current_omni_platform.is_npu(),
|
||||
use_parallel_embedding=False,
|
||||
use_projection=(config.hidden_size != talker_config.hidden_size),
|
||||
return_proj_buf=False,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
from collections.abc import Iterable, Mapping
|
||||
from collections.abc import Iterable, Mapping, Sequence
|
||||
from typing import Any
|
||||
|
||||
import numpy as np
|
||||
@@ -314,6 +314,12 @@ class Qwen3TTSTalkerForConditionalGeneration(nn.Module):
|
||||
# tensor read; postprocess receives the tail-only slice instead, which
|
||||
# avoids ~18 ms merge + ~6 ms write per step (Sy0307 profile, #3665).
|
||||
self.requires_full_prefix_cached_hidden_states = False
|
||||
# Stage 1 (code2wav) consumes runtime audio codes, not hidden states,
|
||||
# so the inter-stage pooler payload never needs a CPU hidden-states
|
||||
# view. Opting out lets the runner skip the per-step blocking
|
||||
# ``hidden_states[:n].to("cpu")`` (measured at 24% of stage-0 on-CPU
|
||||
# samples at c=64 on H20).
|
||||
self.omni_pooler_payload_include_hidden = False
|
||||
# ``codes.audio`` is only needed for future prefix-hit reconstruction
|
||||
# after a request has produced codec rows. Keep per-step rows on GPU and
|
||||
# materialize the CPU OmniTensorPrefixCache entry once at completion.
|
||||
@@ -323,7 +329,33 @@ class Qwen3TTSTalkerForConditionalGeneration(nn.Module):
|
||||
# OmniGPUModelRunner will store talker_mtp output under this key in
|
||||
# per-request additional_information.
|
||||
self.talker_mtp_output_key = ("codes", "audio")
|
||||
|
||||
self.talker_mtp_graph_safe = True
|
||||
# talker_mtp samples with per-row generators, so explicitly-seeded
|
||||
# requests stay batched instead of one scalar forward per row (#4883).
|
||||
# This is only valid while talker_mtp receives the *unpadded* active
|
||||
# batch, i.e. when it is NOT graph-wrapped. The runner wraps talker_mtp
|
||||
# (padded batches + a single captured RNG stream) whenever full
|
||||
# cudagraphs are enabled, so disable per-row generators in that case.
|
||||
# Consequence: under full cudagraphs, per-request ``tts_local_seed`` is
|
||||
# not reproducible (matching Qwen3-Omni, which has no per-row seeding);
|
||||
# eager mode keeps the per-row generator fast-path.
|
||||
# TODO(#4923): the model should not read ``cudagraph_mode`` — it is an
|
||||
# upstream (runner) concern, and the runner already re-derives the same
|
||||
# wrap decision in ``_init_talker_mtp``. Once all TTS models declare
|
||||
# ``talker_mtp_graph_safe`` we should move this gating into the model
|
||||
# runner (models only expose the static capability flag, and users can
|
||||
# then configure ``cudagraph_mode`` freely). This also means mtp seeding
|
||||
# is silently dropped when the decode batch > 1 under full cudagraphs;
|
||||
# the follow-up should refactor the per-row generator in the runner to
|
||||
# be cudagraph-safe so seeded batches stay reproducible.
|
||||
cudagraph_mode = getattr(vllm_config.compilation_config, "cudagraph_mode", None)
|
||||
talker_mtp_graph_wrapped = (
|
||||
self.talker_mtp_graph_safe and cudagraph_mode is not None and cudagraph_mode.has_full_cudagraphs()
|
||||
)
|
||||
self.talker_mtp_accepts_per_row_generators = not talker_mtp_graph_wrapped
|
||||
self.use_async_omni_output = True
|
||||
self.eager_omni_postprocess_before_async_output = True
|
||||
self.omni_pooler_payload_include_hidden = False
|
||||
self.model = Qwen3Model(vllm_config=vllm_config, prefix=maybe_prefix(prefix, "model"))
|
||||
|
||||
if get_pp_group().is_last_rank:
|
||||
@@ -1060,6 +1092,7 @@ class Qwen3TTSTalkerForConditionalGeneration(nn.Module):
|
||||
top_k: int | None = None,
|
||||
top_p: float | None = None,
|
||||
generator: torch.Generator | None = None,
|
||||
generators: Sequence[torch.Generator | None] | None = None,
|
||||
**kwargs: Any,
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""GPU fast-path used by OmniGPUModelRunner to predict residual codebooks (1..Q-1).
|
||||
@@ -1099,6 +1132,7 @@ class Qwen3TTSTalkerForConditionalGeneration(nn.Module):
|
||||
top_k=top_k,
|
||||
top_p=top_p,
|
||||
generator=generator,
|
||||
generators=generators,
|
||||
) # [B, Q]
|
||||
|
||||
# Map invalid layer-0 ids (e.g. EOS) to PAD=0 so SpeechTokenizer sees only real codes.
|
||||
|
||||
Reference in new issue
Block a user