diff --git a/python/sglang/test/server_fixtures/standalone_fixture.py b/python/sglang/test/server_fixtures/standalone_fixture.py index fc0e6f2f0..c571ebe7e 100644 --- a/python/sglang/test/server_fixtures/standalone_fixture.py +++ b/python/sglang/test/server_fixtures/standalone_fixture.py @@ -2,7 +2,8 @@ Variants combine this base with `CustomTestCase` and override class attributes (`attention_backend`, plus optional `speculative_eagle_topk` / -`speculative_num_draft_tokens` / `enable_spec_v2`) to select a backend +`speculative_num_draft_tokens` / `enable_spec_v2` / +`enable_deterministic_inference`) to select a backend, deterministic mode, and the V1 / V2 spec engine. Pure mixin (does NOT inherit `TestCase`), so unittest does not collect @@ -41,11 +42,12 @@ class StandaloneServerBase: speculative_eagle_topk: int = 1 speculative_num_draft_tokens: int = 5 enable_spec_v2: bool = True + enable_deterministic_inference: bool = False @classmethod def get_server_args(cls): assert cls.attention_backend, f"{cls.__name__} must set `attention_backend`" - return [ + args = [ "--trust-remote-code", "--cuda-graph-max-bs", "8", @@ -64,6 +66,9 @@ class StandaloneServerBase: "--attention-backend", cls.attention_backend, ] + if cls.enable_deterministic_inference: + args.append("--enable-deterministic-inference") + return args @classmethod def setUpClass(cls): diff --git a/test/registered/spec/test_spec_standalone_extra.py b/test/registered/spec/test_spec_standalone_extra.py index 82272f741..5903f4a55 100644 --- a/test/registered/spec/test_spec_standalone_extra.py +++ b/test/registered/spec/test_spec_standalone_extra.py @@ -21,6 +21,7 @@ class TestStandaloneSpeculativeDecodingTriton(StandaloneServerBase, CustomTestCa speculative_eagle_topk = 2 speculative_num_draft_tokens = 7 enable_spec_v2 = False + enable_deterministic_inference = True class TestStandaloneSpeculativeDecodingFlashinfer(StandaloneServerBase, CustomTestCase):