From a937ec31bed48c3418d983ddb70e5106cf376970 Mon Sep 17 00:00:00 2001 From: KrishnanPrash <140860868+KrishnanPrash@users.noreply.github.com> Date: Fri, 10 Apr 2026 11:42:23 -0700 Subject: [PATCH] fix: server crash when stop_token_ids contains null (#22175) Signed-off-by: Krishnan Prashanth --- python/sglang/srt/sampling/sampling_params.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/sampling/sampling_params.py b/python/sglang/srt/sampling/sampling_params.py index a7f4c664f..463c6e17f 100644 --- a/python/sglang/srt/sampling/sampling_params.py +++ b/python/sglang/srt/sampling/sampling_params.py @@ -68,7 +68,8 @@ class SamplingParams: self.max_new_tokens = max_new_tokens self.stop_strs = stop if stop_token_ids: - self.stop_token_ids = set(stop_token_ids) + filtered = {int(t) for t in stop_token_ids if t is not None} + self.stop_token_ids = filtered or None else: self.stop_token_ids = None self.stop_regex_strs = stop_regex