Skip to content

Commit b19e3d4

Browse files
author
Roger Wang
committed
comment
Signed-off-by: Roger Wang <[email protected]>
1 parent 6db3cf9 commit b19e3d4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

vllm/v1/engine/processor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ def _validate_model_input(
470470
else:
471471
tokenizer = self.tokenizer.get_lora_tokenizer(lora_request)
472472
max_input_id = max(prompt_ids, default=0)
473+
474+
# NOTE: tokenizer.max_token_id is the tokenizer’s vocab size while
475+
# self.model_config.get_vocab_size() is the model’s vocab size.
476+
# For some models, certain tokens exist in one but not the other,
477+
# so we take the max of the two to decide if a token id is truly
478+
# out-of-vocabulary.
473479
if max_input_id > max(tokenizer.max_token_id,
474480
self.model_config.get_vocab_size() - 1):
475481
raise ValueError(

0 commit comments

Comments
 (0)