From c56d19b9779cc5e4b613e9fee5cb1f13fe5f1a0b Mon Sep 17 00:00:00 2001 From: MikkoParkkola <78788115+MikkoParkkola@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:43:17 +0100 Subject: [PATCH] fix(quantization): add sgl_kernel fallback for FP4 quantize on Blackwell GPUs (#17816) --- python/sglang/srt/layers/quantization/modelopt_quant.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/layers/quantization/modelopt_quant.py b/python/sglang/srt/layers/quantization/modelopt_quant.py index f7fc3d026..dc9501133 100755 --- a/python/sglang/srt/layers/quantization/modelopt_quant.py +++ b/python/sglang/srt/layers/quantization/modelopt_quant.py @@ -66,12 +66,15 @@ if TYPE_CHECKING: StandardDispatchOutput, ) +fp4_quantize = None try: if is_sm120_supported(): - from flashinfer import fp4_quantize + try: + from flashinfer import fp4_quantize + except ImportError: + from sgl_kernel import scaled_fp4_quant as fp4_quantize else: from sgl_kernel import scaled_fp4_quant as fp4_quantize - except ImportError: fp4_quantize = None