[Perf] Fork-safe import: no CUDA context at import time, lighter argument parsing (#40201)

This commit is contained in:
Xueshen Liu
2026-09-21 10:48:35 +08:00
committed by GitHub
parent 176dbcb85d
commit ab03a8e7eb
11 changed files with 381 additions and 12 deletions
@@ -20,6 +20,7 @@ from sglang.srt.parser.reasoning_parser import (
Qwen3Detector,
ReasoningParser,
)
from sglang.srt.parser.reasoning_parser_names import REASONING_PARSER_NAMES
from sglang.test.ci.ci_register import register_cpu_ci
from sglang.test.test_utils import CustomTestCase
@@ -1726,5 +1727,14 @@ class TestGraniteThinkingDetector(CustomTestCase):
self.assertEqual(normal, "truncated")
class TestReasoningParserNames(CustomTestCase):
def test_matches_registry(self):
# `server_args` builds the --reasoning-parser choices from this list to
# keep the registry, and its dependencies, out of argument parsing.
self.assertEqual(
sorted(REASONING_PARSER_NAMES), sorted(ReasoningParser.DetectorMap)
)
if __name__ == "__main__":
unittest.main()