]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
eval-callback : check for empty input (#14539)
authorGeorgi Gerganov <redacted>
Sat, 5 Jul 2025 04:18:09 +0000 (07:18 +0300)
committerGitHub <redacted>
Sat, 5 Jul 2025 04:18:09 +0000 (07:18 +0300)
examples/eval-callback/eval-callback.cpp

index bbbec6a01a175283bb58bfba129bd48e6f02cfae..4afd80eb454ad8624665a22b864ee403bf0698e5 100644 (file)
@@ -136,6 +136,11 @@ static bool run(llama_context * ctx, const common_params & params) {
 
     std::vector<llama_token> tokens = common_tokenize(ctx, params.prompt, add_bos);
 
+    if (tokens.empty()) {
+        LOG_ERR("%s : there are not input tokens to process - (try to provide a prompt with '-p')\n", __func__);
+        return false;
+    }
+
     if (llama_decode(ctx, llama_batch_get_one(tokens.data(), tokens.size()))) {
         LOG_ERR("%s : failed to eval\n", __func__);
         return false;