fix: scope AWQ mapping resolution to sequential targets for multimodal models#2424
fix: scope AWQ mapping resolution to sequential targets for multimodal models#2424Yatimai wants to merge 1 commit intovllm-project:mainfrom
Conversation
|
👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review. Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed. |
Summary of ChangesHello, 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 resolves issues related to AWQ quantization in multimodal models by ensuring that the mapping resolution process correctly targets only the relevant sequential layers, such as the text decoder. It introduces a new scoping mechanism to prevent non-textual components, like vision encoders, from being incorrectly included in the quantization mapping, which previously led to errors and tracing failures. This change improves the robustness and applicability of AWQ to complex model architectures. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a well-designed fix for resolving AWQ mappings in multimodal models by scoping the module search to sequential targets. The use of _ScopedModuleView is an elegant, non-intrusive solution. The changes are logical, and the new example for Gemma 3 is a valuable addition for testing and demonstration. I have one minor suggestion to improve a comment for future maintainability.
|
|
||
| self._set_resolved_mappings(state.model) | ||
| # Resolve sequential_targets: prefer oneshot() kwarg, fall back to | ||
| # modifier field, then auto-detect from model config. |
There was a problem hiding this comment.
The comment mentions auto-detection from the model config, but the code below only considers kwargs and the modifier's sequential_targets field. This could be misleading for future developers. To improve clarity and maintainability, the comment should accurately describe the code's behavior.
| # modifier field, then auto-detect from model config. | |
| # modifier field. |
27d9cda to
3347e0d
Compare
…l models Signed-off-by: Gilles Turpin <turpingilles@orange.fr>
3347e0d to
6a771ff
Compare
Reported in #2102, #1577, #1415.
Root Cause
_set_resolved_mappings(line 348) deliberately does not pass the ignore list tomatch_modules_set, so vision encoder modules participate in matching and break the parent-context grouping.Fix
When
sequential_targetsis provided (e.g.["Gemma3DecoderLayer"]), build a_ScopedModuleViewthat filtersnamed_modules()to only yield modules under those targets. This restrictsmatch_modules_setto the text decoder, preventing vision encoder modules from polluting the LCA grouping.sequential_targetsis not set (zero regression for text-only models)Testing
save_compressed=Truefails on multimodal models due to a separate issue in compressed-tensors (non-quantized vision tower weights). The example usessave_compressed=Falseas a workaround.Changes
src/llmcompressor/modifiers/awq/base.py: scope mapping resolution via_ScopedModuleViewexamples/multimodal_vision/gemma3_awq_example.py: new AWQ example for Gemma 3Closes #2102