Skip to content

[CI/Build] Use a fixed seed to avoid flaky tests #14480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions tests/entrypoints/openai/test_chat_echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ def server():
"4080",
"--chat-template",
DUMMY_CHAT_TEMPLATE,
"--seed",
"0",
]

with RemoteOpenAIServer(MODEL_NAME, args) as remote_server:
Expand Down
2 changes: 0 additions & 2 deletions tests/entrypoints/openai/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ def default_server_args():
"--enforce-eager",
"--max-num-seqs",
"128",
"--seed",
"0",
]


Expand Down
2 changes: 0 additions & 2 deletions tests/entrypoints/openai/test_root_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ def server():
"/" + ROOT_PATH,
"--chat-template",
DUMMY_CHAT_TEMPLATE,
"--seed",
"0",
]
envs = os.environ.copy()

Expand Down
7 changes: 7 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self,
vllm_serve_args: list[str],
*,
env_dict: Optional[dict[str, str]] = None,
seed: Optional[int] = 0,
auto_port: bool = True,
max_wait_seconds: Optional[float] = None) -> None:
if auto_port:
Expand All @@ -87,6 +88,12 @@ def __init__(self,
vllm_serve_args = vllm_serve_args + [
"--port", str(get_open_port())
]
if seed is not None:
if "--seed" in vllm_serve_args:
raise ValueError("You have manually specified the seed "
f"when `seed={seed}`.")

vllm_serve_args = vllm_serve_args + ["--seed", str(seed)]

parser = FlexibleArgumentParser(
description="vLLM's remote OpenAI server.")
Expand Down