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
b668055a
Unverified
Commit
b668055a
authored
Aug 28, 2025
by
Woosuk Kwon
Committed by
GitHub
Aug 28, 2025
Browse files
[V0 Deprecation] Remove V0 Samplers test (#23862)
parent
d3d2aad5
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
855 deletions
+0
-855
tests/samplers/test_sampler.py
tests/samplers/test_sampler.py
+0
-769
tests/samplers/test_seeded_generate.py
tests/samplers/test_seeded_generate.py
+0
-86
No files found.
tests/samplers/test_sampler.py
deleted
100644 → 0
View file @
d3d2aad5
This diff is collapsed.
Click to expand it.
tests/samplers/test_seeded_generate.py
deleted
100644 → 0
View file @
d3d2aad5
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Verify that seeded random sampling is deterministic.
Run `pytest tests/samplers/test_seeded_generate.py`.
"""
import
copy
import
random
from
itertools
import
combinations
import
pytest
from
vllm
import
SamplingParams
from
vllm.model_executor.utils
import
set_random_seed
MODEL
=
"facebook/opt-125m"
RANDOM_SEEDS
=
list
(
range
(
5
))
@
pytest
.
fixture
def
vllm_model
(
vllm_runner
,
monkeypatch
):
# This file relies on V0 internals.
monkeypatch
.
setenv
(
"VLLM_USE_V1"
,
"0"
)
with
vllm_runner
(
MODEL
,
dtype
=
"half"
)
as
vllm_model
:
yield
vllm_model
@
pytest
.
mark
.
parametrize
(
"seed"
,
RANDOM_SEEDS
)
def
test_random_sample_with_seed
(
vllm_model
,
example_prompts
,
seed
:
int
,
)
->
None
:
set_random_seed
(
seed
)
sampling_params
=
SamplingParams
(
# Parameters to ensure sufficient randomness
temperature
=
3.0
,
top_p
=
min
(
random
.
random
()
+
0.3
,
1
),
top_k
=
random
.
randint
(
5
,
20
),
n
=
random
.
randint
(
1
,
10
),
presence_penalty
=
random
.
randint
(
0
,
1
),
max_tokens
=
8
,
ignore_eos
=
True
,
)
sampling_params_seed_1
=
copy
.
deepcopy
(
sampling_params
)
sampling_params_seed_1
.
seed
=
100
sampling_params_seed_2
=
copy
.
deepcopy
(
sampling_params
)
sampling_params_seed_2
.
seed
=
200
llm
=
vllm_model
.
llm
for
prompt
in
example_prompts
:
for
params
in
(
sampling_params
,
sampling_params_seed_1
,
sampling_params_seed_2
,
sampling_params
,
sampling_params_seed_1
,
sampling_params_seed_2
,
):
llm
.
_add_request
(
prompt
,
params
=
params
)
results
=
llm
.
_run_engine
(
use_tqdm
=
False
)
all_outputs
=
[[
out
.
token_ids
for
out
in
output
.
outputs
]
for
output
in
results
]
for
i
in
range
(
0
,
len
(
example_prompts
),
6
):
outputs
=
all_outputs
[
i
:
i
+
6
]
# verify all non-seeded requests differ
for
output_a
,
output_b
in
combinations
(
(
outputs
[
0
],
outputs
[
1
],
outputs
[
2
],
outputs
[
3
]),
2
,
):
assert
output_a
!=
output_b
# verify requests with the same seed match
assert
outputs
[
1
]
==
outputs
[
4
]
assert
outputs
[
2
]
==
outputs
[
5
]
# verify generations within the same parallel sampling group differ
for
output
in
outputs
:
for
sub_output_a
,
sub_output_b
in
combinations
(
output
,
2
):
assert
sub_output_a
!=
sub_output_b
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