Repository navigation
fix(container): backport vLLM #45022 Voxtral realtime boot fix into the vLLM runtime image #16190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
glamr-agent
wants to merge
3
commits into
ai-dynamo:main
from
glamr-agent:dyn-4860-vllm-pin-voxtral-realtime-boot-crash-b58b92d1cb9c
Closed
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
container/deps/vllm/patches/0001-voxtral-realtime-processing-info-vllm-45022.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| From 2186b89a9a02fac11fa0e274f3201b9812dbf65c Mon Sep 17 00:00:00 2001 | ||
| From: Damien Laine <damien.laine@gmail.com> | ||
| Date: Fri, 9 Oct 2026 11:40:29 +0200 | ||
| Subject: [PATCH] [Bugfix][Model] Voxtral realtime: fix boot OOM and engine | ||
| crash at max_model_len (#45022) | ||
|
|
||
| Signed-off-by: Damien Laine <damien.laine@gmail.com> | ||
| Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk> | ||
| --- | ||
| Backport of the model-side part of vllm-project/vllm#45022 (commit | ||
| 2186b89a9a02fac11fa0e274f3201b9812dbf65c) onto vLLM 0.31.0. Only the | ||
| vllm/model_executor/models/voxtral_realtime.py diff is carried, unchanged. | ||
| Remove this patch when the CUDA vLLM pin contains 2186b89a9a. | ||
| --- | ||
| diff --git a/vllm/model_executor/models/voxtral_realtime.py b/vllm/model_executor/models/voxtral_realtime.py | ||
| index 8531d7d18f39..72318976f1d4 100644 | ||
| --- a/vllm/model_executor/models/voxtral_realtime.py | ||
| +++ b/vllm/model_executor/models/voxtral_realtime.py | ||
| @@ -120,9 +120,35 @@ def _expand_tensor(input_tensor: torch.Tensor, scaling: int) -> torch.Tensor: | ||
| return (base.unsqueeze(1) + offsets).view(-1) | ||
|
|
||
|
|
||
| +class VoxtralRealtimeProcessingInfo(VoxtralProcessingInfo): | ||
| + def get_supported_mm_limits(self) -> Mapping[str, int | None]: | ||
| + # Each streaming update carries a single audio frame. | ||
| + return {"audio": 1} | ||
| + | ||
| + def get_max_audio_array_len(self) -> int: | ||
| + # Profile with the largest streaming chunk, the first one: it covers | ||
| + # the prompt prefix (BOS + left padding + delay), later chunks are | ||
| + # ~1 token. get_max_audio_tokens keeps max_model_len so the encoder | ||
| + # cache stays as large as before: each paused session keeps its last | ||
| + # chunk cached until it resumes, and a cache sized to one chunk | ||
| + # deadlocks a few concurrent sessions. | ||
| + tokenizer = self.get_tokenizer() | ||
| + audio_encoder = tokenizer.instruct.audio_encoder | ||
| + prompt_tokens = ( | ||
| + tokenizer.instruct.start() + audio_encoder.encode_streaming_tokens() | ||
| + ) | ||
| + return len(prompt_tokens) * audio_encoder.audio_config.raw_audio_length_per_tok | ||
| + | ||
| + | ||
| class VoxtralRealtimeBuffer: | ||
| - def __init__(self, config: AudioConfig, prompt_tokens: list[int]) -> None: | ||
| + def __init__( | ||
| + self, | ||
| + config: AudioConfig, | ||
| + prompt_tokens: list[int], | ||
| + max_model_len: int | None = None, | ||
| + ) -> None: | ||
| self._config = config | ||
| + self._max_model_len = max_model_len | ||
|
|
||
| _look_ahead_in_ms = self._config.streaming_look_ahead_ms | ||
| _look_back_in_ms = self._config.streaming_look_back_ms | ||
| @@ -165,7 +191,16 @@ async def append_tokens(self, tokens: Iterable[int]) -> None: | ||
| await self._token_queue.put(token) | ||
|
|
||
| async def get_input_stream(self) -> AsyncGenerator[TokensPrompt]: | ||
| + n_tokens = 0 | ||
| for frame_size, num_tokens in self._generate_frame_size_and_num_tokens(): | ||
| + n_tokens += num_tokens | ||
| + if self._max_model_len is not None and n_tokens >= self._max_model_len: | ||
| + logger.warning( | ||
| + "Stopping realtime audio stream: reached max_model_len (%d).", | ||
| + self._max_model_len, | ||
| + ) | ||
| + return | ||
| + | ||
| next_tokens = [await self._token_queue.get() for _ in range(num_tokens)] | ||
|
|
||
| audio_arrays: list[np.ndarray] = ( | ||
| @@ -198,7 +233,7 @@ async def get_input_stream(self) -> AsyncGenerator[TokensPrompt]: | ||
|
|
||
| @MULTIMODAL_REGISTRY.register_processor( | ||
| VoxtralRealtimeMultiModalProcessor, | ||
| - info=VoxtralProcessingInfo, | ||
| + info=VoxtralRealtimeProcessingInfo, | ||
| dummy_inputs=VoxtralDummyInputsBuilder, | ||
| ) | ||
| @support_torch_compile | ||
| @@ -248,7 +283,9 @@ async def buffer_realtime_audio( | ||
| # Get left/right padding audio | ||
| left_pad, right_pad = audio_encoder.get_padding_audio() | ||
|
|
||
| - buffer = VoxtralRealtimeBuffer(config, prompt_tokens) | ||
| + buffer = VoxtralRealtimeBuffer( | ||
| + config, prompt_tokens, max_model_len=model_config.max_model_len | ||
| + ) | ||
|
|
||
| # Feed audio with padding into buffer in background | ||
| async def feed_audio(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.