Skip to content

Fix noisy warning for uncalibrated q_scale/p_scale #17414

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 1 commit into from
May 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions vllm/model_executor/layers/quantization/kv_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ def process_weights_after_loading(self, layer: torch.nn.Module) -> None:
# These are used in the final Attention.forward()
layer._q_scale.copy_(q_scale)
layer._prob_scale.copy_(prob_scale)
if q_scale == 1.0 or prob_scale == 1.0:
if layer.kv_cache_dtype == "fp8" and (q_scale == 1.0
or prob_scale == 1.0):
logger.warning_once(
f"Using Q scale {q_scale} and prob scale {prob_scale} "
"with fp8 attention. This may cause accuracy issues. "
"Please make sure Q/prob scaling factors are "
f"Using uncalibrated q_scale {q_scale} and/or prob_scale "
Copy link
Contributor

Choose a reason for hiding this comment

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

Why "uncalibrated"? I only see the warning once when I run it, doesn't seem to be very noisy. Depending on which lands first (#17331) can check the VLLM_ROCM_USE_FP8_SCALES flag too, since the warning won't be necessary if VLLM_ROCM_USE_FP8_SCALES=0.

Copy link
Member Author

Choose a reason for hiding this comment

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

I even see this when running INT4 models, this is triggered for most quantization methods

INFO 05-07 03:01:24 [gpu_model_runner.py:1360] Starting to load model RedHatAI/Qwen3-30B-A3B-quantized.w4a16...

INFO 05-07 03:01:34 [loader.py:459] Loading weights took 9.47 seconds
WARNING 05-07 03:01:34 [kv_cache.py:128] Using Q scale 1.0 and prob scale 1.0 with fp8 attention. This may cause accuracy issues. Please make sure Q/prob scaling factors are available in the fp8 checkpoint.

Copy link
Member Author

Choose a reason for hiding this comment

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

The scales are uncalibrated because they are 1.0

f"{prob_scale} with fp8 attention. This may cause accuracy "
"issues. Please make sure q/prob scaling factors are "
"available in the fp8 checkpoint.")

del layer.k_scale
Expand Down