From 55b2aef7ad4751d7ead07d94248a32cd35287401 Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Tue, 20 Oct 2026 05:16:05 +0300 Subject: [PATCH] [Fix] [NPU] LoRA: Update for follow-up with changes in sgl-kernel-npu (#40908) Co-authored-by: ronnie_zheng --- python/sglang/srt/lora/backend/ascend_backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/lora/backend/ascend_backend.py b/python/sglang/srt/lora/backend/ascend_backend.py index 0b96fe2dde..9ddb94335a 100644 --- a/python/sglang/srt/lora/backend/ascend_backend.py +++ b/python/sglang/srt/lora/backend/ascend_backend.py @@ -104,7 +104,7 @@ class AscendLoRABackend(BaseLoRABackend): output_tensor = base_output torch.ops.npu.sgemmv_expand( - x, + x.to(dtype=torch.float), weights, self.batch_info.weight_indices, self.batch_info.seg_lens, @@ -152,6 +152,7 @@ class AscendLoRABackend(BaseLoRABackend): self.batch_info.lora_ranks, self.batch_info.scalings, lora_a_output, + n_slices, ) torch.ops.npu.sgemmv_expand( @@ -182,6 +183,7 @@ class AscendLoRABackend(BaseLoRABackend): total_seq_len, _ = x.shape _, weight_intermediate_dim, _ = gate_up_lora_a.shape _, weight_out_dim, _ = gate_up_lora_b.shape + n_slices = 2 if base_output is None: output_tensor = torch.zeros( @@ -202,6 +204,7 @@ class AscendLoRABackend(BaseLoRABackend): self.batch_info.lora_ranks, self.batch_info.scalings, lora_a_output, + n_slices, ) torch.ops.npu.sgemmv_expand(