Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
beac8dd4
Unverified
Commit
beac8dd4
authored
Oct 29, 2023
by
Ricardo Lu
Committed by
GitHub
Oct 29, 2023
Browse files
fix: don't skip first special token. (#1497)
parent
28b47d1e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
vllm/transformers_utils/tokenizer.py
vllm/transformers_utils/tokenizer.py
+5
-1
No files found.
vllm/transformers_utils/tokenizer.py
View file @
beac8dd4
...
@@ -120,6 +120,10 @@ def detokenize_incrementally(
...
@@ -120,6 +120,10 @@ def detokenize_incrementally(
# tokenizers (bigger = more conservative).
# tokenizers (bigger = more conservative).
# Subtract 1 extra to account for the generated token.
# Subtract 1 extra to account for the generated token.
prefix_offset
=
max
(
len
(
output_tokens
)
-
6
,
0
)
prefix_offset
=
max
(
len
(
output_tokens
)
-
6
,
0
)
# If the first new token is a special token, we can't skip 1 extra token
if
skip_special_tokens
and
new_token_id
in
tokenizer
.
all_special_ids
:
read_offset
=
max
(
len
(
output_tokens
),
0
)
else
:
read_offset
=
max
(
len
(
output_tokens
)
-
1
,
0
)
read_offset
=
max
(
len
(
output_tokens
)
-
1
,
0
)
else
:
else
:
# Put new_token_id in a list so skip_special_tokens is respected
# Put new_token_id in a list so skip_special_tokens is respected
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment