[Misc] Slight improvement of the BNB - #19418
Conversation
|
👋 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.
Summary of Changes
Hello @jeejeelee, 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!
This pull request makes minor adjustments to the BitsAndBytes (BNB) integration within the model executor. The changes streamline the configuration loading process by removing an unnecessary config file check and improve the precision of identifying which modules should be considered for BNB quantization based on their specific quantization method configuration.
Highlights
- BNB Configuration Loading: I've updated the
BitsAndBytesConfigto no longer look foradapter_config.jsonwhen determining relevant configuration filenames. - BNB Target Module Identification: I've refined the logic in the BNB model loader (
bitsandbytes_loader.py) to only considerLinearBasemodules as potential targets for BNB quantization if they also have aquant_configattribute on theirquant_method.
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. ↩
| return [ | ||
| "adapter_config.json", | ||
| ] | ||
| return [] |
There was a problem hiding this comment.
Incorrect config , delete it
There was a problem hiding this comment.
Code Review
This pull request introduces two small improvements related to BitsAndBytes (BNB) quantization:
- The
get_config_filenamesmethod inBitsAndBytesConfigno longer listsadapter_config.json. This change warrants clarification regarding its impact on adapter configurations with BNB. - The logic for identifying BNB target modules in
_get_bnb_target_moduleshas been refined to be more specific by checking for the presence ofquant_configon the module'squant_method. A style suggestion based on PEP 8 has been provided for this change.
To improve the review process and maintain a clear project history, please ensure the pull request description is filled out, detailing the purpose and testing of these changes.
As no specific style guide was provided for this repository, my style-related feedback adheres to common Python best practices, such as PEP 8 for line continuation.
| return [ | ||
| "adapter_config.json", | ||
| ] | ||
| return [] |
There was a problem hiding this comment.
This change removes adapter_config.json from the list of configuration filenames for BitsAndBytes. Could you please provide some context for this modification? For example, was this file no longer necessary for BNB configurations, or is this part of a broader update to how adapters are handled with BitsAndBytes quantization?
| for name, module in model.named_modules(): | ||
| if isinstance(module, (LinearBase, )): | ||
| if isinstance(module, (LinearBase, ))and \ | ||
| hasattr(module.quant_method,"quant_config"): |
There was a problem hiding this comment.
Some layers don't support quantization in their implementation, such as router (although we don't support MOE BNB yet). This modification is to avoid such situations.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Co-authored-by: Isotr0py <2037008807@qq.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Co-authored-by: Isotr0py <2037008807@qq.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Co-authored-by: Isotr0py <2037008807@qq.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Purpose
Test Plan
Test Result
(Optional) Documentation Update