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
c47ba4aa
Unverified
Commit
c47ba4aa
authored
May 01, 2024
by
sasha0552
Committed by
GitHub
May 01, 2024
Browse files
[Bugfix] Add validation for seed (#4529)
parent
24bb4fe4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
tests/entrypoints/test_openai_server.py
tests/entrypoints/test_openai_server.py
+20
-0
vllm/entrypoints/openai/protocol.py
vllm/entrypoints/openai/protocol.py
+6
-2
No files found.
tests/entrypoints/test_openai_server.py
View file @
c47ba4aa
...
...
@@ -13,6 +13,7 @@ import pytest
# and debugging.
import
ray
import
requests
import
torch
# downloading lora to test lora requests
from
huggingface_hub
import
snapshot_download
from
openai
import
BadRequestError
...
...
@@ -870,5 +871,24 @@ async def test_echo_logprob_completion(server, client: openai.AsyncOpenAI,
assert
len
(
logprobs
.
tokens
)
>
5
async
def
test_long_seed
(
server
,
client
:
openai
.
AsyncOpenAI
):
for
seed
in
[
torch
.
iinfo
(
torch
.
long
).
min
-
1
,
torch
.
iinfo
(
torch
.
long
).
max
+
1
]:
with
pytest
.
raises
(
BadRequestError
)
as
exc_info
:
await
client
.
chat
.
completions
.
create
(
model
=
MODEL_NAME
,
messages
=
[{
"role"
:
"system"
,
"content"
:
"You are a helpful assistant."
,
}],
temperature
=
0
,
seed
=
seed
)
assert
(
"greater_than_equal"
in
exc_info
.
value
.
message
or
"less_than_equal"
in
exc_info
.
value
.
message
)
if
__name__
==
"__main__"
:
pytest
.
main
([
__file__
])
vllm/entrypoints/openai/protocol.py
View file @
c47ba4aa
...
...
@@ -79,7 +79,9 @@ class ChatCompletionRequest(OpenAIBaseModel):
n
:
Optional
[
int
]
=
1
presence_penalty
:
Optional
[
float
]
=
0.0
response_format
:
Optional
[
ResponseFormat
]
=
None
seed
:
Optional
[
int
]
=
None
seed
:
Optional
[
int
]
=
Field
(
None
,
ge
=
torch
.
iinfo
(
torch
.
long
).
min
,
le
=
torch
.
iinfo
(
torch
.
long
).
max
)
stop
:
Optional
[
Union
[
str
,
List
[
str
]]]
=
Field
(
default_factory
=
list
)
stream
:
Optional
[
bool
]
=
False
temperature
:
Optional
[
float
]
=
0.7
...
...
@@ -228,7 +230,9 @@ class CompletionRequest(OpenAIBaseModel):
max_tokens
:
Optional
[
int
]
=
16
n
:
int
=
1
presence_penalty
:
Optional
[
float
]
=
0.0
seed
:
Optional
[
int
]
=
None
seed
:
Optional
[
int
]
=
Field
(
None
,
ge
=
torch
.
iinfo
(
torch
.
long
).
min
,
le
=
torch
.
iinfo
(
torch
.
long
).
max
)
stop
:
Optional
[
Union
[
str
,
List
[
str
]]]
=
Field
(
default_factory
=
list
)
stream
:
Optional
[
bool
]
=
False
suffix
:
Optional
[
str
]
=
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