Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
fc966e9c
Unverified
Commit
fc966e9c
authored
Apr 25, 2025
by
Lu Fang
Committed by
GitHub
Apr 25, 2025
Browse files
Only turn on FastIncrementalDetokenizer when tokenizers >= 0.21.1 (#17158)
parent
ef19e67d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
vllm/v1/engine/detokenizer.py
vllm/v1/engine/detokenizer.py
+5
-1
No files found.
vllm/v1/engine/detokenizer.py
View file @
fc966e9c
...
...
@@ -2,6 +2,8 @@
from
abc
import
ABC
,
abstractmethod
from
typing
import
Optional
import
tokenizers
from
packaging
import
version
from
tokenizers
import
Tokenizer
from
tokenizers.decoders
import
DecodeStream
from
transformers
import
PreTrainedTokenizerFast
...
...
@@ -43,8 +45,10 @@ class IncrementalDetokenizer:
# No tokenizer => skipping detokenization.
return
IncrementalDetokenizer
()
if
isinstance
(
tokenizer
,
PreTrainedTokenizerFast
):
if
(
isinstance
(
tokenizer
,
PreTrainedTokenizerFast
)
and
version
.
parse
(
tokenizers
.
__version__
)
>=
version
.
parse
(
"0.21.1"
)):
# Fast tokenizer => use tokenizers library DecodeStream.
# And only tokenizers >= 0.21.1 supports Fast Detokenizer.
return
FastIncrementalDetokenizer
(
tokenizer
,
request
)
# Fall back to slow python-based incremental detokenization.
...
...
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