[Model] Add AWQ quantization support for InternVL2 model by Isotr0py · Pull Request #7187 · vllm-project/vllm (original) (raw)

@Isotr0py

FILL IN THE PR DESCRIPTION HERE

FIX #xxxx (link existing issues this PR will resolve)

TODO

BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE


PR Checklist (Click to Expand)

Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.

PR Title and Classification

Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

Notes for Large Changes

Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with rfc-required and might not go through the PR.

What to Expect for the Reviews

The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:

Thank You

Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!

@Isotr0py

@github-actions

👋 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 consists a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of default ones by unblocking the steps in your fast-check build on Buildkite UI.

Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge).

To run full CI, you can do one of these:

🚀

@Isotr0py

@Isotr0py

@Isotr0py

Let's see whether the 26B awq test can work on CI.

@Isotr0py Isotr0py marked this pull request as ready for review

August 8, 2024 06:32

@Isotr0py

The 26B AWQ model test costs about 22GB on my local environment with an RTX3090Ti:

$ pytest -s -v tests/models/test_internvl.py::test_large_models ================================================================================== test session starts =================================================================================== platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0 -- /root/miniconda3/bin/python cachedir: .pytest_cache rootdir: /root/autodl-tmp/vllm configfile: pyproject.toml plugins: shard-0.1.2, rerunfailures-14.0, forked-1.6.0, asyncio-0.23.8, anyio-4.4.0 asyncio: mode=Mode.STRICT collected 1 item
Running 1 items in this shard: tests/models/test_internvl.py::test_large_models[128-half-expected_outputs0-/root/autodl-tmp/InternVL2-26B-AWQ]

tests/models/test_internvl.py::test_large_models[128-half-expected_outputs0-/root/autodl-tmp/InternVL2-26B-AWQ] WARNING 08-09 11:08:27 config.py:1483] Casting torch.bfloat16 to torch.float16. WARNING 08-09 11:08:27 config.py:286] awq quantization is not fully optimized yet. The speed can be slower than non-quantized models. INFO 08-09 11:08:27 llm_engine.py:176] Initializing an LLM engine (v0.5.4) with config: model='/root/autodl-tmp/InternVL2-26B-AWQ', speculative_config=None, tokenizer='/root/autodl-tmp/InternVL2-26B-AWQ', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, rope_scaling=None, rope_theta=None, tokenizer_revision=None, trust_remote_code=True, dtype=torch.float16, max_seq_len=1024, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=1, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=awq, enforce_eager=True, kv_cache_dtype=auto, quantization_param_path=None, device_config=cuda, decoding_config=DecodingConfig(guided_decoding_backend='outlines'), observability_config=ObservabilityConfig(otlp_traces_endpoint=None), seed=0, served_model_name=/root/autodl-tmp/InternVL2-26B-AWQ, use_v2_block_manager=False, enable_prefix_caching=False) WARNING 08-09 11:08:27 tokenizer.py:137] Using a slow tokenizer. This might cause a significant slowdown. Consider using a fast tokenizer instead. INFO 08-09 11:08:27 model_runner.py:721] Starting to load model /root/autodl-tmp/InternVL2-26B-AWQ... Loading pt checkpoint shards: 0% Completed | 0/13 [00:00<?, ?it/s] Loading pt checkpoint shards: 8% Completed | 1/13 [00:00<00:09, 1.21it/s] Loading pt checkpoint shards: 15% Completed | 2/13 [00:02<00:12, 1.15s/it] Loading pt checkpoint shards: 23% Completed | 3/13 [00:03<00:12, 1.22s/it] Loading pt checkpoint shards: 31% Completed | 4/13 [00:04<00:11, 1.26s/it] Loading pt checkpoint shards: 38% Completed | 5/13 [00:06<00:10, 1.29s/it] Loading pt checkpoint shards: 46% Completed | 6/13 [00:07<00:09, 1.32s/it] Loading pt checkpoint shards: 54% Completed | 7/13 [00:08<00:06, 1.07s/it] Loading pt checkpoint shards: 62% Completed | 8/13 [00:09<00:05, 1.08s/it] Loading pt checkpoint shards: 69% Completed | 9/13 [00:10<00:04, 1.14s/it] Loading pt checkpoint shards: 77% Completed | 10/13 [00:11<00:03, 1.13s/it] Loading pt checkpoint shards: 85% Completed | 11/13 [00:12<00:02, 1.02s/it] Loading pt checkpoint shards: 92% Completed | 12/13 [00:13<00:01, 1.04s/it] Loading pt checkpoint shards: 100% Completed | 13/13 [00:14<00:00, 1.07s/it] Loading pt checkpoint shards: 100% Completed | 13/13 [00:14<00:00, 1.12s/it]

INFO 08-09 11:08:45 model_runner.py:733] Loading model weights took 21.7726 GB WARNING 08-09 11:08:45 model_runner.py:898] Computed max_num_seqs (min(256, 2048 // 3328)) to be less than 1. Setting it to the minimum value of 1. WARNING 08-09 11:08:46 tokenizer.py:137] Using a slow tokenizer. This might cause a significant slowdown. Consider using a fast tokenizer instead. INFO 08-09 11:08:51 gpu_executor.py:102] # GPU blocks: 209, # CPU blocks: 1365

It's strange that the CI will OOM on L4 with 24G VRAM refer to CI log.

@Isotr0py

@DarkLight1337

The 26B AWQ model test costs about 22GB on my local environment with an RTX3090Ti:

$ pytest -s -v tests/models/test_internvl.py::test_large_models ================================================================================== test session starts =================================================================================== platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0 -- /root/miniconda3/bin/python cachedir: .pytest_cache rootdir: /root/autodl-tmp/vllm configfile: pyproject.toml plugins: shard-0.1.2, rerunfailures-14.0, forked-1.6.0, asyncio-0.23.8, anyio-4.4.0 asyncio: mode=Mode.STRICT collected 1 item
Running 1 items in this shard: tests/models/test_internvl.py::test_large_models[128-half-expected_outputs0-/root/autodl-tmp/InternVL2-26B-AWQ]

tests/models/test_internvl.py::test_large_models[128-half-expected_outputs0-/root/autodl-tmp/InternVL2-26B-AWQ] WARNING 08-09 11:08:27 config.py:1483] Casting torch.bfloat16 to torch.float16. WARNING 08-09 11:08:27 config.py:286] awq quantization is not fully optimized yet. The speed can be slower than non-quantized models. INFO 08-09 11:08:27 llm_engine.py:176] Initializing an LLM engine (v0.5.4) with config: model='/root/autodl-tmp/InternVL2-26B-AWQ', speculative_config=None, tokenizer='/root/autodl-tmp/InternVL2-26B-AWQ', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, rope_scaling=None, rope_theta=None, tokenizer_revision=None, trust_remote_code=True, dtype=torch.float16, max_seq_len=1024, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=1, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=awq, enforce_eager=True, kv_cache_dtype=auto, quantization_param_path=None, device_config=cuda, decoding_config=DecodingConfig(guided_decoding_backend='outlines'), observability_config=ObservabilityConfig(otlp_traces_endpoint=None), seed=0, served_model_name=/root/autodl-tmp/InternVL2-26B-AWQ, use_v2_block_manager=False, enable_prefix_caching=False) WARNING 08-09 11:08:27 tokenizer.py:137] Using a slow tokenizer. This might cause a significant slowdown. Consider using a fast tokenizer instead. INFO 08-09 11:08:27 model_runner.py:721] Starting to load model /root/autodl-tmp/InternVL2-26B-AWQ... Loading pt checkpoint shards: 0% Completed | 0/13 [00:00<?, ?it/s] Loading pt checkpoint shards: 8% Completed | 1/13 [00:00<00:09, 1.21it/s] Loading pt checkpoint shards: 15% Completed | 2/13 [00:02<00:12, 1.15s/it] Loading pt checkpoint shards: 23% Completed | 3/13 [00:03<00:12, 1.22s/it] Loading pt checkpoint shards: 31% Completed | 4/13 [00:04<00:11, 1.26s/it] Loading pt checkpoint shards: 38% Completed | 5/13 [00:06<00:10, 1.29s/it] Loading pt checkpoint shards: 46% Completed | 6/13 [00:07<00:09, 1.32s/it] Loading pt checkpoint shards: 54% Completed | 7/13 [00:08<00:06, 1.07s/it] Loading pt checkpoint shards: 62% Completed | 8/13 [00:09<00:05, 1.08s/it] Loading pt checkpoint shards: 69% Completed | 9/13 [00:10<00:04, 1.14s/it] Loading pt checkpoint shards: 77% Completed | 10/13 [00:11<00:03, 1.13s/it] Loading pt checkpoint shards: 85% Completed | 11/13 [00:12<00:02, 1.02s/it] Loading pt checkpoint shards: 92% Completed | 12/13 [00:13<00:01, 1.04s/it] Loading pt checkpoint shards: 100% Completed | 13/13 [00:14<00:00, 1.07s/it] Loading pt checkpoint shards: 100% Completed | 13/13 [00:14<00:00, 1.12s/it]

INFO 08-09 11:08:45 model_runner.py:733] Loading model weights took 21.7726 GB WARNING 08-09 11:08:45 model_runner.py:898] Computed max_num_seqs (min(256, 2048 // 3328)) to be less than 1. Setting it to the minimum value of 1. WARNING 08-09 11:08:46 tokenizer.py:137] Using a slow tokenizer. This might cause a significant slowdown. Consider using a fast tokenizer instead. INFO 08-09 11:08:51 gpu_executor.py:102] # GPU blocks: 209, # CPU blocks: 1365

It's strange that the CI will OOM on L4 with 24G VRAM refer to CI log.

vLLM only uses 90% of the GPU memory by default. You can try setting gpu_memory_utilization to a higher value in your test. If this doesn't work, we might have to test the model in distributed tests which can split it over multiple GPUs.

@Isotr0py

I have passed gpu_memory_utilization=1.0 and cpu_offload_gb=4 to vllm_runner but it still keeps OOM. I agree that we can add this model to distributed tests.

@Isotr0py

@Isotr0py

@Isotr0py

@DarkLight1337 The VLM tests have passed again. Can you please take a look at this? Thanks!

DarkLight1337

Choose a reason for hiding this comment

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

Thanks for enabling this!

Alvant pushed a commit to compressa-ai/vllm that referenced this pull request

Oct 26, 2024

@Isotr0py @Alvant

…t#7187)

Signed-off-by: Alvant alvasian@yandex.ru

LeiWang1999 pushed a commit to LeiWang1999/vllm-bitblas that referenced this pull request

Mar 26, 2025

@Isotr0py @LeiWang1999

…t#7187)

Signed-off-by: LeiWang1999 leiwang1999@outlook.com

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})