From 7eebd4404764dd778e18cc0fc4866d97504271f0 Mon Sep 17 00:00:00 2001 From: JieXin Liang Date: Mon, 21 Jul 2025 08:39:57 +0800 Subject: [PATCH] [fix] fix modelopt fp4 on b200 (#8195) --- python/sglang/srt/layers/quantization/petit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/layers/quantization/petit.py b/python/sglang/srt/layers/quantization/petit.py index e7ee3239f..2c608507c 100644 --- a/python/sglang/srt/layers/quantization/petit.py +++ b/python/sglang/srt/layers/quantization/petit.py @@ -21,6 +21,9 @@ from sglang.srt.layers.quantization.petit_utils import ( verify_petit_nvfp4_supported, ) from sglang.srt.layers.quantization.utils import is_layer_skipped +from sglang.srt.utils import is_hip + +_is_hip = is_hip() # Initialize logger for the module logger = logging.getLogger(__name__) @@ -104,7 +107,7 @@ class PetitNvFp4Config(QuantizationConfig): @classmethod def is_petit_nvfp4_compatible(cls, quant_config: Dict[str, Any]) -> bool: quant_method = quant_config.get("quant_method", "").lower() - return quant_method == "modelopt" + return _is_hip and quant_method == "modelopt" def is_layer_excluded(self, prefix: str, exclude_modules: list): for pattern in exclude_modules: