Skip to content

[Model] Fix a check for None but the return value was empty list in Gemma3 MM vision_embeddings #21479

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

Merged
merged 1 commit into from
Jul 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vllm/model_executor/models/gemma3_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def forward(self,

inputs_embeds = self.get_input_embeddings(input_ids,
vision_embeddings)
if vision_embeddings is not None:
if (vision_embeddings is not None) and len(vision_embeddings) != 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Checking the length of vision_embeddings prevents a potential error when prepare_attn_masks is called with an empty list. This condition ensures that attention masks are only prepared when there are actual vision embeddings to process, improving code robustness.

if vision_embeddings and len(vision_embeddings) != 0:

kwargs = self.prepare_attn_masks(
input_ids,
positions,
Expand Down