Fix input logprob index (#9841)

Co-authored-by: Sheng Shen <sheng.s@berkeley.edu>
This commit is contained in:
Lianmin Zheng
2025-08-31 02:56:47 -07:00
committed by GitHub
parent f05c68733e
commit 25c7395934

View File

@@ -93,12 +93,13 @@ class SchedulerOutputProcessorMixin:
# This updates radix so others can match
self.tree_cache.cache_unfinished_req(req)
if req.return_logprob:
if batch.return_logprob:
assert extend_logprob_start_len_per_req is not None
assert extend_input_len_per_req is not None
extend_logprob_start_len = extend_logprob_start_len_per_req[i]
extend_input_len = extend_input_len_per_req[i]
num_input_logprobs = extend_input_len - extend_logprob_start_len
if req.return_logprob:
self.add_logprob_return_values(
i,
req,
@@ -146,7 +147,7 @@ class SchedulerOutputProcessorMixin:
skip_stream_req = req
# Incrementally update input logprobs.
if req.return_logprob:
if batch.return_logprob:
extend_logprob_start_len = extend_logprob_start_len_per_req[i]
extend_input_len = extend_input_len_per_req[i]
if extend_logprob_start_len < extend_input_len:
@@ -154,6 +155,7 @@ class SchedulerOutputProcessorMixin:
num_input_logprobs = (
extend_input_len - extend_logprob_start_len
)
if req.return_logprob:
self.add_input_logprob_return_values(
i,
req,