From ca95556c76b55eede4f3cd2591219a250fd71bd5 Mon Sep 17 00:00:00 2001 From: fzyzcjy <5236035+fzyzcjy@users.noreply.github.com> Date: Tue, 27 May 2025 10:19:08 +0800 Subject: [PATCH] Tiny fix sampler error when prob is not contiguous (#6639) --- python/sglang/srt/layers/sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/srt/layers/sampler.py b/python/sglang/srt/layers/sampler.py index 79d13908f..f36dc5ca2 100644 --- a/python/sglang/srt/layers/sampler.py +++ b/python/sglang/srt/layers/sampler.py @@ -101,7 +101,7 @@ class Sampler(nn.Module): # Check Nan will throw exception, only check when crash_on_warnings is True check_nan = self.use_nan_detection and crash_on_warnings() batch_next_token_ids = top_k_top_p_sampling_from_probs( - probs, + probs.contiguous(), sampling_info.top_ks, sampling_info.top_ps, filter_apply_order="joint",