Skip to content

Commit

Permalink
feat: Ported back new grammar changes from C++ to Python implementati…
Browse files Browse the repository at this point in the history
…on (#1637)

* Backported . (any chat) from llama.cpp

* unfinished {count,optionalmax)

* implemented slice function in std:vector

* fixed mistake done while reading

* ported ggerganov/llama.cpp#7194

* multiple fixes, var copy

* Rewrite LlamaGrammar internals in python style

* bugfix

---------

Co-authored-by: Andrei <[email protected]>
  • Loading branch information
ExtReMLapin and abetlen authored Aug 7, 2024
1 parent 5575fed commit dff186c
Show file tree
Hide file tree
Showing 2 changed files with 682 additions and 972 deletions.
2 changes: 1 addition & 1 deletion llama_cpp/llama_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3002,7 +3002,7 @@ def llama_grammar_init(
n_rules: Union[ctypes.c_size_t, int],
start_rule_index: Union[ctypes.c_size_t, int],
/,
) -> llama_grammar_p:
) -> Optional[llama_grammar_p]:
"""Initialize a grammar from a set of rules."""
...

Expand Down
Loading

0 comments on commit dff186c

Please sign in to comment.