]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
examples: fix android example cannot be generated continuously (#8621)
authordevojony <redacted>
Mon, 22 Jul 2024 06:54:42 +0000 (14:54 +0800)
committerGitHub <redacted>
Mon, 22 Jul 2024 06:54:42 +0000 (09:54 +0300)
When generation ends `completion_loop()` should return a NULL, not the empty string

examples/llama.android/llama/src/main/cpp/llama-android.cpp

index 92a6b16b1a00cf293347d8fd5405644596e0cf0f..2aafe23167557f66e16c82fed9d86ca8494288cd 100644 (file)
@@ -409,7 +409,7 @@ Java_android_llama_cpp_LLamaAndroid_completion_1loop(
 
     const auto n_cur = env->CallIntMethod(intvar_ncur, la_int_var_value);
     if (llama_token_is_eog(model, new_token_id) || n_cur == n_len) {
-        return env->NewStringUTF("");
+        return nullptr;
     }
 
     auto new_token_chars = llama_token_to_piece(context, new_token_id);