support qwen2 running on ascend npu device (#7022)

Co-authored-by: 刁莹煜 <diaoyingyu1@hisilicon.com>
This commit is contained in:
Yijie Zhu
2025-06-18 02:24:10 +08:00
committed by GitHub
parent 10d60cd41b
commit a39d928782
9 changed files with 63 additions and 16 deletions

View File

@@ -20,10 +20,11 @@ import torch
import torch.nn as nn
from sglang.srt.custom_op import CustomOp
from sglang.srt.utils import get_bool_env_var, is_cuda, is_hip
from sglang.srt.utils import get_bool_env_var, is_cuda, is_hip, is_npu
_is_cuda = is_cuda()
_is_hip = is_hip()
_is_npu = is_npu()
_use_aiter = get_bool_env_var("SGLANG_USE_AITER") and _is_hip
if _is_cuda:
@@ -187,7 +188,7 @@ class Gemma3RMSNorm(nn.Module):
return f"{tuple(self.weight.shape)}, eps={self.eps}"
if not (_is_cuda or _is_hip):
if not (_is_cuda or _is_hip or _is_npu):
logger.info(
"sgl-kernel layernorm implementation is not available on current platform. Fallback to other kernel libraries."
)