Skip to content

[Bugfix] Fix kv_cache_dtype=fp8 without scales for FP8 checkpoints #6761

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

Merged
merged 3 commits into from
Jul 25, 2024

Conversation

mgoin
Copy link
Member

@mgoin mgoin commented Jul 24, 2024

FIX #6738

Enabling kv_cache_dtype=fp8 quantization without scales in an FP8 model checkpoint was broken since the default k/v_scale wasn't saved as a float.

On main you would see this error if enabling fp8 kv cache with an FP8 model:

> vllm serve neuralmagic/Qwen2-0.5B-Instruct-FP8 --enforce-eager --kv-cache-dtype=fp8

[rank0]:   File "/home/mgoin/code/vllm-ct/vllm/model_executor/model_loader/loader.py", line 294, in load_model
[rank0]:     quant_method.process_weights_after_loading(module)
[rank0]:   File "/home/mgoin/code/vllm-ct/vllm/model_executor/layers/quantization/kv_cache.py", line 65, in process_weights_after_loading
[rank0]:     raise ValueError("Only support per-tensor scaling factor "
[rank0]: ValueError: Only support per-tensor scaling factor for fp8 KV cache

Copy link

👋 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:

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

🚀

@mgoin mgoin changed the title [Bugfix] Fix fp8 kv cache without scales [Bugfix] Fix kv_cache_dtype=fp8 without scales for FP8 checkpoints Jul 24, 2024
@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 24, 2024
@mgoin mgoin enabled auto-merge (squash) July 25, 2024 14:51
@simon-mo simon-mo disabled auto-merge July 25, 2024 16:46
@simon-mo simon-mo merged commit 65b1f12 into main Jul 25, 2024
70 of 73 checks passed
Alvant pushed a commit to compressa-ai/vllm that referenced this pull request Oct 26, 2024
@simon-mo simon-mo deleted the fix-unloaded-fp8-kv-scales branch October 28, 2024 16:50
LeiWang1999 pushed a commit to LeiWang1999/vllm-bitblas that referenced this pull request Mar 26, 2025
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.

[Bug]: The FP8 models and FP8 KV-Cache-Scales loaded together failed on the latest 0.5.3
4 participants