fix: correct off-by-one in vocab boundary check for token validation (#22367)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: fzyzcjy <ch271828n@outlook.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
fzyzcjy
parent
fde4004429
commit
7f730edfdc
@@ -1330,7 +1330,7 @@ class Req(ReqDllmMixin):
|
||||
|
||||
def _check_vocab_boundary_finish(self, new_accepted_tokens: List[int] = None):
|
||||
for i, token_id in enumerate(new_accepted_tokens):
|
||||
if token_id > self.vocab_size or token_id < 0:
|
||||
if token_id >= self.vocab_size or token_id < 0:
|
||||
offset = len(self.output_ids) - len(new_accepted_tokens) + i
|
||||
if self.sampling_params.stop_token_ids:
|
||||
self.output_ids[offset] = next(
|
||||
|
||||
Reference in New Issue
Block a user