fix(schedule_batch): trim stop string when EOS matches in the same step (#28802)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Maxwill Lin
2026-06-22 13:14:00 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 7c23d2255a
commit bbc853df46
2 changed files with 23 additions and 5 deletions
+7 -3
View File
@@ -1423,15 +1423,19 @@ class Req(ReqDllmMixin):
new_accepted_tokens = self.output_ids[-new_accepted_len:]
if self._check_token_based_finish(new_accepted_tokens):
return
# Sanitize out-of-range / NaN token ids before any decode.
if self._check_vocab_boundary_finish(new_accepted_tokens):
return
# Stop string beats EOS/stop-token matched in the same step (speculative
# decoding can accept >1 token): token-based would trim only the last
# token and leak the stop string.
if self._check_str_based_finish(new_accepted_len):
return
if self._check_token_based_finish(new_accepted_tokens):
return
def reset_for_retract(self):
# Increment retraction count before resetting other state. We should not reset this
# since we are tracking the total number of retractions for each request.