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

Fix: GBNF missing "root" node crashing server #6004

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

HanClinto
Copy link
Collaborator

Resolves #3878 by ensuring the existence of a "root" symbol before returning a valid grammar.

NOTE: There are two possible locations to put this fix -- the alternate location is to put it in sampling.cpp->llama_sampling_init(), which is the only place where the "root" node is named as required. That fix would look like this.

@ggerganov Do you have preference on the two versions of this fix? I think this main difference is -- philosophically -- do we want all grammars to require a "root" node (if so, then put it in grammar-parser), or if it's possible to have a grammar without a "root" node (that's technically a syntactically correct grammar, but it's missing our expected entry point), then we should put the fix in sampling.cpp.

@ggerganov
Copy link
Owner

The fix should be in sampling.cpp - no need to require root node in the grammars

…turning valid grammar structure. This is an alternate fix location to put the required root node in sampling.cpp instead of grammar-parser.cpp.
@HanClinto HanClinto force-pushed the fix_gbnf_root_required branch from bfcf545 to 10ac60b Compare March 12, 2024 15:14
@HanClinto
Copy link
Collaborator Author

The fix should be in sampling.cpp - no need to require root node in the grammars

Excellent, thank you!

This branch is now updated.

@ggerganov ggerganov merged commit 4636283 into ggerganov:master Mar 13, 2024
61 of 62 checks passed
NeoZhangJianyu pushed a commit to NeoZhangJianyu/llama.cpp that referenced this pull request Mar 15, 2024
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Malformed grammar crashes the server
2 participants