Przeglądaj źródła

llama : fix grammar sometimes generating null char (#2756)

Evan Jones 2 lat temu
rodzic
commit
6e91a1b070
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      llama.cpp

+ 1 - 1
llama.cpp

@@ -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));