-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[Bugfix] Fix prefix strings for quantized VLMs #9772
Conversation
👋 Hi! Thank you for contributing to the vLLM project. 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 do one of these:
🚀 |
Signed-off-by: mgoin <[email protected]>
Thanks for taking the time and effort for adding this! I think this should solve most of the quantization-related GH issues?
(Phi3V and Llava-OneVision haven't been tested though) |
@DarkLight1337 A few of the issues you linked (and shared earlier with me) are specific to bitsandbytes support, so will require more work but I want to tackle those in future PRs since BNB is special |
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 then. See if @Isotr0py is ok with this approach as well.
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!
BTW, if we want to broadcast the BNB support to most of VLMs, we might need to implement quantized multi_modal_proj
(if they have) as well. Because user will possibly create a fully quantized (even the lm_head
and multi_modal_proj
) BNB model if they refer to the guidance in transformers
...
Signed-off-by: mgoin <[email protected]>
Signed-off-by: Randall Smith <[email protected]>
Signed-off-by: NickLucche <[email protected]>
Signed-off-by: NickLucche <[email protected]>
Signed-off-by: Linkun Chen <[email protected]>
Signed-off-by: Loc Huynh <[email protected]>
The prefix strings were not being constructed correctly for many VLMs, particularly due to the use of sub-models. This was causing
quant_config
to be enabled for modules that are ignored within thequantization_config
of the model, causing failures during weight loading.It's important to note that the "XForCausalLM" classes can be used as sub-models in VLMs (Gemma and Llama are easy examples), so we need to have the ability to optionally specify the prefix to those classes. For example in Llama you could have a module name
model.layers.0.mlp.down_proj
, but when it is used within a VLM that module name should belanguage_model.model.layers.0.mlp.down_proj
I propose a
maybe_prefix(prefix, name)
function that handles this logic.I think in the future we should consider making
prefix
a required argument in many cases to make issues less likely, rather than a default empty string.Tested models:
nm-testing/MiniCPM-V-2_6-FP8-dynamic
nm-testing/paligemma-3b-mix-224-FP8-dynamic
neuralmagic/Llama-3.2-11B-Vision-Instruct-FP8-dynamic
nm-testing/Qwen2-VL-7B-Instruct-FP8-dynamic
nm-testing/pixtral-12b-FP8-dynamic
nm-testing/Phi-3.5-vision-instruct-FP8-dynamic
nm-testing/llava-onevision-qwen2-7b-ov-hf-FP8-dynamic