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
7c3604fb
Unverified
Commit
7c3604fb
authored
May 30, 2024
by
Itay Etelis
Committed by
GitHub
May 29, 2024
Browse files
[Bugfix] logprobs is not compatible with the OpenAI spec #4795 (#5031)
parent
b1c25563
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
vllm/entrypoints/openai/protocol.py
vllm/entrypoints/openai/protocol.py
+2
-3
vllm/entrypoints/openai/serving_chat.py
vllm/entrypoints/openai/serving_chat.py
+2
-2
No files found.
vllm/entrypoints/openai/protocol.py
View file @
7c3604fb
...
@@ -109,7 +109,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
...
@@ -109,7 +109,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
frequency_penalty
:
Optional
[
float
]
=
0.0
frequency_penalty
:
Optional
[
float
]
=
0.0
logit_bias
:
Optional
[
Dict
[
str
,
float
]]
=
None
logit_bias
:
Optional
[
Dict
[
str
,
float
]]
=
None
logprobs
:
Optional
[
bool
]
=
False
logprobs
:
Optional
[
bool
]
=
False
top_logprobs
:
Optional
[
int
]
=
None
top_logprobs
:
Optional
[
int
]
=
0
max_tokens
:
Optional
[
int
]
=
None
max_tokens
:
Optional
[
int
]
=
None
n
:
Optional
[
int
]
=
1
n
:
Optional
[
int
]
=
1
presence_penalty
:
Optional
[
float
]
=
0.0
presence_penalty
:
Optional
[
float
]
=
0.0
...
@@ -192,8 +192,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
...
@@ -192,8 +192,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
# doc: end-chat-completion-extra-params
# doc: end-chat-completion-extra-params
def
to_sampling_params
(
self
)
->
SamplingParams
:
def
to_sampling_params
(
self
)
->
SamplingParams
:
if
self
.
logprobs
and
not
self
.
top_logprobs
:
# We now allow logprobs being true without top_logrobs.
raise
ValueError
(
"Top logprobs must be set when logprobs is."
)
logits_processors
=
None
logits_processors
=
None
if
self
.
logit_bias
:
if
self
.
logit_bias
:
...
...
vllm/entrypoints/openai/serving_chat.py
View file @
7c3604fb
...
@@ -286,7 +286,7 @@ class OpenAIServingChat(OpenAIServing):
...
@@ -286,7 +286,7 @@ class OpenAIServingChat(OpenAIServing):
logprobs
=
self
.
_create_logprobs
(
logprobs
=
self
.
_create_logprobs
(
token_ids
=
delta_token_ids
,
token_ids
=
delta_token_ids
,
top_logprobs
=
top_logprobs
,
top_logprobs
=
top_logprobs
,
num_output_top_logprobs
=
request
.
logprobs
,
num_output_top_logprobs
=
request
.
top_
logprobs
,
initial_text_offset
=
len
(
previous_texts
[
i
]),
initial_text_offset
=
len
(
previous_texts
[
i
]),
)
)
else
:
else
:
...
@@ -373,7 +373,7 @@ class OpenAIServingChat(OpenAIServing):
...
@@ -373,7 +373,7 @@ class OpenAIServingChat(OpenAIServing):
logprobs
=
self
.
_create_logprobs
(
logprobs
=
self
.
_create_logprobs
(
token_ids
=
token_ids
,
token_ids
=
token_ids
,
top_logprobs
=
top_logprobs
,
top_logprobs
=
top_logprobs
,
num_output_top_logprobs
=
request
.
logprobs
,
num_output_top_logprobs
=
request
.
top_
logprobs
,
)
)
else
:
else
:
logprobs
=
None
logprobs
=
None
...
...
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