From f3b6760213edaefc9564f2535309e07be4611f49 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Sat, 6 Sep 2025 16:59:36 -0700 Subject: [PATCH] [Auto Sync] Update server_args.py (20250906) (#10117) Co-authored-by: github-actions[bot] Co-authored-by: Hanming Lu <69857889+hanming-lu@users.noreply.github.com> --- python/sglang/srt/server_args.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index 0af2ad693..733c88da8 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -104,6 +104,8 @@ ATTENTION_BACKEND_CHOICES = [ DISAGG_TRANSFER_BACKEND_CHOICES = ["mooncake", "nixl", "ascend", "fake"] +GRAMMAR_BACKEND_CHOICES = ["xgrammar", "outlines", "llguidance", "none"] + # Allow external code to add more choices def add_load_format_choices(choices): @@ -122,6 +124,10 @@ def add_disagg_transfer_backend_choices(choices): DISAGG_TRANSFER_BACKEND_CHOICES.extend(choices) +def add_grammar_backend_choices(choices): + GRAMMAR_BACKEND_CHOICES.extend(choices) + + @dataclasses.dataclass class ServerArgs: # Model and tokenizer @@ -1475,7 +1481,7 @@ class ServerArgs: parser.add_argument( "--grammar-backend", type=str, - choices=["xgrammar", "outlines", "llguidance", "none"], + choices=GRAMMAR_BACKEND_CHOICES, default=ServerArgs.grammar_backend, help="Choose the backend for grammar-guided decoding.", )