-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
[Core][Bugfix] Fix Online MM Beam Search #19688
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
[Core][Bugfix] Fix Online MM Beam Search #19688
Conversation
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.
Summary of Changes
Hello @alex-jw-brooks, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
I've addressed a bug affecting offline multimodal beam search where the multimodal data was not being correctly propagated. This involved adjusting the data retrieval mechanism in the engine protocol and updating a relevant test case to validate the fix with specific expected outputs. A minor refactor to the beam search sorting key function was also included.
Highlights
- Multimodal Beam Search Fix: I've corrected how multimodal data and prompt tokens are accessed within the beam search logic to resolve issues where this data was not being passed correctly, specifically addressing the problems outlined in issue [Bug]: Async Beam Search Doesn't Pass Multimodal Data Correctly #19687.
- Test Update: I've modified an existing vision beam search test (
test_single_chat_session_image_base64encoded_beamsearch
) to specifically assert against expected output for different images, ensuring that multimodal data is correctly processed during beam search. - Code Refactoring: I've extracted the logic for creating the beam search sorting key into a dedicated helper function (
create_sort_beams_key_function
) for better code organization.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
👋 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
This pull request aims to fix an issue with multimodal data not being correctly passed through in offline beam search. The core change in vllm/engine/protocol.py
modifies how prompt_token_ids
and multi_modal_data
are sourced for beam search, using the raw prompt
input instead of processed_inputs
. This is acknowledged as a workaround in a TODO
comment, which is good. The refactoring in vllm/entrypoints/llm.py
to use create_sort_beams_key_function
improves code structure.
The main concern is with the updated test in tests/entrypoints/openai/test_vision.py
. While adding temperature=0.0
and strengthening the assertion logic are positive changes, there's a potential mismatch between the max_completion_tokens=10
setting, the content/length of the newly added EXPECTED_MM_BEAM_SEARCH_RES
strings, and the sample output provided in the PR description. This could affect the test's correctness and reliability.
tokenizer.eos_token_id, | ||
length_penalty) | ||
tokenizer = self.get_tokenizer() | ||
sort_beams_key = create_sort_beams_key_function( |
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.
Small refactor to share this between sync / async because it's identical
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.
LGTM, thanks for the fix!
Head branch was pushed to by a user without write access
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
0c54650
to
2cf7fd8
Compare
Hey @DarkLight1337, thanks for the quick review! I think the test failure is unrelated |
Purpose
Fixes #19687
Test Plan
Running the sample script in the issue should produce output considering the mm data correctly. We should also update an async multimodal beam search test to correctly check the output to be safe.
Test Result
Sample response for the repro case provided in the issue, which now correctly passes the mm data through.
One of the online beam search tests with vision has also been updated to check the content to validate the fix.
@DarkLight1337 can you please take a look?