]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
main : print error on empty input (#8456)
authorGeorgi Gerganov <redacted>
Fri, 12 Jul 2024 11:48:04 +0000 (14:48 +0300)
committerGitHub <redacted>
Fri, 12 Jul 2024 11:48:04 +0000 (14:48 +0300)
examples/main/main.cpp

index 4ef55c1e6b3cf841d4a731e93ce6e52a2497c607..a0d817b1a89d14d70333fc596b8b5024363bedb6 100644 (file)
@@ -289,8 +289,13 @@ int main(int argc, char ** argv) {
 
     // Should not run without any tokens
     if (embd_inp.empty()) {
-        embd_inp.push_back(llama_token_bos(model));
-        LOG("embd_inp was considered empty and bos was added: %s\n", LOG_TOKENS_TOSTR_PRETTY(ctx, embd_inp).c_str());
+        if (add_bos) {
+            embd_inp.push_back(llama_token_bos(model));
+            LOG("embd_inp was considered empty and bos was added: %s\n", LOG_TOKENS_TOSTR_PRETTY(ctx, embd_inp).c_str());
+        } else {
+            LOG_TEE("error: input is empty\n");
+            return -1;
+        }
     }
 
     // Tokenize negative prompt