Skip to content

Commit 48e5320

Browse files
gshtrasmicah-wil
authored andcommitted
With transformers >= 4.56 the error message is more explicit and doesn't match exactly
Signed-off-by: Gregory Shtrasberg <[email protected]> Change condition to check for inclusion Signed-off-by: Gregory Shtrasberg <[email protected]> Fix DecodeStream API change Signed-off-by: Gregory Shtrasberg <[email protected]>
1 parent d457cf2 commit 48e5320

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 INVALID_PREFIX_ERR_MSG not in str(e):
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)