-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
[Misc] Clean up MiniCPM-V/O code #15337
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
[Misc] Clean up MiniCPM-V/O code #15337
Conversation
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
|
👋 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 🚀 |
| if msg is None: | ||
| assert a == b | ||
| else: | ||
| assert a == b, msg |
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.
These changes are to let pytest show the non-matching items in more detail
| assert isinstance(images, 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.
Unnecessary check since the data is parsed in the next line
| "TIGER-Lab/Mantis-8B-siglip-llama3", | ||
| "mistralai/Pixtral-12B-2409", | ||
| "mistral-community/pixtral-12b", | ||
| "openbmb/MiniCPM-Llama3-V-2_5", |
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.
Need this to test the else branch in _base_call_hf_processor
|
Marking as draft until I can get the relevant tests to pass locally |
|
Ready to review now. |
|
Seems MiniCPM-V test is OOM on CI now... (https://buildkite.com/vllm/fastcheck/builds/17957#0195c650-42fc-4448-9309-7609ca41b3ed/205-3895) |
|
This simplified approach is not nearly as memory efficient, let's see how to optimize this while still keeping the code readable... Old implementation: New implementation: |
|
Hmm this is odd, the memory usage remains exactly the same before Old implementation: New implementation: |
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
| num_slices = mm_data[modality][f"{modality}_num_slices"][b][ | ||
| pos] | ||
| slice_start_idx = mm_slice_counts[modality] | ||
| slice_end_idx = slice_start_idx + num_slices | ||
| pixel_values_flat += mm_data[modality]["pixel_values"][b][ | ||
| slice_start_idx:slice_end_idx] | ||
| tgt_sizes_flat += mm_data[modality]["tgt_sizes"][b][ | ||
| slice_start_idx:slice_end_idx] |
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.
Upon further inspection, the previous model implementation actually fails to extract all of the slices. (The last slice_end_idx does not match the length of mm_data[modality]["pixel_values"][b]). So the new implementation is more correct but also uses more memory.
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.
I'll just disable the multi-image tests in test CI
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Wes Medford <wryanmedford@gmail.com>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Louis Ulmer <ulmerlouis@gmail.com>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Mu Huai <tianbowen.tbw@antgroup.com>
Clean up the code before trying to support the model on V1
cc @HwwwwwwwH