[Bugfix] Revert custom attention mask for gemma3-mm (#28995)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
This commit is contained in:
Isotr0py
2025-11-20 13:23:22 +08:00
committed by GitHub
co-authored by Cyrus Leung
parent fe25772aa9
commit 64192d5624
4 changed files with 1 additions and 172 deletions
-19
View File
@@ -324,7 +324,6 @@ class GPUModelRunner(
# Multi-modal data support
self.mm_registry = MULTIMODAL_REGISTRY
self.uses_mrope = model_config.uses_mrope
self.uses_custom_attention_masks = model_config.uses_custom_attention_masks
self.supports_mm_inputs = self.mm_registry.supports_multimodal_inputs(
model_config
)
@@ -2352,24 +2351,6 @@ class GPUModelRunner(
**self._init_model_kwargs(num_scheduled_tokens),
**self._extract_mm_kwargs(scheduler_output),
}
# Generate custom attention masks for models that require them.
# V1 pre-generates embeddings, so forward() skips prepare_attn_masks().
# Check mm_features (mm_embeds is empty during decode).
has_mm_features = any(
req_state.mm_features for req_state in self.requests.values()
)
if (
self.uses_custom_attention_masks
and has_mm_features
and hasattr(self.model, "generate_attention_masks")
):
mask_kwargs = self.model.generate_attention_masks(
self.input_ids.gpu[:num_scheduled_tokens],
self.positions.gpu[:num_scheduled_tokens],
mask_dtype=self.model.dtype,
)
model_kwargs.update(mask_kwargs)
elif self.enable_prompt_embeds and is_first_rank:
# Get the input embeddings for the tokens that are not input embeds,
# then put them into the appropriate positions.