Skip to content

Commit

Permalink
Update vllm/model_executor/guided_decoding/xgrammar_decoding.py
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Hill <nhill@redhat.com>
  • Loading branch information
russellb and njhill authored Feb 3, 2025
1 parent 4b694af commit 960b475
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vllm/model_executor/guided_decoding/xgrammar_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 960b475

Please sign in to comment.