Skip to content

Commit 2c301ee

Browse files
[Bugfix] Fix Incremental Detokenization with tokenizers == 0.22.0 (vllm-project#24159)
Signed-off-by: Fanli Lin <[email protected]> Signed-off-by: Fanli Lin <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 3efb9f4 commit 2c301ee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vllm/v1/engine/detokenizer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _protected_step(self, next_token_id: int) -> Optional[str]:
234234
try:
235235
token = self.stream.step(self.tokenizer, next_token_id)
236236
except Exception as e:
237-
if str(e) != INVALID_PREFIX_ERR_MSG:
237+
if not str(e).startswith(INVALID_PREFIX_ERR_MSG):
238238
raise e
239239
# Recover from edge case where tokenizer can produce non-monotonic,
240240
# invalid UTF-8 output, which breaks the internal state of
@@ -243,7 +243,8 @@ def _protected_step(self, next_token_id: int) -> Optional[str]:
243243
logger.warning(
244244
"Encountered invalid prefix detokenization error"
245245
" for request %s, resetting decode stream.", self.request_id)
246-
self.stream = DecodeStream(self.skip_special_tokens)
246+
self.stream = DecodeStream(
247+
skip_special_tokens=self.skip_special_tokens)
247248
token = self.stream.step(self.tokenizer, next_token_id)
248249
return token
249250

0 commit comments

Comments
 (0)