Clamp logprob tokens with model vocab size (#14414)

This commit is contained in:
cklxx
2025-12-29 20:37:07 +08:00
committed by GitHub
parent f3d73b0199
commit d48723b77d

View File

@@ -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