Skip to content

Commit 5dd1f45

Browse files
committed
used precomputed token text for grammar sample
1 parent 911a871 commit 5dd1f45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llama.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7361,7 +7361,7 @@ void llama_sample_grammar(struct llama_context * ctx, llama_token_data_array * c
73617361

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

0 commit comments

Comments
 (0)