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
d3c8180a
Unverified
Commit
d3c8180a
authored
Apr 23, 2024
by
Jack Gordley
Committed by
GitHub
Apr 23, 2024
Browse files
[Bugfix] Fixing max token error message for openai compatible server (#4016)
parent
62b8aebc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
vllm/entrypoints/openai/serving_engine.py
vllm/entrypoints/openai/serving_engine.py
+6
-0
No files found.
vllm/entrypoints/openai/serving_engine.py
View file @
d3c8180a
...
...
@@ -206,6 +206,12 @@ class OpenAIServing:
token_num
=
len
(
input_ids
)
if
request
.
max_tokens
is
None
:
if
token_num
>=
self
.
max_model_len
:
raise
ValueError
(
f
"This model's maximum context length is "
f
"
{
self
.
max_model_len
}
tokens. However, you requested "
f
"
{
token_num
}
tokens in the messages, "
f
"Please reduce the length of the messages."
,
)
request
.
max_tokens
=
self
.
max_model_len
-
token_num
if
token_num
+
request
.
max_tokens
>
self
.
max_model_len
:
...
...
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