Skip to content
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

sampler: fixes trigger tokens + lazy grammars (fix typo cast from token to string) #12291

Merged
merged 2 commits into from
Mar 10, 2025

Conversation

ochafik
Copy link
Collaborator

@ochafik ochafik commented Mar 9, 2025

Fixes regression introduced in #12034 (which got trigger tokens to just be... ignored)

Likely fixes #12256

Note: this is hard to test against, short of exposing the triggered status of lazy grammars all the way to the server API (maybe limiting to verbose mode)

@ochafik ochafik changed the title Fix typo in lazy grammar handling (fixes trigger tokens) sampler: fix typo in lazy grammar handling (fixes trigger tokens) Mar 9, 2025
@ochafik ochafik marked this pull request as ready for review March 10, 2025 01:46
@ochafik ochafik requested a review from ngxson as a code owner March 10, 2025 01:46
@ochafik ochafik changed the title sampler: fix typo in lazy grammar handling (fixes trigger tokens) sampler: fixes trigger tokens + lazy grammars (fix typo cast from token to string) Mar 10, 2025
@@ -384,7 +384,8 @@ struct server_task {
SRV_DBG("Grammar trigger token: %d (`%s`)\n", token, word.c_str());
common_grammar_trigger trigger;
trigger.type = COMMON_GRAMMAR_TRIGGER_TYPE_TOKEN;
trigger.value = (llama_token) token;
trigger.value = word;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to assign to value here? I though that COMMON_GRAMMAR_TRIGGER_TYPE_TOKEN means to use just the token member.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s only (very useful) for debug in the verbose json output

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
@ochafik ochafik merged commit 2b3a25c into ggml-org:master Mar 10, 2025
46 checks passed
@ochafik ochafik deleted the fix-trig-tok branch March 10, 2025 09:45
bandoti added a commit to bandoti/llama.cpp that referenced this pull request Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants