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
ed59a7ed
"vscode:/vscode.git/clone" did not exist on "60bcef000ebcfaf120edc1972a8136344d9bfa0d"
Unverified
Commit
ed59a7ed
authored
Jun 01, 2024
by
Simon Mo
Committed by
GitHub
Jun 02, 2024
Browse files
Update test_ignore_eos (#4898)
parent
044793d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
tests/samplers/test_ignore_eos.py
tests/samplers/test_ignore_eos.py
+11
-10
No files found.
tests/samplers/test_ignore_eos.py
View file @
ed59a7ed
...
...
@@ -7,25 +7,26 @@ import pytest
from
vllm
import
SamplingParams
MODELS
=
[
"facebook/opt-125m"
]
# We also test with llama because it has generation_config to specify EOS
# (past regression).
MODELS
=
[
"facebook/opt-125m"
,
"meta-llama/Llama-2-7b-hf"
]
@
pytest
.
mark
.
parametrize
(
"model"
,
MODELS
)
@
pytest
.
mark
.
parametrize
(
"dtype"
,
[
"half"
])
@
pytest
.
mark
.
parametrize
(
"max_tokens"
,
[
1024
])
def
test_
beam_search_single_input
(
@
pytest
.
mark
.
parametrize
(
"max_tokens"
,
[
512
])
def
test_
ignore_eos
(
vllm_runner
,
example_prompts
,
model
:
str
,
dtype
:
str
,
max_tokens
:
int
,
)
->
None
:
example_prompts
=
"1 + 1 is"
vllm_model
=
vllm_runner
(
model
,
dtype
=
dtype
)
sampling_params
=
SamplingParams
(
max_tokens
=
max_tokens
,
ignore_eos
=
True
)
ignore_eos_output
=
vllm_model
.
model
.
generate
(
example_prompts
,
sampling_params
=
sampling_params
)
print
(
len
(
ignore_eos_output
[
0
].
outputs
[
0
].
token_ids
))
assert
max_tokens
-
len
(
ignore_eos_output
[
0
].
outputs
[
0
].
token_ids
)
<
10
assert
max_tokens
-
len
(
ignore_eos_output
[
0
].
outputs
[
0
].
token_ids
)
>=
0
for
prompt
in
example_prompts
:
ignore_eos_output
=
vllm_model
.
model
.
generate
(
prompt
,
sampling_params
=
sampling_params
)
output_length
=
len
(
ignore_eos_output
[
0
].
outputs
[
0
].
token_ids
)
assert
output_length
==
max_tokens
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