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
044793d8
Unverified
Commit
044793d8
authored
Jun 01, 2024
by
Robert Shaw
Committed by
GitHub
Jun 01, 2024
Browse files
[BugFix] Prevent `LLM.encode` for non-generation Models (#5184)
Co-authored-by:
mgoin
<
michael@neuralmagic.com
>
parent
c2d6d2f9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
vllm/entrypoints/llm.py
vllm/entrypoints/llm.py
+10
-0
No files found.
vllm/entrypoints/llm.py
View file @
044793d8
...
@@ -276,6 +276,11 @@ class LLM:
...
@@ -276,6 +276,11 @@ class LLM:
considered legacy and may be deprecated in the future. You should
considered legacy and may be deprecated in the future. You should
instead pass them via the ``inputs`` parameter.
instead pass them via the ``inputs`` parameter.
"""
"""
if
self
.
llm_engine
.
model_config
.
embedding_mode
:
raise
ValueError
(
"LLM.generate() is only supported for generation models "
"(XForCausalLM)."
)
if
prompt_token_ids
is
not
None
or
multi_modal_data
is
not
None
:
if
prompt_token_ids
is
not
None
or
multi_modal_data
is
not
None
:
inputs
=
self
.
_convert_v1_inputs
(
inputs
=
self
.
_convert_v1_inputs
(
prompts
=
cast
(
Optional
[
Union
[
str
,
List
[
str
]]],
prompts
),
prompts
=
cast
(
Optional
[
Union
[
str
,
List
[
str
]]],
prompts
),
...
@@ -420,6 +425,11 @@ class LLM:
...
@@ -420,6 +425,11 @@ class LLM:
considered legacy and may be deprecated in the future. You should
considered legacy and may be deprecated in the future. You should
instead pass them via the ``inputs`` parameter.
instead pass them via the ``inputs`` parameter.
"""
"""
if
not
self
.
llm_engine
.
model_config
.
embedding_mode
:
raise
ValueError
(
"LLM.encode() is only supported for embedding models (XModel)."
)
if
prompt_token_ids
is
not
None
or
multi_modal_data
is
not
None
:
if
prompt_token_ids
is
not
None
or
multi_modal_data
is
not
None
:
inputs
=
self
.
_convert_v1_inputs
(
inputs
=
self
.
_convert_v1_inputs
(
prompts
=
cast
(
Optional
[
Union
[
str
,
List
[
str
]]],
prompts
),
prompts
=
cast
(
Optional
[
Union
[
str
,
List
[
str
]]],
prompts
),
...
...
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