Skip to content

Conversation

DarkLight1337
Copy link
Member

@DarkLight1337 DarkLight1337 commented Sep 23, 2025

Purpose

Code cleanup: move the code from multimodal/utils.py to model_executor/models/vision.py

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@DarkLight1337 DarkLight1337 added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 23, 2025
@mergify mergify bot added llama Related to Llama models multi-modality Related to multi-modality (#4194) qwen Related to Qwen models labels Sep 23, 2025
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

This pull request is a good refactoring that moves data parallelism utilities for vision models from vllm/multimodal/utils.py to a more appropriate location at vllm/model_executor/models/vision.py. The changes are well-contained, with tests moved alongside the code and all call sites updated accordingly. I have one suggestion to improve efficiency by creating a tensor on the correct device directly. Overall, this is a solid improvement to the codebase structure.

Comment on lines +326 to +327
image_embeds_local = vision_model(
pixel_values_local, torch.tensor(local_grid_thw_list))
Copy link
Contributor

Choose a reason for hiding this comment

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

high

For efficiency, it's better to create the local_grid_thw_list tensor directly on the target device to avoid an unnecessary CPU-to-GPU copy. The pixel_values_local tensor is already on the correct device.

Suggested change
image_embeds_local = vision_model(
pixel_values_local, torch.tensor(local_grid_thw_list))
image_embeds_local = vision_model(
pixel_values_local,
torch.tensor(local_grid_thw_list,
device=pixel_values_local.device))

@Isotr0py Isotr0py enabled auto-merge (squash) September 23, 2025 07:42
@Isotr0py Isotr0py merged commit babad6e into vllm-project:main Sep 23, 2025
53 of 56 checks passed
@DarkLight1337 DarkLight1337 deleted the mv-dp-vit-utils branch September 23, 2025 09:24
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
charlifu pushed a commit to ROCm/vllm that referenced this pull request Sep 25, 2025
yewentao256 pushed a commit that referenced this pull request Oct 3, 2025
gjc0824 pushed a commit to gjc0824/vllm that referenced this pull request Oct 10, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 10, 2025
choprahetarth pushed a commit to Tandemn-Labs/vllm that referenced this pull request Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llama Related to Llama models multi-modality Related to multi-modality (#4194) qwen Related to Qwen models 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.

2 participants