Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0998ea0

Browse files
committed
fix: grammar prints on each call. Closes abetlen#1666
1 parent bfb42b7 commit 0998ea0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llama_cpp/llama_grammar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,8 @@ def reset(self):
890890
@classmethod
891891
def from_string(cls, grammar: str, verbose: bool = True) -> "LlamaGrammar":
892892
parsed_grammar = parse(grammar)
893-
print_grammar(file=sys.stdout, state=parsed_grammar)
893+
if verbose:
894+
print_grammar(file=sys.stdout, state=parsed_grammar)
894895
return cls(parsed_grammar)
895896

896897
@classmethod

0 commit comments

Comments
 (0)