diff --git a/python/sglang/srt/managers/schedule_batch.py b/python/sglang/srt/managers/schedule_batch.py index 05125bd3a..e49ad99f6 100644 --- a/python/sglang/srt/managers/schedule_batch.py +++ b/python/sglang/srt/managers/schedule_batch.py @@ -1551,6 +1551,9 @@ class ScheduleBatch(ScheduleBatchDisaggregationDecodeMixin): extend_input_logprob_token_ids = torch.tensor( extend_input_logprob_token_ids ) + # Clamp placeholder or out-of-range token IDs (e.g., multimodal hashes) + # so they stay within the vocab boundary before being sent to GPU. + extend_input_logprob_token_ids.clamp_(0, self.model_config.vocab_size - 1) else: extend_input_logprob_token_ids = None