-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Bugfix] Fix glm4.1v video inference issue #22067
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: Isotr0py <[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 aims to fix a video inference issue in GLM-4.1V caused by a change in the transformers
library. While the change correctly adapts to the new video_grid_thw
format for a single video, it introduces a critical bug in handling multiple videos within a single request. The proposed change incorrectly uses data from only the last video in a batch, ignoring the others. My review includes a fix for this issue.
video_outputs = dict( | ||
pixel_values_videos=torch.cat(pixel_values_videos_lst), | ||
video_grid_thw=torch.cat(video_grid_thw_lst), | ||
video_grid_thw=video_outputs["video_grid_thw"], | ||
) |
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.
This change introduces a bug when processing multiple videos in a single request. The video_outputs
variable is updated in each iteration of the loop over videos. By using video_outputs["video_grid_thw"]
after the loop, you are only using the video_grid_thw
from the last video processed.
The video_grid_thw_lst
correctly accumulates the grid information for all videos. You should concatenate the tensors in this list to form the final batched video_grid_thw
, as was done previously.
This is a critical issue that will lead to incorrect outputs for multi-video inputs.
video_outputs = dict( | |
pixel_values_videos=torch.cat(pixel_values_videos_lst), | |
video_grid_thw=torch.cat(video_grid_thw_lst), | |
video_grid_thw=video_outputs["video_grid_thw"], | |
) | |
video_outputs = dict( | |
pixel_values_videos=torch.cat(pixel_values_videos_lst), | |
video_grid_thw=torch.cat(video_grid_thw_lst), | |
) |
Signed-off-by: Isotr0py <[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 🚀 |
Signed-off-by: Isotr0py <[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.
Thanks for fixing!
Can you merge from main? |
Signed-off-by: Isotr0py <[email protected]>
Signed-off-by: Isotr0py <[email protected]> Signed-off-by: Jinzhen Lin <[email protected]>
Signed-off-by: Isotr0py <[email protected]> Signed-off-by: Noam Gat <[email protected]>
Signed-off-by: Isotr0py <[email protected]> Signed-off-by: Paul Pak <[email protected]>
Signed-off-by: Isotr0py <[email protected]> Signed-off-by: Diego-Castan <[email protected]>
Signed-off-by: Isotr0py <[email protected]>
Signed-off-by: Isotr0py <[email protected]>
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
Transformers
changed GLM4.1V'svideo_grid_thw
to fix batch inference after v4.53.2 (fix Glm4v batch videos forward huggingface/transformers#39172), which broke the video support GLM-4.1V in multimodal processor.video_grid_thw
before:video_grid_thw
currently:TODO
Test Plan
Test Result
(Optional) Documentation Update