-
Notifications
You must be signed in to change notification settings - Fork 14k
adds simple llama grammar tests #2618
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
Conversation
|
WIP to resolve the |
|
Would be great to resolve the issue and merge this test. Hopefully people will help to debug |
|
@ggerganov I believe I've identified the issue but am having some trouble resolving it. It seems that attempting to access and it seems like this issue still exists on the fix unicode branch #2553 when attempting to deref I've been attempting to avoid this memory issue without changing any function signatures but have not found a solution. Any advice would be greatly appreciated! 🙏 |
|
Taking a look |
|
Looks like the issue is that diff --git a/tests/test-llama-grammar.cpp b/tests/test-llama-grammar.cpp
index e625ca1..d0b7c48 100644
--- a/tests/test-llama-grammar.cpp
+++ b/tests/test-llama-grammar.cpp
@@ -196,8 +196,9 @@ int main()
for (size_t i = 0; i < 24; ++i)
{
- uint32_t *cp = new uint32_t[1]; // dynamically allocate memory for code_point
- *cp = 37 + i;
+ uint32_t *cp = new uint32_t[2]; // dynamically allocate memory for code_point
+ cp[0] = 37 + i;
+ cp[1] = 0;
next_candidates[i] = {i, cp};
}On that note, I see the static functions like
|
|
@ejones amazing thank you for the solution! (silly oversight from my side) 🙏 I also agree that it makes sense to target the public interfaces going forward. I intend on adding tests for A large motivation behind these tests is to understand how the grammar works and what each function is doing so I've been working through the flow a function at a time hence the very targeted tests. |
ref ggml-org/ggml#295
This PR adds simple llama grammar test to give more insight into the how the grammar is used to constrain token generation
run tests
Please let me know if I should make any changes! 🙏
This PR is similar to and a continuation on #2594