-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
[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
Conversation
Signed-off-by: Hongmin Fan <[email protected]>
|
👋 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 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 🚀 |
There was a problem hiding this 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]>
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]>
…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]> Signed-off-by: x22x22 <[email protected]>
…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]>
…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]>
…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]> Signed-off-by: Jinzhen Lin <[email protected]>
…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]> Signed-off-by: Paul Pak <[email protected]>
…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]> Signed-off-by: Diego-Castan <[email protected]>
…emma3 MM vision_embeddings (vllm-project#21479) Signed-off-by: Hongmin Fan <[email protected]>
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