-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grammars: early exit when no next_candidates to reject #7370
Closed
Conversation
This file contains 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
mofosyne
added
Review Complexity : Low
Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix
performance
Speed related topics
labels
May 20, 2024
ochafik
added a commit
to ochafik/llama.cpp
that referenced
this pull request
May 20, 2024
Superseded by #7424 |
ochafik
added a commit
to ochafik/llama.cpp
that referenced
this pull request
May 21, 2024
grammars: cache decoded tokens grammars: faster llama_grammar_copy grammars: fix bad merge grammars: keep llama_grammar_copy non-quadratic optim for later grammars: move token caches to llama_context grammars: cache codepoints in llama_new_context_with_model grammar: nit (layout) grammars: nits (revert const grammar sig, fix comment) Update llama.cpp Co-authored-by: Clint Herron <[email protected]> grammars: mutex-guarded lazy caching of token pieces in llama_sample_grammar grammars: remove early exit --> ggerganov#7370
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
performance
Speed related topics
Review Complexity : Low
Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix
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.
Edit: superseded by #7424 (see benchmarks comparing different fix combinations)
This speeds up grammar sampling only in some cases (#4218).
(extracted from #6811 which other change needs a bit more work)
For instance the example taken from @AlienKevin (see #4218 (comment); download issue4218.gbnf and issue4218.txt) runs 1.4x faster (total time; sampling itself went from 28.5 ms per token to 11.7 ms per token, a 2.4x sampling speedup)
Show output
master
:this PR:
cc/ @HanClinto