Skip to content

Commit d505506

Browse files
ejonesakawrykow
authored andcommitted
llama : fix grammar sometimes generating null char (ggml-org#2756)
1 parent 81cc52a commit d505506

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
@@ -4074,7 +4074,7 @@ void llama_sample_grammar(struct llama_context * ctx, llama_token_data_array * c
40744074
if (!allow_eos) {
40754075
candidates->data[i].logit = -INFINITY;
40764076
}
4077-
} else if (text.empty()) {
4077+
} else if (text.empty() || text[0] == 0) {
40784078
candidates->data[i].logit = -INFINITY;
40794079
} else {
40804080
candidates_decoded.push_back(decode_utf8(text.c_str(), grammar->partial_utf8));

0 commit comments

Comments
 (0)