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
81fbb365
Unverified
Commit
81fbb365
authored
Jun 15, 2024
by
Cyrus Leung
Committed by
GitHub
Jun 15, 2024
Browse files
[CI/Build] Test both text and token IDs in batched OpenAI Completions API (#5568)
parent
0e9164b4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
43 deletions
+45
-43
tests/entrypoints/test_openai_server.py
tests/entrypoints/test_openai_server.py
+45
-43
No files found.
tests/entrypoints/test_openai_server.py
View file @
81fbb365
...
@@ -655,10 +655,12 @@ async def test_completion_stream_options(client: openai.AsyncOpenAI,
...
@@ -655,10 +655,12 @@ async def test_completion_stream_options(client: openai.AsyncOpenAI,
[
MODEL_NAME
,
"zephyr-lora"
],
[
MODEL_NAME
,
"zephyr-lora"
],
)
)
async
def
test_batch_completions
(
client
:
openai
.
AsyncOpenAI
,
model_name
:
str
):
async
def
test_batch_completions
(
client
:
openai
.
AsyncOpenAI
,
model_name
:
str
):
# test both text and token IDs
for
prompts
in
([
"Hello, my name is"
]
*
2
,
[[
0
,
0
,
0
,
0
,
0
]]
*
2
):
# test simple list
# test simple list
batch
=
await
client
.
completions
.
create
(
batch
=
await
client
.
completions
.
create
(
model
=
model_name
,
model
=
model_name
,
prompt
=
[
"Hello, my name is"
,
"Hello, my name is"
]
,
prompt
=
prompts
,
max_tokens
=
5
,
max_tokens
=
5
,
temperature
=
0.0
,
temperature
=
0.0
,
)
)
...
@@ -668,7 +670,7 @@ async def test_batch_completions(client: openai.AsyncOpenAI, model_name: str):
...
@@ -668,7 +670,7 @@ async def test_batch_completions(client: openai.AsyncOpenAI, model_name: str):
# test n = 2
# test n = 2
batch
=
await
client
.
completions
.
create
(
batch
=
await
client
.
completions
.
create
(
model
=
model_name
,
model
=
model_name
,
prompt
=
[
"Hello, my name is"
,
"Hello, my name is"
]
,
prompt
=
prompts
,
n
=
2
,
n
=
2
,
max_tokens
=
5
,
max_tokens
=
5
,
temperature
=
0.0
,
temperature
=
0.0
,
...
@@ -688,7 +690,7 @@ async def test_batch_completions(client: openai.AsyncOpenAI, model_name: str):
...
@@ -688,7 +690,7 @@ async def test_batch_completions(client: openai.AsyncOpenAI, model_name: str):
# test streaming
# test streaming
batch
=
await
client
.
completions
.
create
(
batch
=
await
client
.
completions
.
create
(
model
=
model_name
,
model
=
model_name
,
prompt
=
[
"Hello, my name is"
,
"Hello, my name is"
]
,
prompt
=
prompts
,
max_tokens
=
5
,
max_tokens
=
5
,
temperature
=
0.0
,
temperature
=
0.0
,
stream
=
True
,
stream
=
True
,
...
...
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