[Bugfix] Catch and log invalid token ids in detokenizer (#24351)
Signed-off-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
@@ -233,6 +233,11 @@ class FastIncrementalDetokenizer(BaseIncrementalDetokenizer):
|
|||||||
def _protected_step(self, next_token_id: int) -> Optional[str]:
|
def _protected_step(self, next_token_id: int) -> Optional[str]:
|
||||||
try:
|
try:
|
||||||
token = self.stream.step(self.tokenizer, next_token_id)
|
token = self.stream.step(self.tokenizer, next_token_id)
|
||||||
|
except OverflowError:
|
||||||
|
# Handle rare observed overflow, still to be diagnosed.
|
||||||
|
# See https://github.com/vllm-project/vllm/issues/21951.
|
||||||
|
logger.exception("Encountered invalid token id: %d", next_token_id)
|
||||||
|
token = None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if not str(e).startswith(INVALID_PREFIX_ERR_MSG):
|
if not str(e).startswith(INVALID_PREFIX_ERR_MSG):
|
||||||
raise e
|
raise e
|
||||||
|
|||||||
Reference in New Issue
Block a user