Refine logprob logic for request handling (#17986)

This commit is contained in:
Cheng Wan
2026-02-01 19:11:52 -08:00
committed by GitHub
parent ea04bc1dd6
commit ab8b99eb23

View File

@@ -1545,8 +1545,9 @@ class Scheduler(
recv_req.logprob_start_len = -1
if recv_req.logprob_start_len == -1:
if recv_req.return_logprob:
# If return_logprob is True, return the logprobs for output tokens by default
if recv_req.return_logprob and recv_req.token_ids_logprob is None:
# If logprob is required but neither token_ids_logprob nor logprob_start_len is
# set, return the logprobs for output tokens by default
req.logprob_start_len = len(req.origin_input_ids) - 1
elif req.is_prefill_only:
# For prefill-only requests with logprob_start_len == -1, set logprob_start_len