From 7802586cab1f6c5bab1abafea1d07ef2f3ff09d8 Mon Sep 17 00:00:00 2001 From: Rain Jiang <96632942+rainj-me@users.noreply.github.com> Date: Sun, 7 Sep 2025 20:28:14 -0700 Subject: [PATCH] fix the fp8 topk_config.correction_bias is none bug (#10040) --- python/sglang/srt/layers/quantization/fp8.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/sglang/srt/layers/quantization/fp8.py b/python/sglang/srt/layers/quantization/fp8.py index ecdca3381..41b59b103 100644 --- a/python/sglang/srt/layers/quantization/fp8.py +++ b/python/sglang/srt/layers/quantization/fp8.py @@ -1132,10 +1132,12 @@ class Fp8MoEMethod(FusedMoEMethodBase): and topk_config.topk_group is not None ), "Current trtllm_fp8_block_scale_moe kernel does not support these two arguments as None" - if topk_config.correction_bias is None: - correction_bias = topk_config.correction_bias.to(x.dtype) - else: - correction_bias = None + correction_bias = ( + None + if topk_config.correction_bias is None + else topk_config.correction_bias.to(x.dtype) + ) + return trtllm_fp8_block_scale_moe( routing_logits=router_logits.to(torch.float32), routing_bias=correction_bias,