Skip to content

Commit 3773328

Browse files
committed
remove candidates_decoded
1 parent eb9d1fc commit 3773328

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llama.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -7356,8 +7356,6 @@ void llama_sample_grammar(struct llama_context * ctx, llama_token_data_array * c
73567356

73577357
const llama_token eos = llama_token_eos(&ctx->model);
73587358

7359-
std::vector<std::pair<std::vector<uint32_t>, llama_partial_utf8>> candidates_decoded;
7360-
candidates_decoded.reserve(candidates->size);
73617359
std::vector<llama_grammar_candidate> candidates_grammar;
73627360
candidates_grammar.reserve(candidates->size);
73637361

@@ -7371,8 +7369,8 @@ void llama_sample_grammar(struct llama_context * ctx, llama_token_data_array * c
73717369
} else if (piece.empty() || piece[0] == 0) {
73727370
candidates->data[i].logit = -INFINITY;
73737371
} else {
7374-
candidates_decoded.push_back(decode_utf8(piece, grammar->partial_utf8));
7375-
candidates_grammar.push_back({ i, candidates_decoded.back().first.data(), candidates_decoded.back().second });
7372+
std::pair<std::vector<uint32_t>, llama_partial_utf8> decoded = decode_utf8(piece, grammar->partial_utf8);
7373+
candidates_grammar.push_back({ i, decoded.first.data(), decoded.second });
73767374
}
73777375
}
73787376

0 commit comments

Comments
 (0)