diff --git a/python/sglang/srt/layers/sampler.py b/python/sglang/srt/layers/sampler.py index 7d3a34ab1a..d44d697a0b 100644 --- a/python/sglang/srt/layers/sampler.py +++ b/python/sglang/srt/layers/sampler.py @@ -874,6 +874,7 @@ def top_k_top_p_min_p_sampling_from_logits_ascend( """ # torch_npu.npu_top_k_top_p requires top_k value range in [1, 1024] if hasattr(torch_npu, "npu_top_k_top_p") and npu_top_k_top_p_eligible: + top_ps = top_ps.to(logits.dtype) logits_top_k_top_p = torch_npu.npu_top_k_top_p(logits, top_ps, top_ks) probs_top_k_top_p = logits_top_k_top_p.softmax(dim=-1)