diff --git a/python/sglang/srt/models/glm4_moe_lite.py b/python/sglang/srt/models/glm4_moe_lite.py index 3296a3bf5b56..e9763fe430e0 100644 --- a/python/sglang/srt/models/glm4_moe_lite.py +++ b/python/sglang/srt/models/glm4_moe_lite.py @@ -79,7 +79,7 @@ from sglang.srt.models.deepseek_common.deepseek_weight_loader import ( DeepseekV2WeightLoaderMixin, ) -from sglang.srt.models.deepseek_common.utils import _is_cuda, _use_aiter +from sglang.srt.models.deepseek_common.utils import _is_cuda, _is_xpu, _use_aiter from sglang.srt.models.deepseek_v2 import DeepseekV2AttentionMLA from sglang.srt.runtime_context import get_exec, get_parallel, get_stream from sglang.srt.utils import ( @@ -354,7 +354,7 @@ def forward_normal( topk_output = self.topk.empty_topk_output(hidden_states.device) final_hidden_states = self.experts(hidden_states, topk_output) - if not _is_cuda and not _use_aiter: + if not _is_cuda and not _is_xpu and not _use_aiter: final_hidden_states *= self.routed_scaling_factor if shared_output is not None: with use_symmetric_memory( diff --git a/test/registered/xpu/llm_models/test_xpu_glm_4_7_flash.py b/test/registered/xpu/llm_models/test_xpu_glm_4_7_flash.py new file mode 100644 index 000000000000..9b04645a534d --- /dev/null +++ b/test/registered/xpu/llm_models/test_xpu_glm_4_7_flash.py @@ -0,0 +1,41 @@ +"""GLM-4.7-Flash GSM8K accuracy on Intel XPU (TP=4). + +Scored by sgl-eval's ``gsm8k`` benchmark with the GLM-4.7-Flash cookbook +sampling settings. +""" + +import unittest + +from sglang.test.ci.ci_register import register_xpu_ci +from sglang.test.test_utils import CustomTestCase +from sglang.test.xpu.simple_eval_gsm8k_xpu_mixin import SimpleEvalGSM8KXPUMixin + +register_xpu_ci(est_time=2400, suite="nightly-xpu-kernel-main-4-gpu", nightly=True) + + +class TestGLM4_7FlashXPU(SimpleEvalGSM8KXPUMixin, CustomTestCase): + model = "zai-org/GLM-4.7-Flash" + tp_size = 4 + # 3 runs on 4x B60 scored 0.80-0.90; one question of margin below the lowest. + accuracy = 0.75 + timeout_for_server_launch = 3600 + num_examples = 20 + num_threads = 4 + # Cookbook sampling; the chat template thinks by default. + temperature = 0.7 + top_p = 0.95 + max_tokens = 2048 + + other_args = SimpleEvalGSM8KXPUMixin.other_args + [ + "--reasoning-parser", + "glm45", + "--mem-fraction-static", + "0.85", + # More concurrent requests lose the device on Arc Pro B60. + "--max-running-requests", + "4", + ] + + +if __name__ == "__main__": + unittest.main()