Skip to content

Conversation

@hfan
Copy link
Contributor

@hfan hfan commented Jul 23, 2025

Purpose

No functional change.

It is best practice to check properly for empty list if the value can be an empty list.

Also in tpu_commons when we try to trace the graph without MM inputs, this check fails and causes the graph for text-only input still tries to trace the MM code path.

Test Plan

Existing CI should still pass

Test Result

@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The code change adds a check for an empty list of vision embeddings before calling prepare_attn_masks. This prevents a potential error and improves the robustness of the code. The change is approved.

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:

@yaochengji yaochengji added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 23, 2025
@hfan hfan changed the title Fix a check for None but the return value was empty list in Gemma3 MM. [Model] Fix a check for None but the return value was empty list in Gemma3 MM vision_embeddings Jul 23, 2025
@DarkLight1337 DarkLight1337 merged commit fde60ee into vllm-project:main Jul 25, 2025
82 of 84 checks passed
liuyumoye pushed a commit to liuyumoye/vllm that referenced this pull request Jul 31, 2025
wpyszka pushed a commit to HabanaAI/vllm-fork that referenced this pull request Aug 1, 2025
This PR contains following changes
1. Port Gemma3 SLIDING_WINDOW FusedSDPA feature from habana_main + Add a
few extra fixes including..
- Sliding FusedSDPA kernel, we are adding threshold variable to enable
or disable to use optimized kernel. This kernel will be
performance/memory benefit for longer sequence. We are providing
environment variable to control per customer request.
- Based on the threshold, choose different prompt bucket, if it's
smaller than the threshold, use PROMPT_BUCKET_STEP, otherwise use
SLICE_SIZE.
 - Added mark_step before SLIDING FusedSDPA is run. 
 - Misc fixes for bucket related issue. 
 2. upstream fixes
 vllm-project#18732
vllm-project#21479
vllm-project#19788

3. optimized Gemma3RMSNorm with FusedRMSNorm
Dependent on #1647 


Run command with. 
VLLM_FUSEDSDPA_SLIDE_THLD=2048 VLLM_EXPONENTIAL_BUCKETING=false
VLLM_PROMPT_BS_BUCKET_MAX=64 VLLM_PROMPT_SEQ_BUCKET_STEP=1024
VLLM_PROMPT_SEQ_BUCKET_MAX=20480 PT_HPU_SDPA_QKV_SLICE_MODE_FWD=1

---------

Signed-off-by: Lukas Geiger <[email protected]>
Signed-off-by: Hongmin Fan <[email protected]>
Co-authored-by: Henry Tang <[email protected]>
Co-authored-by: Mohit Deopujari <[email protected]>
Co-authored-by: Shiv Kaul <[email protected]>
Co-authored-by: Shiv Kaul <[email protected]>
Co-authored-by: Libin Tang <[email protected]>
Co-authored-by: Lukas Geiger <[email protected]>
Co-authored-by: Hongmin Fan <[email protected]>
Co-authored-by: Harish Subramony <[email protected]>
Co-authored-by: Jianhong-Zhang <[email protected]>
Co-authored-by: Libin Tang <[email protected]>
Co-authored-by: Michał Kuligowski <[email protected]>
x22x22 pushed a commit to x22x22/vllm that referenced this pull request Aug 5, 2025
…emma3 MM vision_embeddings (vllm-project#21479)

Signed-off-by: Hongmin Fan <[email protected]>
Signed-off-by: x22x22 <[email protected]>
Pradyun92 pushed a commit to Pradyun92/vllm that referenced this pull request Aug 6, 2025
npanpaliya pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Aug 6, 2025
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
…emma3 MM vision_embeddings (vllm-project#21479)

Signed-off-by: Hongmin Fan <[email protected]>
Signed-off-by: Jinzhen Lin <[email protected]>
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
…emma3 MM vision_embeddings (vllm-project#21479)

Signed-off-by: Hongmin Fan <[email protected]>
Signed-off-by: Paul Pak <[email protected]>
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
…emma3 MM vision_embeddings (vllm-project#21479)

Signed-off-by: Hongmin Fan <[email protected]>
Signed-off-by: Diego-Castan <[email protected]>
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants