Skip to content

Commit

Permalink
llama : fix grammar sometimes generating null char (ggerganov#2756)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejones authored and akawrykow committed Aug 29, 2023
1 parent 81cc52a commit d505506
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 @@ -4074,7 +4074,7 @@ void llama_sample_grammar(struct llama_context * ctx, llama_token_data_array * c
if (!allow_eos) {
candidates->data[i].logit = -INFINITY;
}
} else if (text.empty()) {
} else if (text.empty() || text[0] == 0) {
candidates->data[i].logit = -INFINITY;
} else {
candidates_decoded.push_back(decode_utf8(text.c_str(), grammar->partial_utf8));
Expand Down

0 comments on commit d505506

Please sign in to comment.