diff options
author | Evan Jones <evan.q.jones@gmail.com> | 2023-08-24 00:07:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-24 07:07:13 +0300 |
commit | 6e91a1b0706c2e0e52b9d9be7ee82d3c1e7a33c1 (patch) | |
tree | 0271883678675c12523c434d3030456ddcd416ca | |
parent | 44d5462b5cddc1c5cbcd7647646f7b55b175b01f (diff) |
llama : fix grammar sometimes generating null char (#2756)
-rw-r--r-- | llama.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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)); |