llama : minor llama_grammar refactoring#1
Merged
clarismiranda merged 1 commit intoclarismiranda:grammar-memofrom Oct 17, 2024
Merged
llama : minor llama_grammar refactoring#1clarismiranda merged 1 commit intoclarismiranda:grammar-memofrom
clarismiranda merged 1 commit intoclarismiranda:grammar-memofrom
Conversation
4 tasks
Owner
|
Looks great, thank you! |
HanClinto
reviewed
Oct 17, 2024
| new_stack.push_back(pos); | ||
| } | ||
| llama_grammar_advance_stack_memo(rules, new_stack, stacks_new, stacks_cache); | ||
| llama_grammar_advance_stack_memo(grammar->rules, new_stack, stacks_new, grammar->stacks_cache); |
There was a problem hiding this comment.
I really like the signature simplification that you made for llama_grammar_accept -- passing around the grammar structure alone (rather than all of the individual pieces of the structure) feels good.
Should we do that to llama_grammar_advance_stack / llama_grammar_advance_stack_memo as well?
I.E. something more like:
static void llama_grammar_advance_stack_memo(
struct llama_grammar * grammar,
const llama_grammar_stack & stack,
llama_grammar_stacks & new_stacks) {
?
Author
There was a problem hiding this comment.
We should give it a try. I think I briefly tried it again, but there was some issue. Will retake a look tomorrow and see if we can simplify further.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
target: ggml-org#9833