From 4aeba40d7bd230de6a7d4f2b3936749c774985b9 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Wed, 27 Aug 2025 17:00:09 -0700 Subject: [PATCH] [Sync] Update mxfp4.py (20250827) (#9724) Co-authored-by: github-actions[bot] Co-authored-by: Shiyang Chen --- python/sglang/srt/layers/quantization/mxfp4.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/python/sglang/srt/layers/quantization/mxfp4.py b/python/sglang/srt/layers/quantization/mxfp4.py index 6b2d82e92..c353cbba3 100644 --- a/python/sglang/srt/layers/quantization/mxfp4.py +++ b/python/sglang/srt/layers/quantization/mxfp4.py @@ -66,10 +66,15 @@ _is_hip = is_hip() if _is_hip: # import aiter - from aiter import ActivationType, QuantType, dtypes - from aiter.fused_moe import fused_moe - from aiter.ops.triton.quant import dynamic_mxfp4_quant - from aiter.utility.fp4_utils import e8m0_shuffle + try: + from aiter import ActivationType, QuantType, dtypes + from aiter.fused_moe import fused_moe + from aiter.ops.triton.quant import dynamic_mxfp4_quant + from aiter.utility.fp4_utils import e8m0_shuffle + except ImportError as err: + ActivationType = QuantType = dtypes = fused_moe = dynamic_mxfp4_quant = ( + e8m0_shuffle + ) = err def _swizzle_mxfp4(quant_tensor, scale, num_warps):