]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
main : insert bos if no tokens (#2727)
authorklosax <redacted>
Wed, 23 Aug 2023 14:46:03 +0000 (16:46 +0200)
committerGitHub <redacted>
Wed, 23 Aug 2023 14:46:03 +0000 (16:46 +0200)
* main.cpp : insert bos if no tokens

* Update examples/main/main.cpp

* Update examples/main/main.cpp

---------

Co-authored-by: Georgi Gerganov <redacted>
examples/main/main.cpp

index 388e1f7d7fe020fbbb12461a65ef2664033b95a9..0a22f3c25ff4624a5d985a2bf874e14e49749173 100644 (file)
@@ -197,6 +197,11 @@ int main(int argc, char ** argv) {
         embd_inp = session_tokens;
     }
 
+    // Should not run without any tokens
+    if (embd_inp.empty()) {
+        embd_inp.push_back(llama_token_bos(ctx));
+    }
+
     // Tokenize negative prompt
     std::vector<llama_token> guidance_inp;
     int guidance_offset = 0;