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
eb8fcd26
Unverified
Commit
eb8fcd26
authored
Jun 06, 2024
by
DriverSong
Committed by
GitHub
Jun 05, 2024
Browse files
[BugFix] Apply get_cached_tokenizer to the tokenizer setter of LLM (#5207)
Co-authored-by:
qiujiawei9
<
qiujiawei9@jd.com
>
parent
5563a4de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
vllm/entrypoints/llm.py
vllm/entrypoints/llm.py
+9
-1
No files found.
vllm/entrypoints/llm.py
View file @
eb8fcd26
...
@@ -14,6 +14,7 @@ from vllm.lora.request import LoRARequest
...
@@ -14,6 +14,7 @@ from vllm.lora.request import LoRARequest
from
vllm.outputs
import
EmbeddingRequestOutput
,
RequestOutput
from
vllm.outputs
import
EmbeddingRequestOutput
,
RequestOutput
from
vllm.pooling_params
import
PoolingParams
from
vllm.pooling_params
import
PoolingParams
from
vllm.sampling_params
import
SamplingParams
from
vllm.sampling_params
import
SamplingParams
from
vllm.transformers_utils.tokenizer
import
get_cached_tokenizer
from
vllm.usage.usage_lib
import
UsageContext
from
vllm.usage.usage_lib
import
UsageContext
from
vllm.utils
import
Counter
,
deprecate_kwargs
from
vllm.utils
import
Counter
,
deprecate_kwargs
...
@@ -152,7 +153,14 @@ class LLM:
...
@@ -152,7 +153,14 @@ class LLM:
self
,
self
,
tokenizer
:
Union
[
PreTrainedTokenizer
,
PreTrainedTokenizerFast
],
tokenizer
:
Union
[
PreTrainedTokenizer
,
PreTrainedTokenizerFast
],
)
->
None
:
)
->
None
:
# While CachedTokenizer is dynamic, have no choice but
# compare class name. Misjudgment will arise from
# user-defined tokenizer started with 'Cached'
if
tokenizer
.
__class__
.
__name__
.
startswith
(
"Cached"
):
self
.
llm_engine
.
tokenizer
.
tokenizer
=
tokenizer
self
.
llm_engine
.
tokenizer
.
tokenizer
=
tokenizer
else
:
self
.
llm_engine
.
tokenizer
.
tokenizer
=
get_cached_tokenizer
(
tokenizer
)
@
overload
# LEGACY: single (prompt + optional token ids)
@
overload
# LEGACY: single (prompt + optional token ids)
def
generate
(
def
generate
(
...
...
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