Skip to content

Commit

Permalink
used precomputed token text for grammar sample
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusDunn committed Dec 4, 2023
1 parent 911a871 commit 5dd1f45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7361,7 +7361,7 @@ void llama_sample_grammar(struct llama_context * ctx, llama_token_data_array * c

for (size_t i = 0; i < candidates->size; ++i) {
const llama_token id = candidates->data[i].id;
const std::string piece = llama_token_to_piece(ctx, id);
const std::string piece = ctx->model.vocab.id_to_token[id].text;
if (id == eos) {
if (!allow_eos) {
candidates->data[i].logit = -INFINITY;
Expand Down

0 comments on commit 5dd1f45

Please sign in to comment.