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
2ff297dc
Unverified
Commit
2ff297dc
authored
May 13, 2025
by
Woosuk Kwon
Committed by
GitHub
May 13, 2025
Browse files
[BugFix] Set default random seed to 0 for V1 (#17929)
Signed-off-by:
Woosuk Kwon
<
woosuk.kwon@berkeley.edu
>
parent
8dd0671b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
vllm/config.py
vllm/config.py
+20
-1
No files found.
vllm/config.py
View file @
2ff297dc
...
...
@@ -261,7 +261,8 @@ class ModelConfig:
- "float" is shorthand for FP32 precision.
\n
- "float32" for FP32 precision."""
seed
:
Optional
[
int
]
=
None
"""Random seed for reproducibility."""
"""Random seed for reproducibility. Initialized to None in V0, but
initialized to 0 in V1."""
hf_config_path
:
Optional
[
str
]
=
None
"""Name or path of the Hugging Face config to use. If unspecified, model
name or path will be used."""
...
...
@@ -441,6 +442,24 @@ class ModelConfig:
return
hashlib
.
sha256
(
str
(
factors
).
encode
()).
hexdigest
()
def
__post_init__
(
self
)
->
None
:
# Set the default seed to 0 in V1.
# NOTE(woosuk): In V0, we set the default seed to None because the
# driver worker shares the same process as the user process, and thus
# setting a seed affects the user process as well.
# In V1, we use separate processes for workers (unless
# VLLM_ENABLE_V1_MULTIPROCESSING=0), so setting a seed here
# doesn't affect the user process. However, without a consistent seed,
# different tensor parallel workers would sample different tokens,
# leading to inconsistent results.
if
envs
.
VLLM_USE_V1
and
self
.
seed
is
None
:
self
.
seed
=
0
if
not
envs
.
VLLM_ENABLE_V1_MULTIPROCESSING
:
logger
.
warning
(
"The global random seed is set to %d. Since "
"VLLM_ENABLE_V1_MULTIPROCESSING is set to False, this may "
"affect the random state of the Python process that "
"launched vLLM."
,
self
.
seed
)
self
.
model
=
maybe_model_redirect
(
self
.
model
)
# The tokenizer is consistent with the model by default.
if
self
.
tokenizer
is
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