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
110f59a3
Unverified
Commit
110f59a3
authored
Feb 11, 2025
by
மனோஜ்குமார் பழனிச்சாமி
Committed by
GitHub
Feb 11, 2025
Browse files
[Bugfix] fix flaky test (#13089)
Signed-off-by:
மனோஜ்குமார் பழனிச்சாமி
<
smartmanoj42857@gmail.com
>
parent
2e3b969e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
21 deletions
+6
-21
tests/test_seed_behavior.py
tests/test_seed_behavior.py
+6
-21
No files found.
tests/test_seed_behavior.py
View file @
110f59a3
...
...
@@ -8,32 +8,17 @@ from vllm.platforms.interface import Platform
def
test_seed_behavior
():
# Test with
seed=None
Platform
.
seed_everything
(
None
)
# Test with
a specific seed
Platform
.
seed_everything
(
42
)
random_value_1
=
random
.
randint
(
0
,
100
)
np_random_value_1
=
np
.
random
.
randint
(
0
,
100
)
torch_random_value_1
=
torch
.
randint
(
0
,
100
,
(
1
,
)).
item
()
Platform
.
seed_everything
(
None
)
Platform
.
seed_everything
(
42
)
random_value_2
=
random
.
randint
(
0
,
100
)
np_random_value_2
=
np
.
random
.
randint
(
0
,
100
)
torch_random_value_2
=
torch
.
randint
(
0
,
100
,
(
1
,
)).
item
()
assert
random_value_1
!=
random_value_2
assert
np_random_value_1
!=
np_random_value_2
assert
torch_random_value_1
!=
torch_random_value_2
# Test with a specific seed
Platform
.
seed_everything
(
42
)
random_value_3
=
random
.
randint
(
0
,
100
)
np_random_value_3
=
np
.
random
.
randint
(
0
,
100
)
torch_random_value_3
=
torch
.
randint
(
0
,
100
,
(
1
,
)).
item
()
Platform
.
seed_everything
(
42
)
random_value_4
=
random
.
randint
(
0
,
100
)
np_random_value_4
=
np
.
random
.
randint
(
0
,
100
)
torch_random_value_4
=
torch
.
randint
(
0
,
100
,
(
1
,
)).
item
()
assert
random_value_3
==
random_value_4
assert
np_random_value_3
==
np_random_value_4
assert
torch_random_value_3
==
torch_random_value_4
assert
random_value_1
==
random_value_2
assert
np_random_value_1
==
np_random_value_2
assert
torch_random_value_1
==
torch_random_value_2
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