Skip to content

Commit

Permalink
fix: adapt to llama.cpp breaking changes (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
giladgd authored Jul 25, 2024
1 parent 982575c commit 7f15823
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llama/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ class LLAMAContextEvalWorker : Napi::AsyncWorker, Napi::Promise::Deferred {
}

if (use_grammar && (grammar_evaluation_state)->grammar != nullptr) {
llama_sample_grammar(ctx->ctx, &candidates_p, (grammar_evaluation_state)->grammar);
llama_grammar_sample((grammar_evaluation_state)->grammar, ctx->ctx, &candidates_p);
}

if (temperature <= 0) {
Expand All @@ -414,7 +414,7 @@ class LLAMAContextEvalWorker : Napi::AsyncWorker, Napi::Promise::Deferred {
}

if (new_token_id != eos_token && use_grammar && (grammar_evaluation_state)->grammar != nullptr) {
llama_grammar_accept_token(ctx->ctx, (grammar_evaluation_state)->grammar, new_token_id);
llama_grammar_accept_token((grammar_evaluation_state)->grammar, ctx->ctx, new_token_id);
}

result = new_token_id;
Expand Down

0 comments on commit 7f15823

Please sign in to comment.