Skip to content
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] Ignore GPTQ quantization of Qwen2-VL visual module #10169

Merged
merged 1 commit into from
Nov 9, 2024

Conversation

mgoin
Copy link
Collaborator

@mgoin mgoin commented Nov 8, 2024

FIX #9832

This is a workaround for the fact that GPTQ configs generated by AutoGPTQ do not have a list of ignored modules to check if a module should be quantized. We hardcode a case where we set the quant_config = None when passing it to Qwen2-VL's visual module if the config is GPTQ-based.

The issue remains that we will need to use this utility on a case-by-case basis for each model.

Tested with an evaluation:

vllm (pretrained=Qwen/Qwen2-VL-2B-Instruct-GPTQ-Int4), gen_kwargs: (None), limit: None, num_fewshot: 5, batch_size: auto
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.4481|±  |0.0137|
|     |       |strict-match    |     5|exact_match|↑  |0.4337|±  |0.0137|

As an example see this model https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct-GPTQ-Int4

You can see in its quantization_config that there is no mention of ignored modules:

  "quantization_config": {
    "bits": 4,
    "damp_percent": 0.1,
    "dataset": null,
    "desc_act": false,
    "group_size": 128,
    "modules_in_block_to_quantize": null,
    "quant_method": "gptq",
    "sym": true,
    "true_sequential": true
  },

However looking at the model checkpoint you can see that all of the Linear modules under model.layers.* are quantized, but the Linear modules under visual.blocks.* are not at all:
image

Copy link

github-actions bot commented Nov 8, 2024

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) November 9, 2024 02:25
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 9, 2024
@DarkLight1337 DarkLight1337 merged commit f83fecc into vllm-project:main Nov 9, 2024
64 of 66 checks passed
@@ -982,7 +984,7 @@ def __init__(self,
self.visual = Qwen2VisionTransformer(
config.vision_config,
norm_eps=getattr(config, "rms_norm_eps", 1e-6),
quant_config=quant_config,
quant_config=self._maybe_ignore_quant_config(quant_config),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question: What should we do if our users execute their own quantization, and they have quantized the visual encoder?

omer-dayan pushed a commit to omer-dayan/vllm that referenced this pull request Nov 10, 2024
JC1DA pushed a commit to JC1DA/vllm that referenced this pull request Nov 11, 2024
jeejeelee pushed a commit to jeejeelee/vllm that referenced this pull request Nov 11, 2024
rickyyx pushed a commit to rickyyx/vllm that referenced this pull request Nov 13, 2024
sumitd2 pushed a commit to sumitd2/vllm that referenced this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Usage]: ValueError: Unexpected weight for Qwen2-VL GPTQ 4-bit custom model.
3 participants