From 9ad28f639e0a7e57304a1d7498cd2e3523975cf6 Mon Sep 17 00:00:00 2001 From: aoshen524 Date: Sat, 26 Apr 2025 22:51:01 -0400 Subject: [PATCH] fix(srt): check if sample_indices is not None before usage. (#5633) --- python/sglang/srt/layers/logits_processor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/layers/logits_processor.py b/python/sglang/srt/layers/logits_processor.py index 981040d0d..4958c6d04 100644 --- a/python/sglang/srt/layers/logits_processor.py +++ b/python/sglang/srt/layers/logits_processor.py @@ -335,13 +335,13 @@ class LogitsProcessor(nn.Module): aux_pruned_states = torch.cat(aux_pruned_states, dim=-1) hidden_states_to_store = ( aux_pruned_states[sample_indices] - if sample_indices + if sample_indices is not None else aux_pruned_states ) else: hidden_states_to_store = ( pruned_states[sample_indices] - if sample_indices + if sample_indices is not None else pruned_states ) else: