From 960b47569907c34ea4e122aadad2df6005bc005e Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Mon, 3 Feb 2025 10:38:41 -0500 Subject: [PATCH] Update vllm/model_executor/guided_decoding/xgrammar_decoding.py Co-authored-by: Nick Hill --- vllm/model_executor/guided_decoding/xgrammar_decoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vllm/model_executor/guided_decoding/xgrammar_decoding.py b/vllm/model_executor/guided_decoding/xgrammar_decoding.py index bfd9c6a7c22be..ad4c229206dc0 100644 --- a/vllm/model_executor/guided_decoding/xgrammar_decoding.py +++ b/vllm/model_executor/guided_decoding/xgrammar_decoding.py @@ -254,7 +254,7 @@ def escape_ebnf_string(s: str) -> str: def choice_as_grammar(choice: List[str] | None) -> str: if choice is None: raise ValueError("Choice is not set") - escaped_choices = [GrammarConfig.escape_ebnf_string(c) for c in choice] + escaped_choices = (GrammarConfig.escape_ebnf_string(c) for c in choice) grammar = ('root ::= ' + ' | '.join(f'"{c}"' for c in escaped_choices)) return grammar