config: delete the dead get_server_args() bindings across the repo (#33888)

This commit is contained in:
Cheng Wan
2026-08-07 22:41:53 -07:00
committed by GitHub
parent a5af27f49e
commit eda0ddc260
14 changed files with 13 additions and 54 deletions
@@ -503,11 +503,8 @@ class TestFromScheduleBatch(CustomTestCase):
req.tokenizer.eos_token_id = eos_id
return req
@patch("sglang.srt.sampling.sampling_batch_info.get_server_args")
def test_basic_construction(self, mock_server_args):
def test_basic_construction(self):
"""Test that from_schedule_batch correctly extracts sampling params from requests."""
mock_server_args.return_value.enable_deterministic_inference = False
mock_server_args.return_value.enable_custom_logit_processor = False
reqs = [self._make_req(temp=0.8, top_p=0.9, top_k=50, min_p=0.1)]
batch = MagicMock()
@@ -520,11 +517,8 @@ class TestFromScheduleBatch(CustomTestCase):
self.assertAlmostEqual(info.top_ps[0].item(), 0.9, places=5)
self.assertEqual(info.top_ks[0].item(), 50)
@patch("sglang.srt.sampling.sampling_batch_info.get_server_args")
def test_greedy_detection(self, mock_server_args):
def test_greedy_detection(self):
"""Test that top_k=1 sets is_all_greedy=True."""
mock_server_args.return_value.enable_deterministic_inference = False
mock_server_args.return_value.enable_custom_logit_processor = False
reqs = [self._make_req(top_k=1)]
batch = MagicMock()
@@ -533,11 +527,8 @@ class TestFromScheduleBatch(CustomTestCase):
info = SamplingBatchInfo.from_schedule_batch(batch, VOCAB_SIZE)
self.assertTrue(info.is_all_greedy)
@patch("sglang.srt.sampling.sampling_batch_info.get_server_args")
def test_logit_bias_construction(self, mock_server_args):
def test_logit_bias_construction(self):
"""Test that logit_bias dict is converted to a tensor with correct values."""
mock_server_args.return_value.enable_deterministic_inference = False
mock_server_args.return_value.enable_custom_logit_processor = False
reqs = [self._make_req(logit_bias={"5": 2.0, "10": -1.0})]
batch = MagicMock()
@@ -549,11 +540,8 @@ class TestFromScheduleBatch(CustomTestCase):
self.assertAlmostEqual(info.logit_bias[0, 10].item(), -1.0)
self.assertAlmostEqual(info.logit_bias[0, 0].item(), 0.0)
@patch("sglang.srt.sampling.sampling_batch_info.get_server_args")
def test_deterministic_seed(self, mock_server_args):
def test_deterministic_seed(self):
"""Test that explicit seed=123 is kept and missing seed defaults to 42."""
mock_server_args.return_value.enable_deterministic_inference = True
mock_server_args.return_value.enable_custom_logit_processor = False
self._exec_ns.deterministic.enable_deterministic_inference = True
reqs = [self._make_req(seed=123), self._make_req(seed=None)]
@@ -565,11 +553,8 @@ class TestFromScheduleBatch(CustomTestCase):
self.assertEqual(info.sampling_seed[0].item(), 123)
self.assertEqual(info.sampling_seed[1].item(), 42) # default
@patch("sglang.srt.sampling.sampling_batch_info.get_server_args")
def test_from_schedule_batch_sampling_flags(self, mock_server_args):
def test_from_schedule_batch_sampling_flags(self):
"""Test that sampling flags (need_top_p/top_k/min_p) are set correctly."""
mock_server_args.return_value.enable_deterministic_inference = False
mock_server_args.return_value.enable_custom_logit_processor = False
reqs = [self._make_req(top_p=0.9, top_k=50, min_p=0.1)]
batch = MagicMock()
@@ -581,11 +566,8 @@ class TestFromScheduleBatch(CustomTestCase):
self.assertTrue(info.need_min_p_sampling) # 0.1 > 0
self.assertFalse(info.is_all_greedy) # top_k=50 > 1
@patch("sglang.srt.sampling.sampling_batch_info.get_server_args")
def test_no_logit_bias_when_all_none(self, mock_server_args):
def test_no_logit_bias_when_all_none(self):
"""Test that logit_bias stays None when no request has logit_bias set."""
mock_server_args.return_value.enable_deterministic_inference = False
mock_server_args.return_value.enable_custom_logit_processor = False
reqs = [self._make_req(), self._make_req()]
batch = MagicMock()
@@ -594,15 +576,12 @@ class TestFromScheduleBatch(CustomTestCase):
info = SamplingBatchInfo.from_schedule_batch(batch, VOCAB_SIZE)
self.assertIsNone(info.logit_bias)
@patch("sglang.srt.sampling.sampling_batch_info.get_server_args")
def test_custom_logit_processor_merging(self, mock_server_args):
def test_custom_logit_processor_merging(self):
"""Test deserialization and merging of custom logit processors."""
from sglang.srt.sampling.custom_logit_processor import (
DisallowedTokensLogitsProcessor,
)
mock_server_args.return_value.enable_deterministic_inference = False
mock_server_args.return_value.enable_custom_logit_processor = True
self._exec_ns.features.enable_custom_logit_processor = True
proc_str = DisallowedTokensLogitsProcessor.to_str()