-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Misc] Move DP for ViT code inside model executor dir #25459
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: DarkLight1337 <[email protected]>
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
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.
image_embeds_local = vision_model( | ||
pixel_values_local, torch.tensor(local_grid_thw_list)) |
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.
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.
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)) |
…5459) Signed-off-by: DarkLight1337 <[email protected]>
…5459) Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: charlifu <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: yewentao256 <[email protected]>
…5459) Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: gaojc <[email protected]>
…5459) Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: xuebwang-amd <[email protected]>
…5459) Signed-off-by: DarkLight1337 <[email protected]>
Purpose
Code cleanup: move the code from
multimodal/utils.py
tomodel_executor/models/vision.py
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.