From b8db7f4abd2c864d5a7045b6d36fa36c2c7bb1e1 Mon Sep 17 00:00:00 2001 From: Hank_ <37239608+ILikeIneine@users.noreply.github.com> Date: Fri, 7 Aug 2026 16:21:13 +0800 Subject: [PATCH] [Bugfix][Quantization] Fix dynamic INT8 W8A8 MoE config being built as W8A16 (#50833) Signed-off-by: Hank Co-authored-by: Cyrus Leung --- vllm/model_executor/layers/fused_moe/oracle/int8.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vllm/model_executor/layers/fused_moe/oracle/int8.py b/vllm/model_executor/layers/fused_moe/oracle/int8.py index ab7775bf32..be99d0b09a 100644 --- a/vllm/model_executor/layers/fused_moe/oracle/int8.py +++ b/vllm/model_executor/layers/fused_moe/oracle/int8.py @@ -183,9 +183,10 @@ def make_int8_moe_quant_config( per_act_token_quant: bool = False, layer: torch.nn.Module | None = None, ) -> FusedMoEQuantConfig: - assert (a1_scale is None and a2_scale is None) or ( - a1_scale is not None and a2_scale is not None - ), "a1_scale and a2_scale must both be provided or both be None" + if (a1_scale is None) != (a2_scale is None): + raise ValueError("a1_scale and a2_scale must both be provided or both be None") + + scales_absent = a1_scale is None and a2_scale is None if int8_backend == Int8MoeBackend.HUMMING: from vllm.model_executor.layers.fused_moe import RoutedExperts @@ -196,7 +197,7 @@ def make_int8_moe_quant_config( assert isinstance(layer, RoutedExperts) return get_humming_moe_quant_config(layer) - if a1_scale is None or a2_scale is None: + if scales_absent and not per_act_token_quant: return int8_w8a16_moe_quant_config( w1_scale=w1_scale, w2_scale=w2_scale,