@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 2a8d84e66d
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 9, 00:00 UTC

Fix Gemma3n audio encoder for Transformers v5 (#33673)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

Harry Mellor committed Feb 3, 2026 at 13:49 UTC 2a8d84e66d19014c44155ca1ee79b4aa0227734d
1 file changed +9 -4
vllm/model_executor/models/gemma3n_mm.py
+9 -4
@@ -621,10 +621,15 @@ class Gemma3nForConditionalGeneration(
621 # Run on padded features to enable batching
622 input_features = audio_input["input_features_padded"].squeeze(1)
623 input_features_mask = audio_input["input_features_mask"].squeeze(1)
624 - audio_outputs, audio_mask = self.audio_tower(
625 - input_features, ~input_features_mask
626 - )
627 - audio_features = self.embed_audio(inputs_embeds=audio_outputs)
624 + audio_outputs = self.audio_tower(input_features, ~input_features_mask)
625 + if isinstance(audio_outputs, tuple):
626 + # Transformers v4
627 + audio_encodings, audio_mask = audio_outputs
628 + else:
629 + # Transformers v5
630 + audio_encodings = audio_outputs.last_hidden_state
631 + audio_mask = audio_outputs.audio_mel_mask
632 + audio_features = self.embed_audio(inputs_embeds=audio_encodings)
633
634 # The Gemma3nProcessor expects all audio will be 30s in length and
635 # inserts 188 audio soft tokens into the text to account for this.