From 81a90d24ef5213803293b3ca897c1f67fb0850a3 Mon Sep 17 00:00:00 2001 From: Juan Pablo Zuluaga <46724788+JuanPZuluaga@users.noreply.github.com> Date: Fri, 20 Mar 2026 05:11:37 +0100 Subject: [PATCH 1/8] [Feat][Qwen3TTS][Code2wav] triton SnakeBeta and Cuda Graph (#1797) Signed-off-by: pablo Signed-off-by: JuanPZuluaga Co-authored-by: pablo Co-authored-by: JuanPZuluaga Co-authored-by: Hongsheng Liu Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com> --- .../qwen3_tts/test_cuda_graph_decoder.py | 60 ++++++++ .../qwen3_tts/cuda_graph_decoder_wrapper.py | 98 +++++++------ .../models/qwen3_tts/qwen3_tts_code2wav.py | 30 ++-- .../modeling_qwen3_tts_tokenizer_v2.py | 136 +++++++++++++++--- 4 files changed, 247 insertions(+), 77 deletions(-) diff --git a/tests/model_executor/models/qwen3_tts/test_cuda_graph_decoder.py b/tests/model_executor/models/qwen3_tts/test_cuda_graph_decoder.py index 373968760..86af75780 100644 --- a/tests/model_executor/models/qwen3_tts/test_cuda_graph_decoder.py +++ b/tests/model_executor/models/qwen3_tts/test_cuda_graph_decoder.py @@ -270,3 +270,63 @@ def test_deterministic_across_calls(decoder, wrapper): out1 = wrapper.decode(codes) out2 = wrapper.decode(codes) torch.testing.assert_close(out1, out2, atol=0, rtol=0) + + +# ────────────────────────────────────────────────────────────────── +# 6. compute_capture_sizes +# ────────────────────────────────────────────────────────────────── + + +@pytest.mark.parametrize( + "kwargs,expected_in,not_expected", + [ + ({}, [2, 4, 8, 16, 32, 64, 128, 256, 325], [512]), + ( + {"codec_chunk_frames": 33, "codec_left_context_frames": 25}, + [2, 4, 8, 16, 32, 33, 58, 64, 128, 256, 325], + [512], + ), + ( + {"codec_chunk_frames": 25, "codec_left_context_frames": 25}, + [2, 4, 8, 16, 25, 32, 50, 64, 128, 256, 325], + [512], + ), + ], + ids=["default", "streaming_c33", "streaming_c25"], +) +def test_compute_capture_sizes(kwargs, expected_in, not_expected): + """compute_capture_sizes produces expected sizes capped by max useful size.""" + sizes = CUDAGraphDecoderWrapper.compute_capture_sizes(**kwargs) + for val in expected_in: + assert val in sizes, f"{val} not in {sizes}" + for val in not_expected: + assert val not in sizes, f"{val} should not be in {sizes}" + + +# ────────────────────────────────────────────────────────────────── +# 7. SnakeBeta Triton kernel vs eager equivalence +# ────────────────────────────────────────────────────────────────── + + +@pytest.mark.parametrize( + "batch,channels,seq_len", + [(2, 64, 1000), (1, 32, 1), (1, 32, 7), (1, 32, 128), (1, 32, 1024), (1, 32, 4096)], +) +def test_snakebeta_triton_vs_eager(batch, channels, seq_len): + """Fused Triton SnakeBeta kernel must match eager PyTorch output.""" + from vllm_omni.model_executor.models.qwen3_tts.tokenizer_12hz.modeling_qwen3_tts_tokenizer_v2 import ( + SnakeBeta, + ) + + if not SnakeBeta._init_triton(): + pytest.skip("Triton not available") + + torch.manual_seed(42) + snake = SnakeBeta(in_features=channels).to(DEVICE).eval() + x = torch.randn(batch, channels, seq_len, device=DEVICE) + + with torch.no_grad(): + eager_out = snake._eager_forward(x) + triton_out = snake._triton_forward(x) + + torch.testing.assert_close(triton_out, eager_out, atol=1e-5, rtol=1e-5) diff --git a/vllm_omni/model_executor/models/qwen3_tts/cuda_graph_decoder_wrapper.py b/vllm_omni/model_executor/models/qwen3_tts/cuda_graph_decoder_wrapper.py index 5ff259193..96f8c799c 100644 --- a/vllm_omni/model_executor/models/qwen3_tts/cuda_graph_decoder_wrapper.py +++ b/vllm_omni/model_executor/models/qwen3_tts/cuda_graph_decoder_wrapper.py @@ -29,8 +29,6 @@ class CUDAGraphDecoderWrapper: output = wrapper.decode(codes) # Automatically uses CUDA graph if possible """ - DEFAULT_CAPTURE_SIZES = [2, 4, 8, 16, 25, 32, 50, 100, 150, 200, 250, 300] - def __init__( self, decoder: torch.nn.Module, @@ -39,7 +37,8 @@ class CUDAGraphDecoderWrapper: enabled: bool = True, ): self.decoder = decoder - self.capture_sizes = capture_sizes or self.DEFAULT_CAPTURE_SIZES + self._explicit_sizes = capture_sizes is not None + self.capture_sizes = sorted(capture_sizes) if capture_sizes else [] self.num_quantizers = num_quantizers self.enabled = enabled @@ -50,66 +49,82 @@ class CUDAGraphDecoderWrapper: self._warmed_up = False self._device = None + @staticmethod + def compute_capture_sizes( + codec_chunk_frames: int = 0, + codec_left_context_frames: int = 0, + decode_chunk_size: int = 300, + decode_left_context: int = 25, + ) -> list[int]: + """Compute capture sizes from chunking config for high graph hit rate.""" + sizes: set[int] = set() + + # Streaming exact hits + if codec_chunk_frames > 0: + sizes.add(codec_chunk_frames) + if codec_left_context_frames > 0: + sizes.add(codec_chunk_frames + codec_left_context_frames) + + # Non-streaming chunked decode: full chunk + last-chunk buckets + non_stream_max = decode_chunk_size + decode_left_context + sizes.add(non_stream_max) + + # Power-of-2 buckets covering both streaming IC sizes and non-streaming last-chunk sizes + for p2 in [2, 4, 8, 16, 32, 64, 128, 256]: + if p2 <= non_stream_max: + sizes.add(p2) + + return sorted(sizes) + def _get_padded_size(self, actual_size: int) -> int | None: for size in self.capture_sizes: if actual_size <= size: return size return None - def warmup(self, device: torch.device, dtype: torch.dtype = torch.long): - if device.type != "cuda": - logger.info("CUDA Graph warmup skipped: device %s is not CUDA", device) - return - - if not self.enabled: - logger.info("CUDA Graph is disabled, skipping warmup") - return - - if self._warmed_up: - logger.warning("CUDA Graph already warmed up, skipping") + def warmup( + self, + device: torch.device, + dtype: torch.dtype = torch.long, + codec_chunk_frames: int = 0, + codec_left_context_frames: int = 0, + ): + if device.type != "cuda" or not self.enabled or self._warmed_up: return self._device = device self.decoder.eval() + if not self._explicit_sizes: + self.capture_sizes = self.compute_capture_sizes( + codec_chunk_frames=codec_chunk_frames, + codec_left_context_frames=codec_left_context_frames, + ) + logger.info("Starting CUDA Graph warmup for %d sizes: %s", len(self.capture_sizes), self.capture_sizes) # Warmup runs to ensure CUDA memory is allocated for size in self.capture_sizes: - dummy_codes = torch.zeros( - 1, - self.num_quantizers, - size, - dtype=dtype, - device=device, - ) + dummy = torch.zeros(1, self.num_quantizers, size, dtype=dtype, device=device) with torch.no_grad(): - _ = self.decoder(dummy_codes) + _ = self.decoder(dummy) torch.cuda.synchronize(device) for size in self.capture_sizes: try: - self._capture_graph_for_size(size, device, dtype) + self._capture(size, device, dtype) logger.info(" Captured CUDA Graph for size=%d", size) except Exception: - logger.warning(" Failed to capture CUDA Graph for size=%d", size, exc_info=True) + logger.warning(" Failed to capture graph for size=%d", size, exc_info=True) self._warmed_up = True - logger.info("CUDA Graph warmup complete. Captured %d graphs.", len(self.graphs)) - - def _capture_graph_for_size(self, size: int, device: torch.device, dtype: torch.dtype): - static_input = torch.zeros( - 1, - self.num_quantizers, - size, - dtype=dtype, - device=device, - ) + logger.info("CUDA Graph warmup complete: %d/%d captured", len(self.graphs), len(self.capture_sizes)) + def _capture(self, size: int, device: torch.device, dtype: torch.dtype): + static_input = torch.zeros(1, self.num_quantizers, size, dtype=dtype, device=device) with torch.no_grad(): _ = self.decoder(static_input) - torch.cuda.synchronize(device) graph = CUDAGraph() @@ -122,10 +137,7 @@ class CUDAGraphDecoderWrapper: self.static_outputs[size] = static_output def decode(self, codes: torch.Tensor) -> torch.Tensor: - if not self.enabled or not self._warmed_up: - return self.decoder(codes) - - if codes.shape[0] != 1: + if not self.enabled or not self._warmed_up or codes.shape[0] != 1: return self.decoder(codes) actual_size = codes.shape[-1] @@ -136,14 +148,10 @@ class CUDAGraphDecoderWrapper: self.static_inputs[padded_size].zero_() self.static_inputs[padded_size][:, :, :actual_size] = codes - self.graphs[padded_size].replay() - output = self.static_outputs[padded_size] - total_upsample = self.decoder.total_upsample - actual_output_len = actual_size * total_upsample - - return output[..., :actual_output_len].clone() + actual_out_len = actual_size * self.decoder.total_upsample + return self.static_outputs[padded_size][..., :actual_out_len].clone() def chunked_decode_with_cudagraph( self, diff --git a/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code2wav.py b/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code2wav.py index 79a2810bf..6be039df1 100644 --- a/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code2wav.py +++ b/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code2wav.py @@ -107,11 +107,17 @@ class Qwen3TTSCode2Wav(nn.Module): self._output_sample_rate = out_sr self._total_upsample = int(decoder.total_upsample) + # Precompute SnakeBeta exp caches (benefits both Triton and eager paths) + if hasattr(decoder, "precompute_snake_caches"): + decoder.precompute_snake_caches() + if hasattr(decoder, "enable_cudagraph"): device = self._module_device(decoder) if device.type == "cuda": try: - capture_sizes = None + chunk_frames = 0 + left_frames = 0 + model_cfg = getattr(self.vllm_config, "model_config", None) connector_cfg = getattr(model_cfg, "stage_connector_config", None) extra_cfg = ( @@ -122,12 +128,12 @@ class Qwen3TTSCode2Wav(nn.Module): if isinstance(extra_cfg, dict): chunk_frames = int(extra_cfg.get("codec_chunk_frames") or 0) left_frames = int(extra_cfg.get("codec_left_context_frames") or 0) - if chunk_frames > 0 and left_frames >= 0: - from .cuda_graph_decoder_wrapper import CUDAGraphDecoderWrapper - steady_window = left_frames + chunk_frames - capture_sizes = sorted({*CUDAGraphDecoderWrapper.DEFAULT_CAPTURE_SIZES, steady_window}) - decoder.enable_cudagraph(capture_sizes=capture_sizes, device=device) + decoder.enable_cudagraph( + device=device, + codec_chunk_frames=chunk_frames, + codec_left_context_frames=left_frames, + ) logger.info("Code2Wav decoder CUDA Graph enabled") except Exception: logger.warning("Failed to enable CUDA Graph for Code2Wav decoder", exc_info=True) @@ -265,18 +271,12 @@ class Qwen3TTSCode2Wav(nn.Module): pass # Decode directly via decoder.chunked_decode(), staying entirely on GPU. - # For single request: no padding needed, fast path. - # For multiple requests: decode each individually to avoid padding overhead. + # Each request decoded individually with CUDA graph replay at bs=1. wav_tensors: list[torch.Tensor] = [] - if len(valid_codes_qf) == 1: - codes_bqf = valid_codes_qf[0].unsqueeze(0) # [1, Q, F] + for codes_qf in valid_codes_qf: + codes_bqf = codes_qf.unsqueeze(0) # [1, Q, F] wav = decoder.chunked_decode(codes_bqf) # [1, 1, wav_len] wav_tensors.append(wav.squeeze(0).squeeze(0)) # [wav_len] - else: - for codes_qf in valid_codes_qf: - codes_bqf = codes_qf.unsqueeze(0) # [1, Q, F] - wav = decoder.chunked_decode(codes_bqf) - wav_tensors.append(wav.squeeze(0).squeeze(0)) audios: list[torch.Tensor] = [empty] * num_req srs = [sr_tensor] * num_req diff --git a/vllm_omni/model_executor/models/qwen3_tts/tokenizer_12hz/modeling_qwen3_tts_tokenizer_v2.py b/vllm_omni/model_executor/models/qwen3_tts/tokenizer_12hz/modeling_qwen3_tts_tokenizer_v2.py index 5719d1024..dfa48df29 100644 --- a/vllm_omni/model_executor/models/qwen3_tts/tokenizer_12hz/modeling_qwen3_tts_tokenizer_v2.py +++ b/vllm_omni/model_executor/models/qwen3_tts/tokenizer_12hz/modeling_qwen3_tts_tokenizer_v2.py @@ -614,32 +614,114 @@ class SnakeBeta(nn.Module): https://huggingface.co/papers/2006.08195 """ + _triton_kernel = None # None = untried, False = unavailable, callable = ready + _TRITON_MAX_BLOCK_T = 4096 # upper bound for time-axis tile size + + @staticmethod + def _init_triton(): + """Load and JIT-compile the fused Triton kernel (once).""" + if SnakeBeta._triton_kernel is not None: + return SnakeBeta._triton_kernel is not False + try: + import triton + import triton.language as tl + except ImportError: + SnakeBeta._triton_kernel = False + return False + + @triton.jit + def _kernel( # noqa: N803 + x_ptr, + exp_alpha_ptr, + inv_beta_ptr, + out_ptr, + stride_b, + stride_c, + t_len, + block_t: tl.constexpr, + ): + """Fused SnakeBeta using precomputed exp(α) and 1/(exp(β)+ε).""" + bid = tl.program_id(0) + cid = tl.program_id(1) + t_off = tl.program_id(2) * block_t + tl.arange(0, block_t) + mask = t_off < t_len + + x = tl.load(x_ptr + bid * stride_b + cid * stride_c + t_off, mask=mask, other=0.0) + ea = tl.load(exp_alpha_ptr + cid) + ib = tl.load(inv_beta_ptr + cid) + sin_val = tl.sin(x * ea) + result = x + ib * sin_val * sin_val + + tl.store(out_ptr + bid * stride_b + cid * stride_c + t_off, result, mask=mask) + + SnakeBeta._triton_kernel = _kernel + return True + def __init__(self, in_features, alpha=1.0): super().__init__() self.in_features = in_features - # initialize alpha self.alpha = Parameter(torch.zeros(in_features) * alpha) self.beta = Parameter(torch.zeros(in_features) * alpha) self.no_div_by_zero = 0.000000001 - def forward(self, hidden_states): - """ - Forward pass of the function. - Applies the function to the input elementwise. - SnakeBeta ∶= x + 1/b * sin^2 (xa) - """ - alpha = self.alpha.unsqueeze(0).unsqueeze(-1) # line up with x to [B, C, T] - beta = self.beta.unsqueeze(0).unsqueeze(-1) - alpha = torch.exp(alpha) - beta = torch.exp(beta) - hidden_states = hidden_states + (1.0 / (beta + self.no_div_by_zero)) * torch.pow( - torch.sin(hidden_states * alpha), 2 - ) + # Precomputed buffers (populated by precompute_exp_cache) + self.register_buffer("_exp_alpha", None, persistent=False) + self.register_buffer("_inv_beta", None, persistent=False) + def precompute_exp_cache(self): + """Materialize exp(alpha) and 1/(exp(beta)+eps) as frozen buffers.""" + with torch.no_grad(): + self._exp_alpha = torch.exp(self.alpha).contiguous() + self._inv_beta = (1.0 / (torch.exp(self.beta) + self.no_div_by_zero)).contiguous() + + @property + def _cached(self): + return self._exp_alpha is not None + + def forward(self, hidden_states): + """SnakeBeta := x + 1/b * sin^2(x*a)""" + if hidden_states.is_cuda and not torch.is_grad_enabled() and self._init_triton(): + try: + return self._triton_forward(hidden_states) + except Exception: + logger.warning("Triton SnakeBeta failed, falling back to eager", exc_info=True) + SnakeBeta._triton_kernel = False + return self._eager_forward(hidden_states) + + def _eager_forward(self, hidden_states): + if self._cached: + exp_alpha = self._exp_alpha.unsqueeze(0).unsqueeze(-1) + inv_beta = self._inv_beta.unsqueeze(0).unsqueeze(-1) + else: + exp_alpha = torch.exp(self.alpha).unsqueeze(0).unsqueeze(-1) + inv_beta = (1.0 / (torch.exp(self.beta) + self.no_div_by_zero)).unsqueeze(0).unsqueeze(-1) + hidden_states = hidden_states + inv_beta * torch.pow(torch.sin(hidden_states * exp_alpha), 2) return hidden_states + def _triton_forward(self, x): + import triton + + if not self._cached: + self.precompute_exp_cache() + + x = x.contiguous() + B, C, T = x.shape + out = torch.empty_like(x) + block_t = min(triton.next_power_of_2(T), self._TRITON_MAX_BLOCK_T) + self._triton_kernel[(B, C, triton.cdiv(T, block_t))]( + x, + self._exp_alpha, + self._inv_beta, + out, + x.stride(0), + x.stride(1), + t_len=T, + block_t=block_t, + ) + return out + class Qwen3TTSTokenizerV2DecoderDecoderResidualUnit(nn.Module): def __init__(self, dim: int = 16, dilation: int = 1): @@ -876,10 +958,22 @@ class Qwen3TTSTokenizerV2Decoder(Qwen3TTSTokenizerV2DecoderPreTrainedModel): self._cudagraph_enabled = False self._cudagraph_wrapper = None + def precompute_snake_caches(self): + """Precompute exp(alpha) and 1/(exp(beta)+eps) for all SnakeBeta modules.""" + count = 0 + for module in self.modules(): + if isinstance(module, SnakeBeta): + module.precompute_exp_cache() + count += 1 + if count > 0: + logger.info("Precomputed exp caches for %d SnakeBeta activations", count) + def enable_cudagraph( self, capture_sizes: list[int] | None = None, device: torch.device | None = None, + codec_chunk_frames: int = 0, + codec_left_context_frames: int = 0, ): from ..cuda_graph_decoder_wrapper import CUDAGraphDecoderWrapper @@ -888,16 +982,24 @@ class Qwen3TTSTokenizerV2Decoder(Qwen3TTSTokenizerV2DecoderPreTrainedModel): if device.type != "cuda": logger.warning("Cannot enable CUDA Graph: decoder is not on a CUDA device (got %s)", device) return + self._cudagraph_wrapper = CUDAGraphDecoderWrapper( decoder=self, capture_sizes=capture_sizes, num_quantizers=self.config.num_quantizers, enabled=True, ) - self._cudagraph_wrapper.warmup(device, dtype=torch.long) + self._cudagraph_wrapper.warmup( + device, + dtype=torch.long, + codec_chunk_frames=codec_chunk_frames, + codec_left_context_frames=codec_left_context_frames, + ) self._cudagraph_enabled = True - sizes = self._cudagraph_wrapper.capture_sizes - logger.info("CUDA Graph enabled for decoder with sizes: %s", sizes) + logger.info( + "CUDA Graph enabled for decoder: seq_lens=%s", + self._cudagraph_wrapper.capture_sizes, + ) def disable_cudagraph(self): self._cudagraph_enabled = False From b4342fb487dc2613009fa47631553a9b9f204dae Mon Sep 17 00:00:00 2001 From: Juan Pablo Zuluaga <46724788+JuanPZuluaga@users.noreply.github.com> Date: Fri, 20 Mar 2026 05:12:12 +0100 Subject: [PATCH 2/8] [Optim][Qwen3TTS][CodePredictor] support torch.compile with reduce-overhead and dynamic False (#1913) Signed-off-by: JuanPZuluaga Signed-off-by: JuanPZuluaga Co-authored-by: JuanPZuluaga --- .../qwen3_tts_code_predictor_vllm.py | 100 +++++++++++------- 1 file changed, 63 insertions(+), 37 deletions(-) diff --git a/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code_predictor_vllm.py b/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code_predictor_vllm.py index 2520a1d87..4a90b83af 100644 --- a/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code_predictor_vllm.py +++ b/vllm_omni/model_executor/models/qwen3_tts/qwen3_tts_code_predictor_vllm.py @@ -346,10 +346,13 @@ class Qwen3TTSTalkerCodePredictorForConditionalGenerationVLLM(nn.Module): # Pre-allocated buffers (lazily initialized on first forward). self._proj_buf: torch.Tensor | None = None - self._pos_ids: torch.Tensor | None = None - # torch.compile: fuse small kernels in the 5-layer transformer. - self._compiled_model_fwd: object | None = None + # torch.compile + warmup state (lazily initialized in _setup_compile). + self._compiled_model_fwd = None + self._bucket_sizes: list[int] = [] + self._bucket_pos_ids: dict[int, torch.Tensor] = {} + self._lm_heads_list: list[nn.Module] | None = None + self._codec_embeds_list: list[nn.Module] | None = None def get_input_embeddings(self) -> nn.ModuleList: return self.model.get_input_embeddings() @@ -374,54 +377,74 @@ class Qwen3TTSTalkerCodePredictorForConditionalGenerationVLLM(nn.Module): continue default_weight_loader(params[name], w) loaded.add(name) + return loaded # ------------------------------------------------------------------ # Pre-allocated buffer management # ------------------------------------------------------------------ - def _ensure_buffers(self, bsz: int, device: torch.device, dtype: torch.dtype) -> None: + def _ensure_buffers(self, device: torch.device, dtype: torch.dtype) -> None: max_seq = self._num_groups + 1 - if ( - self._proj_buf is not None - and self._proj_buf.shape[0] >= bsz - and self._proj_buf.device == device - and self._proj_buf.dtype == dtype - ): + if self._proj_buf is not None and self._proj_buf.device == device and self._proj_buf.dtype == dtype: return + max_bsz = self._vllm_config.scheduler_config.max_num_seqs self._proj_buf = torch.zeros( - bsz, + max_bsz, max_seq, self._cp_hidden, dtype=dtype, device=device, ) - self._pos_ids = torch.arange( - max_seq, - dtype=torch.long, - device=device, - ) def _setup_compile(self) -> None: """Lazily set up torch.compiled model forward for kernel fusion. - Uses ``mode="default"`` so Inductor performs operator fusion without - capturing its own CUDA graphs. This avoids conflicts with vLLM's - ``CUDAGraphWrapper`` which manages CUDA graphs for the main Talker - model on the default stream. + Uses ``mode="reduce-overhead"`` with ``dynamic=False`` so Inductor + captures internal CUDA graphs for fixed shapes, eliminating kernel + launch overhead entirely. """ if self._compiled_model_fwd is not None: return + self._lm_heads_list = list(self.lm_head) + self._codec_embeds_list = list(self.model.codec_embedding) if not current_omni_platform.supports_torch_inductor(): logger.warning_once("code_predictor: torch.compile disabled") self._compiled_model_fwd = self.model.forward return self._compiled_model_fwd = torch.compile( self.model.forward, - mode="default", - dynamic=True, + mode="reduce-overhead", + dynamic=False, ) - logger.info("code_predictor: torch.compile enabled (mode=default)") + logger.info("code_predictor: torch.compile enabled (mode=reduce-overhead, dynamic=False)") + self._warmup_compile() + + def _padded_bsz(self, bsz: int) -> int: + for bucket in self._bucket_sizes: + if bsz <= bucket: + return bucket + return bsz + + def _warmup_compile(self) -> None: + """Warmup power-of-2 batch-size buckets to front-load compilation.""" + max_bsz = self._vllm_config.scheduler_config.max_num_seqs + bucket_sizes = [1 << i for i in range(max_bsz.bit_length()) if (1 << i) <= max_bsz] + if max_bsz not in bucket_sizes: + bucket_sizes.append(max_bsz) + self._bucket_sizes = sorted(bucket_sizes) + + max_seq = self._num_groups + 1 + device = next(self.model.parameters()).device + base_pos = torch.arange(max_seq, device=device, dtype=torch.long) + + proj_buf = self._proj_buf + for bsz in self._bucket_sizes: + pos_ids = base_pos if bsz == 1 else base_pos.repeat(bsz) + self._bucket_pos_ids[bsz] = pos_ids + for _ in range(3): + self._compiled_model_fwd(proj_buf[:bsz, :max_seq, :], pos_ids) + logger.info("code_predictor: warmup done for bucket sizes %s", self._bucket_sizes) # ------------------------------------------------------------------ # Optimized forward: re-prefill + torch.compile + projection cache @@ -454,19 +477,16 @@ class Qwen3TTSTalkerCodePredictorForConditionalGenerationVLLM(nn.Module): all_codes = torch.empty(bsz, num_groups, dtype=torch.long, device=device) all_codes[:, 0] = layer0_code.reshape(bsz) - self._ensure_buffers(bsz, device, dtype) + self._ensure_buffers(device, dtype) self._setup_compile() proj_buf = self._proj_buf - pos_ids = self._pos_ids + max_seq = self._num_groups + 1 projection = self.small_to_mtp_projection model_fwd = self._compiled_model_fwd - lm_heads = list(self.lm_head) - codec_embeds = list(self.model.codec_embedding) - - proj_buf[:bsz, 0, :] = projection(last_talker_hidden.reshape(bsz, 1, -1)).reshape(bsz, -1) - proj_buf[:bsz, 1, :] = projection(layer0_embed.reshape(bsz, 1, -1)).reshape(bsz, -1) + lm_heads = self._lm_heads_list + codec_embeds = self._codec_embeds_list use_sampling = do_sample and temperature > 0 inv_temperature = 1.0 / max(temperature, 1e-6) if use_sampling else 0.0 @@ -475,15 +495,21 @@ class Qwen3TTSTalkerCodePredictorForConditionalGenerationVLLM(nn.Module): "top_p sampling is not implemented for the vLLM-native code predictor; please set top_p=1.0." ) + padded_bsz = self._padded_bsz(bsz) + proj_buf[:padded_bsz].zero_() + + proj_buf[:bsz, 0, :] = projection(last_talker_hidden.reshape(bsz, 1, -1)).reshape(bsz, -1) + proj_buf[:bsz, 1, :] = projection(layer0_embed.reshape(bsz, 1, -1)).reshape(bsz, -1) + full_pos_ids = self._bucket_pos_ids.get(padded_bsz) + if full_pos_ids is None: + base_pos = torch.arange(max_seq, device=device, dtype=torch.long) + full_pos_ids = base_pos if padded_bsz == 1 else base_pos.repeat(padded_bsz) + for step in range(1, num_groups): - seq_len = step + 1 + projected = proj_buf[:padded_bsz, :max_seq, :] - projected = proj_buf[:bsz, :seq_len, :] - step_pos_ids = pos_ids[:seq_len] if bsz == 1 else pos_ids[:seq_len].repeat(bsz) - - hidden_out = model_fwd(projected, step_pos_ids) - - logits = lm_heads[step - 1](hidden_out[:, -1, :]) + hidden_out = model_fwd(projected, full_pos_ids) + logits = lm_heads[step - 1](hidden_out[:bsz, step, :]) if use_sampling: scaled = logits * inv_temperature From c2a5420d9776f2bfcc4893e597c62ab98ce377ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=BF=97=E9=B9=8F?= Date: Fri, 20 Mar 2026 12:13:21 +0800 Subject: [PATCH 3/8] [CI] Change Bagel online test environment variable `VLLM_TEST_CLEAN_GPU_MEMORY` to `0` (#2032) Signed-off-by: princepride --- tests/e2e/online_serving/test_bagel_online.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/online_serving/test_bagel_online.py b/tests/e2e/online_serving/test_bagel_online.py index 62e79906c..36f0e1024 100644 --- a/tests/e2e/online_serving/test_bagel_online.py +++ b/tests/e2e/online_serving/test_bagel_online.py @@ -32,7 +32,7 @@ from tests.conftest import OmniServerParams from tests.utils import hardware_test os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn" -os.environ["VLLM_TEST_CLEAN_GPU_MEMORY"] = "1" +os.environ["VLLM_TEST_CLEAN_GPU_MEMORY"] = "0" MODEL = "ByteDance-Seed/BAGEL-7B-MoT" STAGE_CONFIGS_PATH = str( From 6813432f90335fd8ed981237d5f2c8123c334ded Mon Sep 17 00:00:00 2001 From: Chen-Yo Sun Date: Thu, 19 Mar 2026 22:05:39 -0700 Subject: [PATCH 4/8] [BugFix][Doc]Update voxtral_tts end2end.py & README.md (#2026) Signed-off-by: Chen-Yo Sun --- .../offline_inference/voxtral_tts/README.md | 51 +++++++++++-------- .../offline_inference/voxtral_tts/end2end.py | 2 +- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/examples/offline_inference/voxtral_tts/README.md b/examples/offline_inference/voxtral_tts/README.md index 7e0f84f2c..f552fd165 100644 --- a/examples/offline_inference/voxtral_tts/README.md +++ b/examples/offline_inference/voxtral_tts/README.md @@ -6,37 +6,44 @@ When `mistral_common` has `SpeechRequest` support, prompt token IDs are built vi ## Usage Examples -```bash -# Basic single-prompt with reference audio -python3 examples/offline_inference/voxtral_tts/end2end.py \ - --write-audio \ - --model mistralai/tts-model \ - --text "That eerie silence after the first storm was just the calm before another round of chaos, wasn't it?" \ - --audio-path path/to/reference_audio.wav -# 32 replicate prompts with reference audio +```bash +# Basic single-prompt with cheerful_female voice preset python3 examples/offline_inference/voxtral_tts/end2end.py \ - --num-prompts 32 --write-audio \ + --stage-configs-path vllm_omni/model_executor/stage_configs/voxtral_tts.yaml \ + --write-audio --voice cheerful_female \ --model mistralai/tts-model \ - --text "That eerie silence after the first storm was just the calm before another round of chaos, wasn't it?" \ - --audio-path path/to/reference_audio.wav + --text "That eerie silence after the first storm was just the calm before another round of chaos, wasn't it?" + +# 32 replicate prompts with cheerful_female voice preset +python3 examples/offline_inference/voxtral_tts/end2end.py \ + --stage-configs-path vllm_omni/model_executor/stage_configs/voxtral_tts.yaml \ + --num-prompts 32 --write-audio --voice cheerful_female \ + --model mistralai/tts-model \ + --text "That eerie silence after the first storm was just the calm before another round of chaos, wasn't it?" + +# Streaming with neutral_female voice preset +python3 examples/offline_inference/voxtral_tts/end2end.py \ + --stage-configs-path vllm_omni/model_executor/stage_configs/voxtral_tts.yaml \ + --streaming --write-audio --voice neutral_female \ + --model mistralai/tts-model \ + --text "That eerie silence after the first storm was just the calm before another round of chaos, wasn't it?" + +# 32 prompts, 8 concurrent requests per wave, streaming with neutral_female voice +python3 examples/offline_inference/voxtral_tts/end2end.py \ + --stage-configs-path vllm_omni/model_executor/stage_configs/voxtral_tts.yaml \ + --num-prompts 32 --concurrency 8 --streaming --write-audio --voice neutral_female \ + --model mistralai/tts-model \ + --text "That eerie silence after the first storm was just the calm before another round of chaos, wasn't it?" # Short debug prompt with reference audio +# Note: Reference audio capability is not yet released. python3 examples/offline_inference/voxtral_tts/end2end.py \ + --stage-configs-path vllm_omni/model_executor/stage_configs/voxtral_tts.yaml \ --write-audio \ --model mistralai/tts-model \ --text "This is a test message." \ --audio-path path/to/reference_audio.wav - -# Streaming with neutral_female voice preset -python3 examples/offline_inference/voxtral_tts/end2end.py \ - --streaming --write-audio --voice neutral_female \ - --model mistralai/tts-model - -# 32 prompts, 8 concurrent requests per wave, streaming with casual_male voice -python3 examples/offline_inference/voxtral_tts/end2end.py \ - --num-prompts 32 --concurrency 8 --streaming --write-audio --voice casual_male \ - --model mistralai/tts-model ``` ## Arguments @@ -47,7 +54,7 @@ python3 examples/offline_inference/voxtral_tts/end2end.py \ | `--text TEXT` | Text to synthesize (default: `"This is a test message."`) | | `--audio-path PATH` | Path to reference audio file for voice cloning | | `--output-dir DIR` | Directory to write output WAV files (default: `output_audio`) | -| `--stage-configs-path PATH` | Path to stage configs YAML (auto-resolved from model if not set) | +| `--stage-configs-path PATH` | Path to stage configs YAML (currently it must be set for VoxtralTTS) | | `--num-prompts N` | Number of replicate prompts to run for measuring performance (default: 1) | | `--streaming` | Use streaming generation via `AsyncOmni` (default: blocking `Omni`) | | `--concurrency N` | Max concurrent requests per wave (must be used with `--streaming`, must evenly divide `--num-prompts`) | diff --git a/examples/offline_inference/voxtral_tts/end2end.py b/examples/offline_inference/voxtral_tts/end2end.py index 569b5f6f3..d3052e5ca 100644 --- a/examples/offline_inference/voxtral_tts/end2end.py +++ b/examples/offline_inference/voxtral_tts/end2end.py @@ -208,7 +208,7 @@ def run_non_streaming(inputs, sampling_params_list, model_name, args, output_dir output_audio_dur = 0.0 for batch_idx, o in enumerate(outputs): - audio_tensor = torch.cat(o.request_output[0].outputs[0].multimodal_output["audio"]) + audio_tensor = torch.cat(o.multimodal_output["audio"]) audio_array = audio_tensor.tolist() output_audio_dur += float(len(audio_array)) / 24000 if args.write_audio: From 4c2293743b97ca95a3536f56959f144d3ac172d6 Mon Sep 17 00:00:00 2001 From: Samit <285365963@qq.com> Date: Fri, 20 Mar 2026 14:14:20 +0800 Subject: [PATCH 5/8] [Docs] Add Wan2.1-T2V as supported video generation models (#1920) Signed-off-by: samithuang <285365963@qq.com> --- docs/models/supported_models.md | 4 ++-- docs/user_guide/diffusion/parallelism_acceleration.md | 2 ++ docs/user_guide/diffusion_acceleration.md | 2 ++ docs/user_guide/examples/offline_inference/text_to_video.md | 5 ++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/models/supported_models.md b/docs/models/supported_models.md index a6925b7a1..ece7dffff 100644 --- a/docs/models/supported_models.md +++ b/docs/models/supported_models.md @@ -28,7 +28,7 @@ th { | `QwenImageLayeredPipeline` | Qwen-Image-Layered | `Qwen/Qwen-Image-Layered` | | `GlmImagePipeline` | GLM-Image | `zai-org/GLM-Image` | |`ZImagePipeline` | Z-Image | `Tongyi-MAI/Z-Image-Turbo` | -| `WanPipeline` | Wan2.2-T2V, Wan2.2-TI2V | `Wan-AI/Wan2.2-T2V-A14B-Diffusers`, `Wan-AI/Wan2.2-TI2V-5B-Diffusers` | +| `WanPipeline` | Wan2.1-T2V, Wan2.2-T2V, Wan2.2-TI2V | `Wan-AI/Wan2.1-T2V-1.3B-Diffusers`, `Wan-AI/Wan2.1-T2V-14B-Diffusers`, `Wan-AI/Wan2.2-T2V-A14B-Diffusers`, `Wan-AI/Wan2.2-TI2V-5B-Diffusers` | | `WanImageToVideoPipeline` | Wan2.2-I2V | `Wan-AI/Wan2.2-I2V-A14B-Diffusers` | | `LTX2Pipeline` | LTX-2-T2V | `Lightricks/LTX-2` | | `LTX2ImageToVideoPipeline` | LTX-2-I2V | `Lightricks/LTX-2` | @@ -76,7 +76,7 @@ th { | `QwenImageLayeredPipeline` | Qwen-Image-Layered | `Qwen/Qwen-Image-Layered` | | `QwenImageEditPlusPipeline` | Qwen-Image-Edit-2511 | `Qwen/Qwen-Image-Edit-2511` | |`ZImagePipeline` | Z-Image | `Tongyi-MAI/Z-Image-Turbo` | -| `WanPipeline` | Wan2.2-T2V, Wan2.2-TI2V | `Wan-AI/Wan2.2-T2V-A14B-Diffusers`, `Wan-AI/Wan2.2-TI2V-5B-Diffusers` | +| `WanPipeline` | Wan2.1-T2V, Wan2.2-T2V, Wan2.2-TI2V | `Wan-AI/Wan2.1-T2V-1.3B-Diffusers`, `Wan-AI/Wan2.1-T2V-14B-Diffusers`, `Wan-AI/Wan2.2-T2V-A14B-Diffusers`, `Wan-AI/Wan2.2-TI2V-5B-Diffusers` | | `WanImageToVideoPipeline` | Wan2.2-I2V | `Wan-AI/Wan2.2-I2V-A14B-Diffusers` | |`LongcatImagePipeline` | LongCat-Image | `meituan-longcat/LongCat-Image` | |`LongCatImageEditPipeline` | LongCat-Image-Edit | `meituan-longcat/LongCat-Image-Edit` | diff --git a/docs/user_guide/diffusion/parallelism_acceleration.md b/docs/user_guide/diffusion/parallelism_acceleration.md index 20f09d2c0..0d0658110 100644 --- a/docs/user_guide/diffusion/parallelism_acceleration.md +++ b/docs/user_guide/diffusion/parallelism_acceleration.md @@ -58,6 +58,8 @@ The following table shows which models are currently supported by parallelism me | Model | Model Identifier | Ulysses-SP | Ring-Attention | Tensor-Parallel | HSDP | VAE-Patch-Parallel | |-------|------------------|:----------:|:--------------:|:---------------:|:----:| :----:| +| **Wan2.1** | `Wan-AI/Wan2.1-T2V-1.3B-Diffusers` | ✅ | ✅ | ✅ | ✅ | ✅ | +| **Wan2.1** | `Wan-AI/Wan2.1-T2V-14B-Diffusers` | ✅ | ✅ | ✅ | ✅ | ✅ | | **Wan2.2** | `Wan-AI/Wan2.2-T2V-A14B-Diffusers` | ✅ | ✅ | ✅ | ✅ | ✅ | | **LTX-2** | `Lightricks/LTX-2` | ✅ | ✅ | ✅ | ❌ | ❌ | diff --git a/docs/user_guide/diffusion_acceleration.md b/docs/user_guide/diffusion_acceleration.md index 7ef470756..db05d5f3c 100644 --- a/docs/user_guide/diffusion_acceleration.md +++ b/docs/user_guide/diffusion_acceleration.md @@ -76,6 +76,8 @@ The following table shows which models are currently supported by each accelerat | Model | Model Identifier | TeaCache | Cache-DiT | Ulysses-SP | Ring-Attention | CFG-Parallel | HSDP | VAE-Patch-Parallel | |-------|------------------|:--------:|:---------:|:----------:|:--------------:|:------------:|:----:|:----:| +| **Wan2.1-T2V** | `Wan-AI/Wan2.1-T2V-1.3B-Diffusers` | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| **Wan2.1-T2V** | `Wan-AI/Wan2.1-T2V-14B-Diffusers` | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | **Wan2.2** | `Wan-AI/Wan2.2-T2V-A14B-Diffusers` | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | **LTX-2** | `Lightricks/LTX-2` | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | | **DreamID-Omni** | `XuGuo699/DreamID-Omni` | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | diff --git a/docs/user_guide/examples/offline_inference/text_to_video.md b/docs/user_guide/examples/offline_inference/text_to_video.md index 340ec6cad..70bdfb3cc 100644 --- a/docs/user_guide/examples/offline_inference/text_to_video.md +++ b/docs/user_guide/examples/offline_inference/text_to_video.md @@ -3,7 +3,10 @@ Source . -The `Wan-AI/Wan2.2-T2V-A14B-Diffusers` pipeline generates short videos from text prompts. +The Wan T2V pipeline generates short videos from text prompts. Supported models include: + +- `Wan-AI/Wan2.2-T2V-A14B-Diffusers` (14B, requires ~48GB VRAM) +- `Wan-AI/Wan2.1-T2V-1.3B-Diffusers` (1.3B, requires ~16GB VRAM, use `--flow-shift 3.0 --boundary-ratio 0.0`) ## Local CLI Usage From 05d8de813ec6ac9a93c51b73de2fb56beddd71eb Mon Sep 17 00:00:00 2001 From: Zhou Taichang Date: Fri, 20 Mar 2026 16:13:24 +0800 Subject: [PATCH 6/8] [Bugfix] Remove duplicated config keyword max batch size (#1851) Signed-off-by: tzhouam Signed-off-by: Zhou Taichang --- .../vllm_omni/configs/qwen3_tts_bs1.yaml | 4 +- .../vllm_omni/configs/qwen3_tts_bs4.yaml | 4 +- docs/configuration/gpu_memory_utilization.md | 2 +- docs/configuration/pd_disaggregation.md | 7 ++- docs/configuration/stage_configs.md | 10 ++-- .../stage_configs/qwen2_5_omni.yaml | 6 +- .../model/adding_diffusion_model.md | 2 +- docs/contributing/model/adding_tts_model.md | 4 +- docs/design/feature/async_chunk_design.md | 4 +- docs/getting_started/quickstart.md | 2 +- .../examples/offline_inference/bagel.md | 4 +- .../examples/offline_inference/qwen3_tts.md | 4 +- .../offline_inference/text_to_image.md | 2 +- examples/offline_inference/bagel/README.md | 4 +- .../offline_inference/qwen3_tts/README.md | 4 +- .../offline_inference/text_to_image/README.md | 2 +- .../qwen3_omni/qwen3_omni_moe_thinking.yaml | 2 +- tests/conftest.py | 2 +- .../stage_configs/bagel_mooncake_ci.yaml | 4 +- .../stage_configs/bagel_sharedmemory_ci.yaml | 4 +- .../stage_configs/npu/qwen2_5_omni_ci.yaml | 4 +- tests/e2e/stage_configs/qwen2_5_omni_ci.yaml | 4 +- .../qwen2_5_omni_thinker_ci.yaml | 1 - tests/e2e/stage_configs/qwen3_omni_ci.yaml | 6 +- .../stage_configs/rocm/qwen2_5_omni_ci.yaml | 4 +- .../e2e/stage_configs/rocm/qwen3_omni_ci.yaml | 6 +- .../stage_configs/xpu/qwen2_5_omni_ci.yaml | 6 +- .../e2e/stage_configs/xpu/qwen3_omni_ci.yaml | 6 +- tests/perf/stage_configs/qwen3_omni.yaml | 6 +- tests/perf/stage_configs/qwen3_tts.yaml | 4 +- tests/test_config_factory.py | 58 ++++++++++++++++++- vllm_omni/config/stage_config.py | 34 +++++++++-- vllm_omni/engine/async_omni_engine.py | 2 +- vllm_omni/entrypoints/utils.py | 3 - .../models/qwen3_tts/pipeline.yaml | 4 +- .../model_executor/stage_configs/bagel.yaml | 4 +- .../stage_configs/bagel_multiconnector.yaml | 4 +- .../stage_configs/fish_speech_s2_pro.yaml | 4 +- .../stage_configs/glm_image.yaml | 4 +- .../glm_image_muilticonnector.yaml | 4 +- .../stage_configs/hunyuan_image3_moe_dit.yaml | 2 +- .../stage_configs/hunyuan_image_3_moe.yaml | 2 +- .../stage_configs/mammoth_moda2.yaml | 4 +- .../stage_configs/mammoth_moda2_ar.yaml | 2 +- .../stage_configs/mimo_audio.yaml | 4 +- .../stage_configs/mimo_audio_async_chunk.yaml | 4 +- .../stage_configs/qwen2_5_omni.yaml | 6 +- .../qwen2_5_omni_multiconnector.yaml | 6 +- .../stage_configs/qwen3_omni_moe.yaml | 6 +- .../qwen3_omni_moe_async_chunk.yaml | 8 +-- .../qwen3_omni_moe_multiconnector.yaml | 6 +- .../stage_configs/qwen3_tts.yaml | 4 +- .../stage_configs/qwen3_tts_batch.yaml | 8 +-- .../qwen3_tts_no_async_chunk.yaml | 4 +- .../stage_configs/voxtral_tts.yaml | 4 +- .../stage_configs/voxtral_tts_1773881731.yaml | 8 +-- .../chunk_size_utils.py | 6 +- .../stage_configs/hunyuan_image3_moe_dit.yaml | 2 +- .../npu/stage_configs/qwen2_5_omni.yaml | 6 +- .../npu/stage_configs/qwen3_omni_moe.yaml | 6 +- .../qwen3_omni_moe_async_chunk.yaml | 8 +-- .../npu/stage_configs/qwen3_tts.yaml | 4 +- .../rocm/stage_configs/qwen2_5_omni.yaml | 6 +- .../rocm/stage_configs/qwen3_omni_moe.yaml | 6 +- .../platforms/xpu/stage_configs/bagel.yaml | 6 +- .../xpu/stage_configs/qwen2_5_omni.yaml | 6 +- .../xpu/stage_configs/qwen3_omni_moe.yaml | 6 +- 67 files changed, 226 insertions(+), 159 deletions(-) diff --git a/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs1.yaml b/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs1.yaml index d8e4072c0..5d730f605 100644 --- a/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs1.yaml +++ b/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs1.yaml @@ -6,8 +6,8 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: qwen3_tts model_arch: Qwen3TTSTalkerForConditionalGeneration worker_type: ar @@ -37,8 +37,8 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: code2wav model_arch: Qwen3TTSCode2Wav worker_type: generation diff --git a/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs4.yaml b/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs4.yaml index 93692d60d..10dc89564 100644 --- a/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs4.yaml +++ b/benchmarks/qwen3-tts/vllm_omni/configs/qwen3_tts_bs4.yaml @@ -7,8 +7,8 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 4 engine_args: + max_num_seqs: 4 model_stage: qwen3_tts model_arch: Qwen3TTSTalkerForConditionalGeneration worker_type: ar @@ -38,8 +38,8 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 4 engine_args: + max_num_seqs: 4 model_stage: code2wav model_arch: Qwen3TTSCode2Wav worker_type: generation diff --git a/docs/configuration/gpu_memory_utilization.md b/docs/configuration/gpu_memory_utilization.md index 19fc042aa..741066035 100644 --- a/docs/configuration/gpu_memory_utilization.md +++ b/docs/configuration/gpu_memory_utilization.md @@ -158,7 +158,7 @@ The stage initialized but ran out of memory during processing. **Solutions:** 1. Reduce `max_num_batched_tokens` -2. Reduce `max_batch_size` in runtime config +2. Reduce `max_num_seqs` in engine_args 3. Lower `gpu_memory_utilization` slightly 4. Enable quantization if supported diff --git a/docs/configuration/pd_disaggregation.md b/docs/configuration/pd_disaggregation.md index 5cd5d0e7f..1cf6189e6 100644 --- a/docs/configuration/pd_disaggregation.md +++ b/docs/configuration/pd_disaggregation.md @@ -32,8 +32,8 @@ stage_args: is_prefill_only: true runtime: devices: "0" - max_batch_size: 16 engine_args: + max_num_seqs: 16 model_stage: thinker model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar @@ -70,8 +70,8 @@ stage_args: is_decode_only: true runtime: devices: "1" - max_batch_size: 64 engine_args: + max_num_seqs: 64 model_stage: thinker model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar @@ -128,7 +128,8 @@ After inserting the extra thinker stage, renumber the remaining stages: - stage_id: 3 runtime: devices: "2" - max_batch_size: 1 + engine_args: + max_num_seqs: 1 engine_input_source: [2] custom_process_input_func: vllm_omni.model_executor.stage_input_processors.qwen3_omni.talker2code2wav ``` diff --git a/docs/configuration/stage_configs.md b/docs/configuration/stage_configs.md index d8a26d516..95c42afcc 100644 --- a/docs/configuration/stage_configs.md +++ b/docs/configuration/stage_configs.md @@ -36,9 +36,9 @@ stage_args: runtime: # The disaggregated configuration process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 # the batch_size for offline inference engine_args: # Engine arguments for a certain engine model_stage: thinker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration # The model implementation registered in model_executor/models/registry.py worker_type: ar # The specific worker used scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler # The specific scehduler used @@ -62,9 +62,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 3 engine_args: model_stage: talker + max_num_seqs: 3 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -88,9 +88,9 @@ stage_args: runtime: process: true devices: "0" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler @@ -159,9 +159,9 @@ Visible devices for this stage, specified as a string. This controls which GPU d Default: `"0"` -#### `runtime.max_batch_size` +#### `engine_args.max_num_seqs` -The maximum batch size for offline inference in this stage. This limits how many sequences can be processed together in a single batch during offline inference operations. +The maximum number of sequences for concurrent processing in this stage. For LLM stages, this controls the vLLM scheduler's maximum concurrent sequences. For all stage types, this also controls how many tasks can be batched together in the task processing loop. Default: `1` diff --git a/docs/configuration/stage_configs/qwen2_5_omni.yaml b/docs/configuration/stage_configs/qwen2_5_omni.yaml index 416ad137d..690577b84 100644 --- a/docs/configuration/stage_configs/qwen2_5_omni.yaml +++ b/docs/configuration/stage_configs/qwen2_5_omni.yaml @@ -4,9 +4,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -30,9 +30,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -56,9 +56,9 @@ stage_args: runtime: process: true devices: "0" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/docs/contributing/model/adding_diffusion_model.md b/docs/contributing/model/adding_diffusion_model.md index 3d04bf942..d044e74d7 100644 --- a/docs/contributing/model/adding_diffusion_model.md +++ b/docs/contributing/model/adding_diffusion_model.md @@ -967,7 +967,7 @@ hidden_states = hidden_states.reshape(batch_size, seq_len, -1) 1. **Reduce batch size:** ```python - omni.generate(prompts=[...], max_batch_size=2) + omni.generate(prompts=[...], max_num_seqs=2) ``` 2. **Use smaller image size:** diff --git a/docs/contributing/model/adding_tts_model.md b/docs/contributing/model/adding_tts_model.md index 6f642c7cd..e48ae5049 100644 --- a/docs/contributing/model/adding_tts_model.md +++ b/docs/contributing/model/adding_tts_model.md @@ -361,9 +361,9 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 64 engine_args: model_stage: ar_stage + max_num_seqs: 64 model_arch: YourTTSModelForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -403,9 +403,9 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 64 engine_args: model_stage: ar_stage + max_num_seqs: 64 model_arch: YourTTSModelForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler diff --git a/docs/design/feature/async_chunk_design.md b/docs/design/feature/async_chunk_design.md index 0416856fb..202ef0e18 100644 --- a/docs/design/feature/async_chunk_design.md +++ b/docs/design/feature/async_chunk_design.md @@ -171,7 +171,7 @@ stage_args: - `custom_process_next_stage_input_func: str`: Path to custom chunk processing function; receives `(transfer_manager, pooling_output, request)`. For qwen3-omni: `thinker2talker_async_chunk`, `talker2code2wav_async_chunk` - `stage_connector_config: dict`: Connector configuration - `worker_type: str`: Model type, e.g. `"ar"` or `"generation"` (used by OmniChunkTransferAdapter for mode-specific payload handling) -- `max_batch_size: int`: Maximum batch size for the stage +- `max_num_seqs: int`: Maximum number of sequences for concurrent processing in the stage ### Connector Configuration @@ -195,9 +195,9 @@ stage_args: - stage_id: 2 # code2wav stage runtime: devices: "1" - max_batch_size: 64 # Enables batched audio generation engine_args: model_stage: code2wav + max_num_seqs: 64 # Enables batched audio generation ``` ## Related Files diff --git a/docs/getting_started/quickstart.md b/docs/getting_started/quickstart.md index 9b1182c6b..8ded8f55a 100644 --- a/docs/getting_started/quickstart.md +++ b/docs/getting_started/quickstart.md @@ -82,7 +82,7 @@ if __name__ == "__main__": !!! info - For diffusion pipelines, the stage config field `stage_args.[].runtime.max_batch_size` is 1 by default, and the input + For diffusion pipelines, the stage config field `stage_args.[].engine_args.max_num_seqs` is 1 by default, and the input list is sliced into single-item requests before feeding into the diffusion pipeline. For models that do internally support batched inputs, you can [modify this configuration](../configuration/stage_configs.md) to let the model accept a longer batch of prompts. diff --git a/docs/user_guide/examples/offline_inference/bagel.md b/docs/user_guide/examples/offline_inference/bagel.md index cd245aa8d..5f458750b 100644 --- a/docs/user_guide/examples/offline_inference/bagel.md +++ b/docs/user_guide/examples/offline_inference/bagel.md @@ -130,7 +130,7 @@ The default yaml configuration deploys Thinker and DiT on the same GPU. You can | :------------------------------- | :------------------------------ | :----------------------- | | `stage_type` | `llm` | Stage type | | `devices` | `"0"` | GPU device ID | -| `max_batch_size` | `1` | Maximum batch size | +| `max_num_seqs` | `1` | Maximum batch size | | `model_stage` | `thinker` | Model stage identifier | | `model_arch` | `BagelForConditionalGeneration` | Model architecture | | `gpu_memory_utilization` | `0.4` | GPU memory utilization | @@ -146,7 +146,7 @@ The default yaml configuration deploys Thinker and DiT on the same GPU. You can | :------------------------------- | :---------- | :-------------------------- | | `stage_type` | `diffusion` | Stage type | | `devices` | `"0"` | GPU device ID | -| `max_batch_size` | `1` | Maximum batch size | +| `max_num_seqs` | `1` | Maximum batch size | | `model_stage` | `dit` | Model stage identifier | | `gpu_memory_utilization` | `0.4` | GPU memory utilization | | `omni_kv_config.need_recv_cache` | `true` | Whether to receive KV cache | diff --git a/docs/user_guide/examples/offline_inference/qwen3_tts.md b/docs/user_guide/examples/offline_inference/qwen3_tts.md index 352c076ad..d04a42014 100644 --- a/docs/user_guide/examples/offline_inference/qwen3_tts.md +++ b/docs/user_guide/examples/offline_inference/qwen3_tts.md @@ -107,7 +107,7 @@ completes. This demonstrates that audio data is available progressively rather t ## Batched Decoding -The Code2Wav stage (stage 1) supports batched decoding, where multiple requests are decoded in a single forward pass through the SpeechTokenizer. To use it, provide a stage config with `max_batch_size > 1` and pass multiple prompts via `--txt-prompts` with a matching `--batch-size`. +The Code2Wav stage (stage 1) supports batched decoding, where multiple requests are decoded in a single forward pass through the SpeechTokenizer. To use it, provide a stage config with `max_num_seqs > 1` and pass multiple prompts via `--txt-prompts` with a matching `--batch-size`. ``` python end2end.py --query-type CustomVoice \ @@ -116,7 +116,7 @@ python end2end.py --query-type CustomVoice \ --stage-configs-path vllm_omni/model_executor/stage_configs/qwen3_tts_batch.yaml ``` -**Important:** `--batch-size` must match a CUDA graph capture size (1, 2, 4, 8, 16...) because the Talker's code predictor KV cache is sized to `max_num_seqs`, and CUDA graphs pad the batch to the next capture size. Both stages need `max_batch_size >= batch_size` in the stage config for batching to take effect. If only stage 1 has a higher `max_batch_size`, it won't help — stage 1 can only batch chunks from requests that are in-flight simultaneously, which requires stage 0 to also process multiple requests concurrently. +**Important:** `--batch-size` must match a CUDA graph capture size (1, 2, 4, 8, 16...) because the Talker's code predictor KV cache is sized to `max_num_seqs`, and CUDA graphs pad the batch to the next capture size. Both stages need `max_num_seqs >= batch_size` in the stage config for batching to take effect. If only stage 1 has a higher `max_num_seqs`, it won't help — stage 1 can only batch chunks from requests that are in-flight simultaneously, which requires stage 0 to also process multiple requests concurrently. ## Notes diff --git a/docs/user_guide/examples/offline_inference/text_to_image.md b/docs/user_guide/examples/offline_inference/text_to_image.md index 653973fe4..ce000cc8b 100644 --- a/docs/user_guide/examples/offline_inference/text_to_image.md +++ b/docs/user_guide/examples/offline_inference/text_to_image.md @@ -49,7 +49,7 @@ if __name__ == "__main__": !!! info - For diffusion pipelines, the stage config field `stage_args.[].runtime.max_batch_size` is 1 by default, and the input + For diffusion pipelines, the stage config field `stage_args.[].engine_args.max_num_seqs` is 1 by default, and the input list is sliced into single-item requests before feeding into the diffusion pipeline. For models that do internally support batched inputs, you can [modify this configuration](https://github.com/vllm-project/vllm-omni/tree/main/configuration/stage_configs.md) to let the model accept a longer batch of prompts. diff --git a/examples/offline_inference/bagel/README.md b/examples/offline_inference/bagel/README.md index 9649a54c3..226c009f7 100644 --- a/examples/offline_inference/bagel/README.md +++ b/examples/offline_inference/bagel/README.md @@ -127,7 +127,7 @@ The default yaml configuration deploys Thinker and DiT on the same GPU. You can | :------------------------------- | :------------------------------ | :----------------------- | | `stage_type` | `llm` | Stage type | | `devices` | `"0"` | GPU device ID | -| `max_batch_size` | `1` | Maximum batch size | +| `max_num_seqs` | `1` | Maximum batch size | | `model_stage` | `thinker` | Model stage identifier | | `model_arch` | `BagelForConditionalGeneration` | Model architecture | | `gpu_memory_utilization` | `0.4` | GPU memory utilization | @@ -143,7 +143,7 @@ The default yaml configuration deploys Thinker and DiT on the same GPU. You can | :------------------------------- | :---------- | :-------------------------- | | `stage_type` | `diffusion` | Stage type | | `devices` | `"0"` | GPU device ID | -| `max_batch_size` | `1` | Maximum batch size | +| `max_num_seqs` | `1` | Maximum batch size | | `model_stage` | `dit` | Model stage identifier | | `gpu_memory_utilization` | `0.4` | GPU memory utilization | | `omni_kv_config.need_recv_cache` | `true` | Whether to receive KV cache | diff --git a/examples/offline_inference/qwen3_tts/README.md b/examples/offline_inference/qwen3_tts/README.md index ce2dd588e..90a2541bc 100644 --- a/examples/offline_inference/qwen3_tts/README.md +++ b/examples/offline_inference/qwen3_tts/README.md @@ -104,7 +104,7 @@ completes. This demonstrates that audio data is available progressively rather t ## Batched Decoding -The Code2Wav stage (stage 1) supports batched decoding, where multiple requests are decoded in a single forward pass through the SpeechTokenizer. To use it, provide a stage config with `max_batch_size > 1` and pass multiple prompts via `--txt-prompts` with a matching `--batch-size`. +The Code2Wav stage (stage 1) supports batched decoding, where multiple requests are decoded in a single forward pass through the SpeechTokenizer. To use it, provide a stage config with `max_num_seqs > 1` and pass multiple prompts via `--txt-prompts` with a matching `--batch-size`. ``` python end2end.py --query-type CustomVoice \ @@ -113,7 +113,7 @@ python end2end.py --query-type CustomVoice \ --stage-configs-path vllm_omni/model_executor/stage_configs/qwen3_tts_batch.yaml ``` -**Important:** `--batch-size` must match a CUDA graph capture size (1, 2, 4, 8, 16...) because the Talker's code predictor KV cache is sized to `max_num_seqs`, and CUDA graphs pad the batch to the next capture size. Both stages need `max_batch_size >= batch_size` in the stage config for batching to take effect. If only stage 1 has a higher `max_batch_size`, it won't help — stage 1 can only batch chunks from requests that are in-flight simultaneously, which requires stage 0 to also process multiple requests concurrently. +**Important:** `--batch-size` must match a CUDA graph capture size (1, 2, 4, 8, 16...) because the Talker's code predictor KV cache is sized to `max_num_seqs`, and CUDA graphs pad the batch to the next capture size. Both stages need `max_num_seqs >= batch_size` in the stage config for batching to take effect. If only stage 1 has a higher `max_num_seqs`, it won't help — stage 1 can only batch chunks from requests that are in-flight simultaneously, which requires stage 0 to also process multiple requests concurrently. ## Notes diff --git a/examples/offline_inference/text_to_image/README.md b/examples/offline_inference/text_to_image/README.md index 0de89c753..eabd349da 100644 --- a/examples/offline_inference/text_to_image/README.md +++ b/examples/offline_inference/text_to_image/README.md @@ -46,7 +46,7 @@ if __name__ == "__main__": !!! info - For diffusion pipelines, the stage config field `stage_args.[].runtime.max_batch_size` is 1 by default, and the input + For diffusion pipelines, the stage config field `stage_args.[].engine_args.max_num_seqs` is 1 by default, and the input list is sliced into single-item requests before feeding into the diffusion pipeline. For models that do internally support batched inputs, you can [modify this configuration](../../../configuration/stage_configs.md) to let the model accept a longer batch of prompts. diff --git a/examples/online_serving/qwen3_omni/qwen3_omni_moe_thinking.yaml b/examples/online_serving/qwen3_omni/qwen3_omni_moe_thinking.yaml index 34b63e26e..a32ca7d2d 100644 --- a/examples/online_serving/qwen3_omni/qwen3_omni_moe_thinking.yaml +++ b/examples/online_serving/qwen3_omni/qwen3_omni_moe_thinking.yaml @@ -9,9 +9,9 @@ stage_args: - stage_id: 0 runtime: devices: "0,1" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler diff --git a/tests/conftest.py b/tests/conftest.py index cac78bdad..1c8d1bef3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -843,7 +843,7 @@ def modify_stage_config( 'async_chunk': True, 'stage_args': { 0: {'engine_args.max_model_len': 5800}, - 1: {'runtime.max_batch_size': 2} + 1: {'engine_args.max_num_seqs': 2} } } deletes: Dictionary containing configurations to delete. diff --git a/tests/e2e/offline_inference/stage_configs/bagel_mooncake_ci.yaml b/tests/e2e/offline_inference/stage_configs/bagel_mooncake_ci.yaml index 7f3a3a6f4..590244acd 100644 --- a/tests/e2e/offline_inference/stage_configs/bagel_mooncake_ci.yaml +++ b/tests/e2e/offline_inference/stage_configs/bagel_mooncake_ci.yaml @@ -7,9 +7,9 @@ stage_args: prompt_expand_func: vllm_omni.model_executor.stage_input_processors.bagel.expand_cfg_prompts runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: BagelForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -44,9 +44,9 @@ stage_args: cfg_kv_collect_func: vllm_omni.model_executor.stage_input_processors.bagel.collect_cfg_kv_caches runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: dit + max_num_seqs: 1 gpu_memory_utilization: 0.45 enforce_eager: true trust_remote_code: true diff --git a/tests/e2e/offline_inference/stage_configs/bagel_sharedmemory_ci.yaml b/tests/e2e/offline_inference/stage_configs/bagel_sharedmemory_ci.yaml index aa3cc7718..b7999652e 100644 --- a/tests/e2e/offline_inference/stage_configs/bagel_sharedmemory_ci.yaml +++ b/tests/e2e/offline_inference/stage_configs/bagel_sharedmemory_ci.yaml @@ -7,9 +7,9 @@ stage_args: prompt_expand_func: vllm_omni.model_executor.stage_input_processors.bagel.expand_cfg_prompts runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: OmniBagelForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -43,9 +43,9 @@ stage_args: cfg_kv_collect_func: vllm_omni.model_executor.stage_input_processors.bagel.collect_cfg_kv_caches runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: dit + max_num_seqs: 1 gpu_memory_utilization: 0.45 enforce_eager: true trust_remote_code: true diff --git a/tests/e2e/offline_inference/stage_configs/npu/qwen2_5_omni_ci.yaml b/tests/e2e/offline_inference/stage_configs/npu/qwen2_5_omni_ci.yaml index acca96e53..f93a6c714 100644 --- a/tests/e2e/offline_inference/stage_configs/npu/qwen2_5_omni_ci.yaml +++ b/tests/e2e/offline_inference/stage_configs/npu/qwen2_5_omni_ci.yaml @@ -6,7 +6,6 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" - max_batch_size: 1 engine_args: model_stage: thinker model_arch: Qwen2_5OmniForConditionalGeneration @@ -37,7 +36,6 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker model_arch: Qwen2_5OmniForConditionalGeneration @@ -67,9 +65,9 @@ stage_args: runtime: process: true devices: "0" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/tests/e2e/stage_configs/qwen2_5_omni_ci.yaml b/tests/e2e/stage_configs/qwen2_5_omni_ci.yaml index f3a8ecf79..2d5690d00 100644 --- a/tests/e2e/stage_configs/qwen2_5_omni_ci.yaml +++ b/tests/e2e/stage_configs/qwen2_5_omni_ci.yaml @@ -7,7 +7,6 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: thinker model_arch: Qwen2_5OmniForConditionalGeneration @@ -38,7 +37,6 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker model_arch: Qwen2_5OmniForConditionalGeneration @@ -68,9 +66,9 @@ stage_args: runtime: process: true devices: "2" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/tests/e2e/stage_configs/qwen2_5_omni_thinker_ci.yaml b/tests/e2e/stage_configs/qwen2_5_omni_thinker_ci.yaml index 23eacafdf..940138284 100644 --- a/tests/e2e/stage_configs/qwen2_5_omni_thinker_ci.yaml +++ b/tests/e2e/stage_configs/qwen2_5_omni_thinker_ci.yaml @@ -3,7 +3,6 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: thinker model_arch: Qwen2_5OmniForConditionalGeneration diff --git a/tests/e2e/stage_configs/qwen3_omni_ci.yaml b/tests/e2e/stage_configs/qwen3_omni_ci.yaml index 6f1293f96..8b08bbb5e 100644 --- a/tests/e2e/stage_configs/qwen3_omni_ci.yaml +++ b/tests/e2e/stage_configs/qwen3_omni_ci.yaml @@ -8,9 +8,9 @@ stage_args: - stage_id: 0 runtime: devices: "0" - max_batch_size: 5 engine_args: model_stage: thinker + max_num_seqs: 5 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -42,9 +42,9 @@ stage_args: - stage_id: 1 runtime: devices: "1" - max_batch_size: 5 engine_args: model_stage: talker + max_num_seqs: 5 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -72,9 +72,9 @@ stage_args: - stage_id: 2 runtime: devices: "1" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/tests/e2e/stage_configs/rocm/qwen2_5_omni_ci.yaml b/tests/e2e/stage_configs/rocm/qwen2_5_omni_ci.yaml index b95afd223..0c756ce56 100644 --- a/tests/e2e/stage_configs/rocm/qwen2_5_omni_ci.yaml +++ b/tests/e2e/stage_configs/rocm/qwen2_5_omni_ci.yaml @@ -7,7 +7,6 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: thinker model_arch: Qwen2_5OmniForConditionalGeneration @@ -38,7 +37,6 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker model_arch: Qwen2_5OmniForConditionalGeneration @@ -68,9 +66,9 @@ stage_args: runtime: process: true devices: "0" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/tests/e2e/stage_configs/rocm/qwen3_omni_ci.yaml b/tests/e2e/stage_configs/rocm/qwen3_omni_ci.yaml index 23e75aae7..ac2b1fbd7 100644 --- a/tests/e2e/stage_configs/rocm/qwen3_omni_ci.yaml +++ b/tests/e2e/stage_configs/rocm/qwen3_omni_ci.yaml @@ -8,9 +8,9 @@ stage_args: - stage_id: 0 runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -39,9 +39,9 @@ stage_args: - stage_id: 1 runtime: devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -70,9 +70,9 @@ stage_args: - stage_id: 2 runtime: devices: "1" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/tests/e2e/stage_configs/xpu/qwen2_5_omni_ci.yaml b/tests/e2e/stage_configs/xpu/qwen2_5_omni_ci.yaml index 9feaaff67..1af08098a 100644 --- a/tests/e2e/stage_configs/xpu/qwen2_5_omni_ci.yaml +++ b/tests/e2e/stage_configs/xpu/qwen2_5_omni_ci.yaml @@ -7,8 +7,8 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: thinker model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar @@ -39,8 +39,8 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: talker model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar @@ -71,8 +71,8 @@ stage_args: runtime: process: true devices: "2" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: code2wav model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation diff --git a/tests/e2e/stage_configs/xpu/qwen3_omni_ci.yaml b/tests/e2e/stage_configs/xpu/qwen3_omni_ci.yaml index 49de8325a..c4586e066 100644 --- a/tests/e2e/stage_configs/xpu/qwen3_omni_ci.yaml +++ b/tests/e2e/stage_configs/xpu/qwen3_omni_ci.yaml @@ -9,8 +9,8 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "0,1,2,3" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: thinker model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar @@ -44,8 +44,8 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "4" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: talker model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar @@ -78,8 +78,8 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "5" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: code2wav model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation diff --git a/tests/perf/stage_configs/qwen3_omni.yaml b/tests/perf/stage_configs/qwen3_omni.yaml index 7b347c7f1..2add22b87 100644 --- a/tests/perf/stage_configs/qwen3_omni.yaml +++ b/tests/perf/stage_configs/qwen3_omni.yaml @@ -10,9 +10,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "0" - max_batch_size: 64 engine_args: model_stage: thinker + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -41,9 +41,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 64 engine_args: model_stage: talker + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -72,9 +72,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 64 engine_args: model_stage: code2wav + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/tests/perf/stage_configs/qwen3_tts.yaml b/tests/perf/stage_configs/qwen3_tts.yaml index 1ad568f26..dd69b248d 100644 --- a/tests/perf/stage_configs/qwen3_tts.yaml +++ b/tests/perf/stage_configs/qwen3_tts.yaml @@ -10,8 +10,8 @@ stage_args: is_comprehension: true runtime: devices: "0" - max_batch_size: 4 engine_args: + max_num_seqs: 4 model_stage: qwen3_tts model_arch: Qwen3TTSTalkerForConditionalGeneration worker_type: ar @@ -41,8 +41,8 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 4 engine_args: + max_num_seqs: 4 model_stage: code2wav model_arch: Qwen3TTSCode2Wav worker_type: generation diff --git a/tests/test_config_factory.py b/tests/test_config_factory.py index 21ef22523..e284de48d 100644 --- a/tests/test_config_factory.py +++ b/tests/test_config_factory.py @@ -83,6 +83,8 @@ class TestStageConfig: def test_to_omegaconf_with_runtime_overrides(self): """Test that runtime overrides are applied to OmegaConf output.""" + import warnings + config = StageConfig( stage_id=0, model_stage="thinker", @@ -93,12 +95,41 @@ class TestStageConfig: "max_batch_size": 64, }, ) - omega_config = config.to_omegaconf() + with warnings.catch_warnings(): + warnings.simplefilter("ignore", FutureWarning) + omega_config = config.to_omegaconf() assert omega_config.engine_args.gpu_memory_utilization == 0.9 assert omega_config.engine_args.tensor_parallel_size == 2 assert omega_config.runtime.devices == "0,1" - assert omega_config.runtime.max_batch_size == 64 + # max_batch_size is migrated to engine_args.max_num_seqs + assert omega_config.engine_args.max_num_seqs == 64 + + def test_to_omegaconf_max_batch_size_deprecation(self): + """Test that runtime.max_batch_size emits a FutureWarning.""" + import warnings + + config = StageConfig( + stage_id=0, + model_stage="thinker", + runtime_overrides={"max_batch_size": 8}, + ) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + config.to_omegaconf() + deprecation_warnings = [x for x in w if issubclass(x.category, FutureWarning)] + assert len(deprecation_warnings) == 1 + assert "max_batch_size" in str(deprecation_warnings[0].message) + + def test_to_omegaconf_max_num_seqs_in_engine_args(self): + """Test that max_num_seqs in yaml_engine_args takes precedence.""" + config = StageConfig( + stage_id=0, + model_stage="thinker", + yaml_engine_args={"max_num_seqs": 32}, + ) + omega_config = config.to_omegaconf() + assert omega_config.engine_args.max_num_seqs == 32 class TestModelPipeline: @@ -425,6 +456,29 @@ stages: errors = pipeline.validate_pipeline() assert errors == [], f"Unexpected validation errors: {errors}" + def test_parse_yaml_migrates_runtime_max_batch_size(self, tmp_path): + """Test that runtime.max_batch_size is migrated to engine_args.max_num_seqs.""" + yaml_content = """\ +model_type: legacy_batch +stages: + - stage_id: 0 + model_stage: entry + stage_type: llm + input_sources: [] + runtime: + devices: "0" + max_batch_size: 16 + engine_args: + model_arch: SomeModel +""" + yaml_file = tmp_path / "legacy_batch.yaml" + yaml_file.write_text(yaml_content) + + pipeline = StageConfigFactory._parse_pipeline_yaml(yaml_file, "legacy_batch") + s0 = pipeline.stages[0] + assert "max_batch_size" not in s0.yaml_runtime + assert s0.yaml_engine_args.get("max_num_seqs") == 16 + def test_parse_diffusion_stage_type(self, tmp_path): """Test parsing a diffusion stage type from YAML.""" yaml_content = """\ diff --git a/vllm_omni/config/stage_config.py b/vllm_omni/config/stage_config.py index d12bd10cc..a4e186c3b 100644 --- a/vllm_omni/config/stage_config.py +++ b/vllm_omni/config/stage_config.py @@ -11,6 +11,7 @@ Runtime parameters (gpu_memory_utilization, tp_size, etc.) come from CLI. from __future__ import annotations import re +import warnings from dataclasses import asdict, dataclass, field from enum import Enum from pathlib import Path @@ -74,7 +75,7 @@ class StageConfig: # Per-stage engine args from pipeline YAML (defaults) yaml_engine_args: dict[str, Any] = field(default_factory=dict) - # Per-stage runtime config from pipeline YAML (devices, max_batch_size) + # Per-stage runtime config from pipeline YAML (devices, etc.) yaml_runtime: dict[str, Any] = field(default_factory=dict) # Pass-through fields from pipeline YAML (default_sampling_params, # output_connectors, input_connectors, tts_args, etc.) @@ -109,13 +110,23 @@ class StageConfig: # Build runtime config from YAML defaults + CLI overrides runtime: dict[str, Any] = dict(self.yaml_runtime) runtime.setdefault("process", True) - runtime.setdefault("max_batch_size", self.runtime_overrides.get("max_batch_size", 1)) if "devices" in self.runtime_overrides: runtime["devices"] = self.runtime_overrides["devices"] - # Inject max_num_seqs from max_batch_size (legacy compat) - max_batch_size = int(runtime.get("max_batch_size", 1) or 1) - engine_args.setdefault("max_num_seqs", max_batch_size) + # Legacy compat: migrate runtime.max_batch_size → engine_args.max_num_seqs + legacy_mbs = runtime.pop("max_batch_size", None) + cli_mbs = self.runtime_overrides.get("max_batch_size") + if legacy_mbs is not None or cli_mbs is not None: + warnings.warn( + "runtime.max_batch_size is deprecated and will be removed in a " + "future release. Use engine_args.max_num_seqs instead.", + FutureWarning, + stacklevel=2, + ) + effective_mbs = int(cli_mbs or legacy_mbs or 1) + engine_args.setdefault("max_num_seqs", effective_mbs) + + engine_args.setdefault("max_num_seqs", 1) # Build full config dict config_dict: dict[str, Any] = { @@ -322,13 +333,14 @@ class StageConfigFactory: if "dtype" in engine_args: engine_args["dtype"] = str(engine_args["dtype"]) + engine_args.setdefault("max_num_seqs", 1) + config_dict: dict[str, Any] = { "stage_id": 0, "stage_type": StageType.DIFFUSION.value, "runtime": { "process": True, "devices": devices, - "max_batch_size": 1, }, "engine_args": create_config(engine_args), "final_output": True, @@ -426,6 +438,16 @@ class StageConfigFactory: raw_rt = stage_data.get("runtime", None) yaml_runtime = to_dict(raw_rt) if raw_rt is not None else {} + # Migrate legacy runtime.max_batch_size → engine_args.max_num_seqs + if "max_batch_size" in yaml_runtime: + mbs = yaml_runtime.pop("max_batch_size") + yaml_engine_args.setdefault("max_num_seqs", int(mbs)) + logger.debug( + "Stage %s: migrated runtime.max_batch_size=%s to engine_args.max_num_seqs", + stage_data.get("stage_id", "?"), + mbs, + ) + # Topology-level fields that also live inside engine_args in legacy # YAMLs (worker_type, scheduler_cls, etc.) — read from both places. worker_type = stage_data.get("worker_type", None) or yaml_engine_args.pop("worker_type", None) diff --git a/vllm_omni/engine/async_omni_engine.py b/vllm_omni/engine/async_omni_engine.py index 56eb3b5cc..5562b84ff 100644 --- a/vllm_omni/engine/async_omni_engine.py +++ b/vllm_omni/engine/async_omni_engine.py @@ -825,9 +825,9 @@ class AsyncOmniEngine: "runtime": { "process": True, "devices": devices, - "max_batch_size": 1, }, "engine_args": { + "max_num_seqs": 1, "parallel_config": parallel_config, "model_class_name": kwargs.get("model_class_name", None), "vae_use_slicing": kwargs.get("vae_use_slicing", False), diff --git a/vllm_omni/entrypoints/utils.py b/vllm_omni/entrypoints/utils.py index 0e31bfa7c..619aac5d4 100644 --- a/vllm_omni/entrypoints/utils.py +++ b/vllm_omni/entrypoints/utils.py @@ -288,9 +288,6 @@ def load_stage_configs_from_yaml(config_path: str, base_engine_args: dict | None base_engine_args_tmp = create_config(merge_configs(base_engine_args_tmp, stage_arg.engine_args)) stage_type = getattr(stage_arg, "stage_type", "llm") if hasattr(stage_arg, "runtime") and stage_arg.runtime is not None and stage_type != "diffusion": - runtime_cfg = stage_arg.runtime - max_batch_size = int(runtime_cfg.get("max_batch_size", 1) or 1) - base_engine_args_tmp["max_num_seqs"] = max_batch_size base_engine_args_tmp.async_chunk = global_async_chunk stage_arg.engine_args = base_engine_args_tmp return stage_args diff --git a/vllm_omni/model_executor/models/qwen3_tts/pipeline.yaml b/vllm_omni/model_executor/models/qwen3_tts/pipeline.yaml index 75e9dc1b1..67e95d562 100644 --- a/vllm_omni/model_executor/models/qwen3_tts/pipeline.yaml +++ b/vllm_omni/model_executor/models/qwen3_tts/pipeline.yaml @@ -11,8 +11,8 @@ stages: scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler runtime: devices: "0" - max_batch_size: 10 engine_args: + max_num_seqs: 10 model_arch: Qwen3TTSTalkerForConditionalGeneration hf_overrides: architectures: [Qwen3TTSTalkerForConditionalGeneration] @@ -47,8 +47,8 @@ stages: final_output_type: audio runtime: devices: "0" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_arch: Qwen3TTSCode2Wav hf_overrides: architectures: [Qwen3TTSCode2Wav] diff --git a/vllm_omni/model_executor/stage_configs/bagel.yaml b/vllm_omni/model_executor/stage_configs/bagel.yaml index 4bce816b4..b0c1b0480 100644 --- a/vllm_omni/model_executor/stage_configs/bagel.yaml +++ b/vllm_omni/model_executor/stage_configs/bagel.yaml @@ -7,9 +7,9 @@ stage_args: runtime: devices: "0" # 3 = 1 user prompt + 2 CFG companions (text-unconditional + image-unconditional). - max_batch_size: 3 engine_args: model_stage: thinker + max_num_seqs: 3 model_arch: OmniBagelForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -42,9 +42,9 @@ stage_args: cfg_kv_collect_func: vllm_omni.model_executor.stage_input_processors.bagel.collect_cfg_kv_caches runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: dit + max_num_seqs: 1 gpu_memory_utilization: 0.45 enforce_eager: true trust_remote_code: true diff --git a/vllm_omni/model_executor/stage_configs/bagel_multiconnector.yaml b/vllm_omni/model_executor/stage_configs/bagel_multiconnector.yaml index 93700b6f3..4919395ca 100644 --- a/vllm_omni/model_executor/stage_configs/bagel_multiconnector.yaml +++ b/vllm_omni/model_executor/stage_configs/bagel_multiconnector.yaml @@ -5,9 +5,9 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: BagelForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -42,9 +42,9 @@ stage_args: stage_type: diffusion runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: dit + max_num_seqs: 1 gpu_memory_utilization: 0.45 enforce_eager: true trust_remote_code: true diff --git a/vllm_omni/model_executor/stage_configs/fish_speech_s2_pro.yaml b/vllm_omni/model_executor/stage_configs/fish_speech_s2_pro.yaml index a847cb181..c00528d10 100644 --- a/vllm_omni/model_executor/stage_configs/fish_speech_s2_pro.yaml +++ b/vllm_omni/model_executor/stage_configs/fish_speech_s2_pro.yaml @@ -4,8 +4,8 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 4 engine_args: + max_num_seqs: 4 model_stage: fish_speech_slow_ar model_arch: FishSpeechSlowARForConditionalGeneration worker_type: ar @@ -37,8 +37,8 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: dac_decoder model_arch: FishSpeechDACDecoder worker_type: generation diff --git a/vllm_omni/model_executor/stage_configs/glm_image.yaml b/vllm_omni/model_executor/stage_configs/glm_image.yaml index 8128847c7..3cc23e1e2 100644 --- a/vllm_omni/model_executor/stage_configs/glm_image.yaml +++ b/vllm_omni/model_executor/stage_configs/glm_image.yaml @@ -11,10 +11,10 @@ stage_args: runtime: process: true devices: "0" - max_batch_size: 1 requires_multimodal_data: true # Required for i2i mode to receive source images engine_args: model_stage: ar + max_num_seqs: 1 model_arch: GlmImageForConditionalGeneration model_subdir: vision_language_encoder # AR model config.json is in this subdirectory tokenizer_subdir: processor # Use processor's tokenizer (not ByT5 from tokenizer/) @@ -45,10 +45,10 @@ stage_args: runtime: process: true devices: "1" # Can use different GPU, or same GPU if memory allows - max_batch_size: 1 requires_multimodal_data: true # Required for i2i mode to pass condition images engine_args: model_stage: dit + max_num_seqs: 1 model_arch: GlmImagePipeline # Required for diffusion model class resolution # Diffusion-specific parameters num_gpus: 1 diff --git a/vllm_omni/model_executor/stage_configs/glm_image_muilticonnector.yaml b/vllm_omni/model_executor/stage_configs/glm_image_muilticonnector.yaml index 91fbf7659..719c73a9f 100644 --- a/vllm_omni/model_executor/stage_configs/glm_image_muilticonnector.yaml +++ b/vllm_omni/model_executor/stage_configs/glm_image_muilticonnector.yaml @@ -14,10 +14,10 @@ stage_args: runtime: process: true devices: "0" - max_batch_size: 1 requires_multimodal_data: true # Required for i2i mode to receive source images engine_args: model_stage: ar + max_num_seqs: 1 model_arch: GlmImageForConditionalGeneration worker_cls: vllm_omni.worker.gpu_ar_worker.GPUARWorker scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -47,10 +47,10 @@ stage_args: runtime: process: true devices: "1" # Use separate GPU for diffusion - max_batch_size: 1 requires_multimodal_data: true # Required for i2i mode to pass condition images engine_args: model_stage: dit + max_num_seqs: 1 # Diffusion-specific parameters num_gpus: 1 enforce_eager: true diff --git a/vllm_omni/model_executor/stage_configs/hunyuan_image3_moe_dit.yaml b/vllm_omni/model_executor/stage_configs/hunyuan_image3_moe_dit.yaml index eac7f2d63..0b812ff37 100644 --- a/vllm_omni/model_executor/stage_configs/hunyuan_image3_moe_dit.yaml +++ b/vllm_omni/model_executor/stage_configs/hunyuan_image3_moe_dit.yaml @@ -8,8 +8,8 @@ stage_args: stage_type: diffusion runtime: devices: "0,1,2,3" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: dit gpu_memory_utilization: 0.65 enforce_eager: true diff --git a/vllm_omni/model_executor/stage_configs/hunyuan_image_3_moe.yaml b/vllm_omni/model_executor/stage_configs/hunyuan_image_3_moe.yaml index 119047fb1..01d7dcca9 100644 --- a/vllm_omni/model_executor/stage_configs/hunyuan_image_3_moe.yaml +++ b/vllm_omni/model_executor/stage_configs/hunyuan_image_3_moe.yaml @@ -8,9 +8,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0,1,2,3,4,5,6,7" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: AR + max_num_seqs: 1 model_arch: HunyuanImage3ForCausalMM worker_cls: vllm_omni.worker.gpu_ar_worker.GPUARWorker scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler diff --git a/vllm_omni/model_executor/stage_configs/mammoth_moda2.yaml b/vllm_omni/model_executor/stage_configs/mammoth_moda2.yaml index 505548ecc..f4f523ac5 100644 --- a/vllm_omni/model_executor/stage_configs/mammoth_moda2.yaml +++ b/vllm_omni/model_executor/stage_configs/mammoth_moda2.yaml @@ -8,9 +8,9 @@ stage_args: - stage_id: 0 runtime: devices: "0" - max_batch_size: 100 engine_args: model_stage: ar + max_num_seqs: 100 model_arch: MammothModa2ForConditionalGeneration worker_cls: vllm_omni.worker.gpu_ar_worker.GPUARWorker scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -25,9 +25,9 @@ stage_args: - stage_id: 1 runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: dit + max_num_seqs: 1 model_arch: MammothModa2ForConditionalGeneration worker_cls: vllm_omni.worker.gpu_generation_worker.GPUGenerationWorker scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/mammoth_moda2_ar.yaml b/vllm_omni/model_executor/stage_configs/mammoth_moda2_ar.yaml index f95ed2b3d..d455c7973 100644 --- a/vllm_omni/model_executor/stage_configs/mammoth_moda2_ar.yaml +++ b/vllm_omni/model_executor/stage_configs/mammoth_moda2_ar.yaml @@ -8,9 +8,9 @@ stage_args: - stage_id: 0 runtime: devices: "0" - max_batch_size: 16 engine_args: model_stage: ar + max_num_seqs: 16 model_arch: MammothModa2ForConditionalGeneration worker_cls: vllm_omni.worker.gpu_ar_worker.GPUARWorker scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler diff --git a/vllm_omni/model_executor/stage_configs/mimo_audio.yaml b/vllm_omni/model_executor/stage_configs/mimo_audio.yaml index 0807b68ca..dd6f24cc6 100644 --- a/vllm_omni/model_executor/stage_configs/mimo_audio.yaml +++ b/vllm_omni/model_executor/stage_configs/mimo_audio.yaml @@ -8,9 +8,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: dtype: bfloat16 + max_num_seqs: 1 model_stage: fused_thinker_talker model_arch: MiMoAudioForConditionalGeneration worker_type: ar @@ -40,9 +40,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: MiMoAudioForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/mimo_audio_async_chunk.yaml b/vllm_omni/model_executor/stage_configs/mimo_audio_async_chunk.yaml index ef9e1dedb..04f7e656e 100644 --- a/vllm_omni/model_executor/stage_configs/mimo_audio_async_chunk.yaml +++ b/vllm_omni/model_executor/stage_configs/mimo_audio_async_chunk.yaml @@ -8,9 +8,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: dtype: bfloat16 + max_num_seqs: 1 model_stage: fused_thinker_talker model_arch: MiMoAudioForConditionalGeneration worker_type: ar @@ -41,9 +41,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: MiMoAudioForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/qwen2_5_omni.yaml b/vllm_omni/model_executor/stage_configs/qwen2_5_omni.yaml index c66d0fcd4..0a307b447 100644 --- a/vllm_omni/model_executor/stage_configs/qwen2_5_omni.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen2_5_omni.yaml @@ -7,9 +7,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -37,9 +37,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -66,9 +66,9 @@ stage_args: runtime: process: true devices: "0" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/qwen2_5_omni_multiconnector.yaml b/vllm_omni/model_executor/stage_configs/qwen2_5_omni_multiconnector.yaml index 927d71b49..6e4f871e3 100644 --- a/vllm_omni/model_executor/stage_configs/qwen2_5_omni_multiconnector.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen2_5_omni_multiconnector.yaml @@ -7,9 +7,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -38,9 +38,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -70,9 +70,9 @@ stage_args: runtime: process: true devices: "2" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/qwen3_omni_moe.yaml b/vllm_omni/model_executor/stage_configs/qwen3_omni_moe.yaml index 759590bfc..0ce4f0c94 100644 --- a/vllm_omni/model_executor/stage_configs/qwen3_omni_moe.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen3_omni_moe.yaml @@ -10,9 +10,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "0" - max_batch_size: 64 engine_args: model_stage: thinker + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -41,9 +41,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 64 engine_args: model_stage: talker + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -72,9 +72,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 32 engine_args: model_stage: code2wav + max_num_seqs: 32 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_async_chunk.yaml b/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_async_chunk.yaml index d38302f8e..38626fc08 100644 --- a/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_async_chunk.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_async_chunk.yaml @@ -10,9 +10,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "0" - max_batch_size: 64 engine_args: model_stage: thinker + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -45,9 +45,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 64 engine_args: model_stage: talker + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -79,9 +79,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 64 engine_args: model_stage: code2wav + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler @@ -92,7 +92,7 @@ stage_args: engine_output_type: audio # Final output: audio waveform gpu_memory_utilization: 0.1 distributed_executor_backend: "mp" - max_num_batched_tokens: 51200 # [TODO] if max_num_batch_tokens < max_batch_size * 800, there will be precision problem. + max_num_batched_tokens: 51200 # [TODO] if max_num_batch_tokens < max_num_seqs * 800, there will be precision problem. hf_config_name: thinker_config engine_input_source: [1] final_output: true diff --git a/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_multiconnector.yaml b/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_multiconnector.yaml index b91937b0c..6c2d2a766 100644 --- a/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_multiconnector.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen3_omni_moe_multiconnector.yaml @@ -9,9 +9,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -42,9 +42,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -78,9 +78,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "1" - max_batch_size: 64 engine_args: model_stage: code2wav + max_num_seqs: 64 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/qwen3_tts.yaml b/vllm_omni/model_executor/stage_configs/qwen3_tts.yaml index f92874bf6..543f57ba7 100644 --- a/vllm_omni/model_executor/stage_configs/qwen3_tts.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen3_tts.yaml @@ -5,9 +5,9 @@ stage_args: is_comprehension: true runtime: devices: "0" - max_batch_size: 10 engine_args: model_stage: qwen3_tts + max_num_seqs: 10 model_arch: Qwen3TTSTalkerForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -37,9 +37,9 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3TTSCode2Wav worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/qwen3_tts_batch.yaml b/vllm_omni/model_executor/stage_configs/qwen3_tts_batch.yaml index 23557bf23..e8c35fb8d 100644 --- a/vllm_omni/model_executor/stage_configs/qwen3_tts_batch.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen3_tts_batch.yaml @@ -1,6 +1,6 @@ # Same as qwen3_tts.yaml with batched talker and code2wav. -# Stage 0: max_batch_size 4, stage 1: max_batch_size 4. -# max_batch_size must be a power of two to align with CUDA graph capture sizes +# Stage 0: max_num_seqs 4, stage 1: max_num_seqs 4. +# max_num_seqs must be a power of two to align with CUDA graph capture sizes # (stage 0) and must match --batch-size in end2end.py / benchmark scripts. async_chunk: true stage_args: @@ -9,9 +9,9 @@ stage_args: is_comprehension: true runtime: devices: "0" - max_batch_size: 4 engine_args: model_stage: qwen3_tts + max_num_seqs: 4 model_arch: Qwen3TTSTalkerForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -41,9 +41,9 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 4 engine_args: model_stage: code2wav + max_num_seqs: 4 model_arch: Qwen3TTSCode2Wav worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/qwen3_tts_no_async_chunk.yaml b/vllm_omni/model_executor/stage_configs/qwen3_tts_no_async_chunk.yaml index f559bdebd..678222167 100644 --- a/vllm_omni/model_executor/stage_configs/qwen3_tts_no_async_chunk.yaml +++ b/vllm_omni/model_executor/stage_configs/qwen3_tts_no_async_chunk.yaml @@ -5,9 +5,9 @@ stage_args: is_comprehension: true runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: qwen3_tts + max_num_seqs: 1 model_arch: Qwen3TTSTalkerForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -33,9 +33,9 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3TTSCode2Wav worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/model_executor/stage_configs/voxtral_tts.yaml b/vllm_omni/model_executor/stage_configs/voxtral_tts.yaml index bb791e080..31cccb9cc 100644 --- a/vllm_omni/model_executor/stage_configs/voxtral_tts.yaml +++ b/vllm_omni/model_executor/stage_configs/voxtral_tts.yaml @@ -5,8 +5,8 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 32 engine_args: + max_num_seqs: 32 model_stage: audio_generation model_arch: VoxtralTTSForConditionalGeneration worker_type: ar @@ -43,8 +43,8 @@ stage_args: runtime: process: true devices: "0" - max_batch_size: 32 engine_args: + max_num_seqs: 32 model_stage: audio_tokenizer model_arch: VoxtralTTSForConditionalGeneration worker_type: generation diff --git a/vllm_omni/model_executor/stage_configs/voxtral_tts_1773881731.yaml b/vllm_omni/model_executor/stage_configs/voxtral_tts_1773881731.yaml index d004402b2..287d82895 100644 --- a/vllm_omni/model_executor/stage_configs/voxtral_tts_1773881731.yaml +++ b/vllm_omni/model_executor/stage_configs/voxtral_tts_1773881731.yaml @@ -2,8 +2,8 @@ async_chunk: true stage_args: - stage_id: 0 stage_type: llm - runtime: {process: true, devices: '0', max_batch_size: 32} - engine_args: {model_stage: audio_generation, model_arch: VoxtralTTSForConditionalGeneration, + runtime: {process: true, devices: '0'} + engine_args: {max_num_seqs: 32, model_stage: audio_generation, model_arch: VoxtralTTSForConditionalGeneration, worker_type: ar, worker_cls: vllm_omni.worker.gpu_ar_worker.GPUARWorker, scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler, gpu_memory_utilization: 0.8, enforce_eager: false, trust_remote_code: true, async_scheduling: true, engine_output_type: latent, enable_prefix_caching: false, tokenizer_mode: mistral, @@ -17,8 +17,8 @@ stage_args: seed: 42, detokenize: true, repetition_penalty: 1.1} - stage_id: 1 stage_type: llm - runtime: {process: true, devices: '0', max_batch_size: 32} - engine_args: {model_stage: audio_tokenizer, model_arch: VoxtralTTSForConditionalGeneration, + runtime: {process: true, devices: '0'} + engine_args: {max_num_seqs: 32, model_stage: audio_tokenizer, model_arch: VoxtralTTSForConditionalGeneration, worker_type: generation, worker_cls: vllm_omni.worker.gpu_generation_worker.GPUGenerationWorker, scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler, async_scheduling: false, gpu_memory_utilization: 0.1, enforce_eager: true, trust_remote_code: true, diff --git a/vllm_omni/model_executor/stage_input_processors/chunk_size_utils.py b/vllm_omni/model_executor/stage_input_processors/chunk_size_utils.py index 7bdec0bb3..8b8956839 100644 --- a/vllm_omni/model_executor/stage_input_processors/chunk_size_utils.py +++ b/vllm_omni/model_executor/stage_input_processors/chunk_size_utils.py @@ -11,7 +11,7 @@ def max_ic_for_chunk_size(chunk_size: int) -> int: def compute_dynamic_initial_chunk_size( active_requests: int, - max_batch_size: int, + max_num_seqs: int, max_ic: int, ) -> int: """Select IC from power-of-2 steps [2, 4, ..., max_ic] based on load factor. @@ -26,8 +26,8 @@ def compute_dynamic_initial_chunk_size( v <<= 1 if not steps: return max(1, max_ic) - if max_batch_size <= 0: + if max_num_seqs <= 0: return steps[0] - load_factor = min(active_requests / max_batch_size, 1.0) + load_factor = min(active_requests / max_num_seqs, 1.0) idx = int(round(load_factor * (len(steps) - 1))) return steps[idx] diff --git a/vllm_omni/platforms/npu/stage_configs/hunyuan_image3_moe_dit.yaml b/vllm_omni/platforms/npu/stage_configs/hunyuan_image3_moe_dit.yaml index 270e0c718..053e8a8cc 100644 --- a/vllm_omni/platforms/npu/stage_configs/hunyuan_image3_moe_dit.yaml +++ b/vllm_omni/platforms/npu/stage_configs/hunyuan_image3_moe_dit.yaml @@ -8,8 +8,8 @@ stage_args: stage_type: diffusion runtime: devices: "0,1,2,3,4,5,6,7" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: dit gpu_memory_utilization: 0.65 enforce_eager: true diff --git a/vllm_omni/platforms/npu/stage_configs/qwen2_5_omni.yaml b/vllm_omni/platforms/npu/stage_configs/qwen2_5_omni.yaml index 02a6b0dd2..8f7af161d 100644 --- a/vllm_omni/platforms/npu/stage_configs/qwen2_5_omni.yaml +++ b/vllm_omni/platforms/npu/stage_configs/qwen2_5_omni.yaml @@ -5,9 +5,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -32,9 +32,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -59,9 +59,9 @@ stage_args: runtime: process: true devices: "2" # Example: use a different NPU than the previous stage; use "0" if single NPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe.yaml b/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe.yaml index 706bee5dd..59ed8611e 100644 --- a/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe.yaml +++ b/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe.yaml @@ -8,9 +8,9 @@ stage_args: - stage_id: 0 runtime: devices: "0,1" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -37,9 +37,9 @@ stage_args: - stage_id: 1 runtime: devices: "2" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -67,9 +67,9 @@ stage_args: - stage_id: 2 runtime: devices: "2" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe_async_chunk.yaml b/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe_async_chunk.yaml index 27f0ffcc2..9aa20baec 100644 --- a/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe_async_chunk.yaml +++ b/vllm_omni/platforms/npu/stage_configs/qwen3_omni_moe_async_chunk.yaml @@ -10,8 +10,8 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "0,1" - max_batch_size: 10 engine_args: + max_num_seqs: 10 model_stage: thinker model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar @@ -42,8 +42,8 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "2" - max_batch_size: 10 engine_args: + max_num_seqs: 10 model_stage: talker model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar @@ -73,8 +73,8 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "2" - max_batch_size: 10 engine_args: + max_num_seqs: 10 model_stage: code2wav model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation @@ -86,7 +86,7 @@ stage_args: engine_output_type: audio # Final output: audio waveform gpu_memory_utilization: 0.3 distributed_executor_backend: "mp" - max_num_batched_tokens: 51200 # [TODO] if max_num_batch_tokens < max_batch_size * 800, there will be precision problem. + max_num_batched_tokens: 51200 # [TODO] if max_num_batched_tokens < max_num_seqs * 800, there will be precision problem. hf_config_name: thinker_config engine_input_source: [1] final_output: true diff --git a/vllm_omni/platforms/npu/stage_configs/qwen3_tts.yaml b/vllm_omni/platforms/npu/stage_configs/qwen3_tts.yaml index 530e957f0..331dd9f98 100644 --- a/vllm_omni/platforms/npu/stage_configs/qwen3_tts.yaml +++ b/vllm_omni/platforms/npu/stage_configs/qwen3_tts.yaml @@ -5,9 +5,9 @@ stage_args: is_comprehension: true runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: qwen3_tts + max_num_seqs: 1 model_arch: Qwen3TTSTalkerForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -37,9 +37,9 @@ stage_args: stage_type: llm runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3TTSCode2Wav worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/platforms/rocm/stage_configs/qwen2_5_omni.yaml b/vllm_omni/platforms/rocm/stage_configs/qwen2_5_omni.yaml index 8c4ffaa6f..35e819354 100644 --- a/vllm_omni/platforms/rocm/stage_configs/qwen2_5_omni.yaml +++ b/vllm_omni/platforms/rocm/stage_configs/qwen2_5_omni.yaml @@ -6,9 +6,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage (CUDA_VISIBLE_DEVICES/torch.cuda.set_device) - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -34,9 +34,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -62,9 +62,9 @@ stage_args: runtime: process: true devices: "2" # Example: use a different GPU than the previous stage; use "0" if single GPU - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/platforms/rocm/stage_configs/qwen3_omni_moe.yaml b/vllm_omni/platforms/rocm/stage_configs/qwen3_omni_moe.yaml index 31312673a..0ca150bee 100644 --- a/vllm_omni/platforms/rocm/stage_configs/qwen3_omni_moe.yaml +++ b/vllm_omni/platforms/rocm/stage_configs/qwen3_omni_moe.yaml @@ -8,9 +8,9 @@ stage_args: - stage_id: 0 runtime: devices: "0" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -38,9 +38,9 @@ stage_args: - stage_id: 1 runtime: devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -69,9 +69,9 @@ stage_args: - stage_id: 2 runtime: devices: "1" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/platforms/xpu/stage_configs/bagel.yaml b/vllm_omni/platforms/xpu/stage_configs/bagel.yaml index b1443d884..0fc8a25ea 100644 --- a/vllm_omni/platforms/xpu/stage_configs/bagel.yaml +++ b/vllm_omni/platforms/xpu/stage_configs/bagel.yaml @@ -6,9 +6,9 @@ stage_args: prompt_expand_func: vllm_omni.model_executor.stage_input_processors.bagel.expand_cfg_prompts runtime: devices: "0" - # 3 = 1 user prompt + 2 CFG companions (text-unconditional + image-unconditional). - max_batch_size: 3 engine_args: + # 3 = 1 user prompt + 2 CFG companions (text-unconditional + image-unconditional). + max_num_seqs: 3 model_stage: thinker model_arch: OmniBagelForConditionalGeneration worker_type: ar @@ -43,8 +43,8 @@ stage_args: cfg_kv_collect_func: vllm_omni.model_executor.stage_input_processors.bagel.collect_cfg_kv_caches runtime: devices: "1" - max_batch_size: 1 engine_args: + max_num_seqs: 1 model_stage: dit gpu_memory_utilization: 0.9 enforce_eager: true diff --git a/vllm_omni/platforms/xpu/stage_configs/qwen2_5_omni.yaml b/vllm_omni/platforms/xpu/stage_configs/qwen2_5_omni.yaml index 221b65602..7dbedb29a 100644 --- a/vllm_omni/platforms/xpu/stage_configs/qwen2_5_omni.yaml +++ b/vllm_omni/platforms/xpu/stage_configs/qwen2_5_omni.yaml @@ -7,9 +7,9 @@ stage_args: runtime: process: true # Run this stage in a separate process devices: "0" # Visible devices for this stage - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -34,9 +34,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -62,9 +62,9 @@ stage_args: runtime: process: true devices: "1" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen2_5OmniForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler diff --git a/vllm_omni/platforms/xpu/stage_configs/qwen3_omni_moe.yaml b/vllm_omni/platforms/xpu/stage_configs/qwen3_omni_moe.yaml index 59fed7c78..49914bebc 100644 --- a/vllm_omni/platforms/xpu/stage_configs/qwen3_omni_moe.yaml +++ b/vllm_omni/platforms/xpu/stage_configs/qwen3_omni_moe.yaml @@ -9,9 +9,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "0,1,2,3" - max_batch_size: 1 engine_args: model_stage: thinker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -41,9 +41,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "4" - max_batch_size: 1 engine_args: model_stage: talker + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: ar scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler @@ -73,9 +73,9 @@ stage_args: stage_type: llm # Use llm stage type for AR stages runtime: devices: "4" - max_batch_size: 1 engine_args: model_stage: code2wav + max_num_seqs: 1 model_arch: Qwen3OmniMoeForConditionalGeneration worker_type: generation scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler From fafa248665758b86449edc90c1cd5b0bbdd7224b Mon Sep 17 00:00:00 2001 From: wangyu <53896905+yenuo26@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:13:39 +0800 Subject: [PATCH 7/8] [Test] Implement mock HTTP request handling in benchmark CLI tests (#2014) Signed-off-by: yenuo26 <410167048@qq.com> Signed-off-by: wangyu <53896905+yenuo26@users.noreply.github.com> --- .buildkite/test-merge.yml | 7 +- .buildkite/test-ready.yml | 7 +- tests/benchmarks/test_serve_cli.py | 144 +++++++++++++++++++++++------ 3 files changed, 118 insertions(+), 40 deletions(-) diff --git a/.buildkite/test-merge.yml b/.buildkite/test-merge.yml index c1f9bd9b1..4415212c0 100644 --- a/.buildkite/test-merge.yml +++ b/.buildkite/test-merge.yml @@ -164,18 +164,13 @@ steps: volumes: - "/fsx/hf_cache:/fsx/hf_cache" - - label: "Benchmark & Engine Test" + - label: "Engine Test" depends_on: upload-merge-pipeline commands: - | timeout 15m bash -c ' export VLLM_WORKER_MULTIPROC_METHOD=spawn - set +e - pytest -s -v tests/benchmarks/test_serve_cli.py - EXIT1=$$? pytest -s -v tests/engine/test_async_omni_engine_abort.py - EXIT2=$$? - exit $$((EXIT1 | EXIT2)) ' agents: queue: "gpu_4_queue" # g6.12xlarge instance on AWS, has 4 L4 GPU diff --git a/.buildkite/test-ready.yml b/.buildkite/test-ready.yml index 4c414b4ad..dfc5786ed 100644 --- a/.buildkite/test-ready.yml +++ b/.buildkite/test-ready.yml @@ -121,18 +121,13 @@ steps: - "/fsx/hf_cache:/fsx/hf_cache" - - label: "Benchmark & Engine Test" + - label: "Engine Test" depends_on: upload-ready-pipeline commands: - | timeout 15m bash -c ' export VLLM_WORKER_MULTIPROC_METHOD=spawn - set +e - pytest -s -v tests/benchmarks/test_serve_cli.py - EXIT1=$$? pytest -s -v tests/engine/test_async_omni_engine_abort.py - EXIT2=$$? - exit $$((EXIT1 | EXIT2)) ' agents: queue: "gpu_4_queue" # g6.12xlarge instance on AWS, has 4 L4 GPU diff --git a/tests/benchmarks/test_serve_cli.py b/tests/benchmarks/test_serve_cli.py index ee371330b..ab7b09f7b 100644 --- a/tests/benchmarks/test_serve_cli.py +++ b/tests/benchmarks/test_serve_cli.py @@ -1,40 +1,101 @@ +import json +import os import subprocess +import textwrap from pathlib import Path import pytest -from tests.conftest import OmniServerParams -from tests.utils import hardware_test -from vllm_omni.platforms import current_omni_platform - -models = ["Qwen/Qwen2.5-Omni-7B"] -stage_configs = [str(Path(__file__).parent.parent / "e2e" / "stage_configs" / "qwen2_5_omni_ci.yaml")] - -if current_omni_platform.is_xpu(): - stage_configs = [str(Path(__file__).parent.parent / "e2e" / "stage_configs" / "xpu" / "qwen2_5_omni_ci.yaml")] -elif current_omni_platform.is_rocm(): - stage_configs = [str(Path(__file__).parent.parent / "e2e" / "stage_configs" / "rocm" / "qwen2_5_omni_ci.yaml")] - -# Create parameter combinations for model and stage config -test_params = [ - OmniServerParams(model=model, stage_config_path=stage_config) for model in models for stage_config in stage_configs -] - @pytest.mark.core_model @pytest.mark.benchmark -@hardware_test(res={"cuda": "L4", "xpu": "B60", "rocm": "MI325"}, num_cards=3) -@pytest.mark.parametrize("omni_server", test_params, indirect=True) -def test_bench_serve_chat(omni_server): - command = [ +@pytest.mark.cpu +def test_bench_serve_cli_mocks_http_request(tmp_path: Path): + num_prompts = 5 + port = 18000 + result_filename = "bench-result.json" + calls_filename = "http-post-calls.json" + result_path = tmp_path / result_filename + calls_path = tmp_path / calls_filename + + sitecustomize_path = tmp_path / "sitecustomize.py" + sitecustomize_path.write_text( + textwrap.dedent( + """ + import atexit + import json + import os + + POST_CALLS = [] + SSE_CHUNKS = [ + b'data: {"choices":[{"delta":{"content":"hi"}}],"modality":"text"}\\n\\n', + b'data: {"choices":[{"delta":{"content":" there"}}],"modality":"text","metrics":{"num_tokens_out":4,"num_tokens_in":5}}\\n\\n', + b"data: [DONE]\\n\\n", + ] + + class _Content: + def __init__(self, chunks): + self._chunks = chunks + + async def iter_any(self): + for chunk in self._chunks: + yield chunk + + class MockResponse: + def __init__(self): + self.status = 200 + self.reason = "OK" + self.content = _Content(SSE_CHUNKS) + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + return False + + class MockClientSession: + def __init__(self, *args, **kwargs): + pass + + def post(self, url=None, *args, **kwargs): + if url is not None: + POST_CALLS.append(url) + return MockResponse() + + async def close(self): + return None + + import vllm_omni.benchmarks.patch.patch as patch_mod + + patch_mod.aiohttp.ClientSession = MockClientSession + patch_mod.aiohttp.TCPConnector = lambda *args, **kwargs: object() + + calls_file = os.environ.get("VLLM_OMNI_TEST_POST_CALLS_FILE") + + if calls_file: + def _write_calls(): + with open(calls_file, "w", encoding="utf-8") as f: + json.dump({"requested_urls": POST_CALLS}, f) + + atexit.register(_write_calls) + """ + ), + encoding="utf-8", + ) + + env = os.environ.copy() + env["PYTHONPATH"] = str(tmp_path) + os.pathsep + env.get("PYTHONPATH", "") + env["VLLM_OMNI_TEST_POST_CALLS_FILE"] = str(calls_path) + + cmd = [ "vllm", "bench", "serve", "--omni", "--model", - omni_server.model, + "Qwen/Qwen2.5-Omni-7B", "--port", - str(omni_server.port), + str(port), "--dataset-name", "random", "--random-input-len", @@ -42,14 +103,41 @@ def test_bench_serve_chat(omni_server): "--random-output-len", "4", "--num-prompts", - "5", + str(num_prompts), "--endpoint", "/v1/chat/completions", "--backend", "openai-chat-omni", + "--disable-tqdm", + "--num-warmups", + "0", + "--ready-check-timeout-sec", + "0", + "--save-result", + "--result-dir", + str(tmp_path), + "--result-filename", + result_filename, ] - result = subprocess.run(command, capture_output=True, text=True) - print(result.stdout) - print(result.stderr) + proc = subprocess.run( + cmd, + cwd=str(Path(__file__).resolve().parents[2]), + env=env, + capture_output=True, + text=True, + ) - assert result.returncode == 0, f"Benchmark failed: {result.stderr}" + assert proc.returncode == 0, f"CLI failed: stdout={proc.stdout}\nstderr={proc.stderr}" + print(f"CLI output: {proc.stdout}") + assert result_path.exists() + result = json.loads(result_path.read_text(encoding="utf-8")) + assert calls_path.exists() + calls = json.loads(calls_path.read_text(encoding="utf-8")) + + expected_url = f"http://127.0.0.1:{port}/v1/chat/completions" + requested_urls = calls["requested_urls"] + sent_requests = len(requested_urls) + + assert result["completed"] == sent_requests == num_prompts + assert requested_urls + assert all(url == expected_url for url in requested_urls), f"Unexpected target URLs: {requested_urls}" From 199f7832e7d4293a07644f83a1fac9fdaf45caee Mon Sep 17 00:00:00 2001 From: Alicia <115451386+congw729@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:41:45 +0800 Subject: [PATCH 8/8] [CI] Fix test. (#2031) Signed-off-by: Alicia <115451386+congw729@users.noreply.github.com> --- .buildkite/test-merge.yml | 17 ----------------- .buildkite/test-ready.yml | 17 +++++++++++++++++ .../test_cuda_graph_acoustic_transformer.py | 1 + 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.buildkite/test-merge.yml b/.buildkite/test-merge.yml index 4415212c0..06bf033ca 100644 --- a/.buildkite/test-merge.yml +++ b/.buildkite/test-merge.yml @@ -374,20 +374,3 @@ steps: # hostPath: # path: /mnt/hf-cache # type: DirectoryOrCreate - - - label: "CUDA Unit Test" - timeout_in_minutes: 10 - depends_on: upload-merge-pipeline - commands: - - pytest -v -s -m 'core_model and cuda' - agents: - queue: "gpu_1_queue" - plugins: - - docker#v5.2.0: - image: public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT - always-pull: true - propagate-environment: true - environment: - - "HF_HOME=/fsx/hf_cache" - volumes: - - "/fsx/hf_cache:/fsx/hf_cache" diff --git a/.buildkite/test-ready.yml b/.buildkite/test-ready.yml index dfc5786ed..1d0b7ad0e 100644 --- a/.buildkite/test-ready.yml +++ b/.buildkite/test-ready.yml @@ -16,6 +16,23 @@ steps: volumes: - "/fsx/hf_cache:/fsx/hf_cache" + - label: "Voxtral TTS CUDA Unit Test" + timeout_in_minutes: 10 + depends_on: upload-ready-pipeline + commands: + - "timeout 10m pytest -s -v tests/model_executor/models/voxtral_tts/test_cuda_graph_acoustic_transformer.py" + agents: + queue: "gpu_1_queue" + plugins: + - docker#v5.2.0: + image: public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT + always-pull: true + propagate-environment: true + environment: + - "HF_HOME=/fsx/hf_cache" + volumes: + - "/fsx/hf_cache:/fsx/hf_cache" + - label: "Diffusion Model Test" depends_on: upload-ready-pipeline commands: diff --git a/tests/model_executor/models/voxtral_tts/test_cuda_graph_acoustic_transformer.py b/tests/model_executor/models/voxtral_tts/test_cuda_graph_acoustic_transformer.py index f0fba8a0d..6f072944d 100644 --- a/tests/model_executor/models/voxtral_tts/test_cuda_graph_acoustic_transformer.py +++ b/tests/model_executor/models/voxtral_tts/test_cuda_graph_acoustic_transformer.py @@ -23,6 +23,7 @@ pytestmark = [ pytest.mark.skipif(not torch.cuda.is_available(), reason="CUDA required"), pytest.mark.core_model, pytest.mark.cuda, + pytest.mark.L4, ] DEVICE = torch.device("cuda:0")