Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vllm/v1/engine/detokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(self, tokenizer: PreTrainedTokenizerFast,
prompt_suffix = request.prompt_token_ids
prompt_len = len(prompt_suffix)
if prompt_len > 4:
for i in range(4, max(prompt_len + 1, 32)):
for i in range(4, min(prompt_len + 1, 24)):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does 24 come from? Can we use smaller numbers like 5?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to try to find a small suffix to start from, or else it has to loop over the entire prompt below decoding the tokens one-by-one, which could be very long.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, does it mean we can't use smaller numbers?

suffix = request.prompt_token_ids[-i:]
if '�' not in self.tokenizer.decode(suffix):
prompt_suffix = suffix
Expand Down