From 9407c847a2234b376e4995b127cd17891372c8c0 Mon Sep 17 00:00:00 2001 From: klosax <131523366+klosax@users.noreply.github.com> Date: Wed, 23 Aug 2023 01:50:17 +0200 Subject: [PATCH 1/3] main.cpp : insert bos if no tokens --- examples/main/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 388e1f7d7fe02..f1228642458fc 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -197,6 +197,11 @@ int main(int argc, char ** argv) { embd_inp = session_tokens; } + // Should not run without any tokens + if(embd_inp.size()==0) { + embd_inp.push_back(llama_token_bos(ctx)); + } + // Tokenize negative prompt std::vector guidance_inp; int guidance_offset = 0; From c3c5aacef670c94bc3bb6b1cd01b927dfc262e32 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Wed, 23 Aug 2023 17:11:56 +0300 Subject: [PATCH 2/3] Update examples/main/main.cpp --- examples/main/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index f1228642458fc..3ba3a9f5a5ea7 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -198,7 +198,7 @@ int main(int argc, char ** argv) { } // Should not run without any tokens - if(embd_inp.size()==0) { + if (embd_inp.size()==0) { embd_inp.push_back(llama_token_bos(ctx)); } From 004016e6d869a3d6c95074f43a1ae6112a73ca21 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Wed, 23 Aug 2023 17:12:26 +0300 Subject: [PATCH 3/3] Update examples/main/main.cpp --- examples/main/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 3ba3a9f5a5ea7..0a22f3c25ff46 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -198,7 +198,7 @@ int main(int argc, char ** argv) { } // Should not run without any tokens - if (embd_inp.size()==0) { + if (embd_inp.empty()) { embd_inp.push_back(llama_token_bos(ctx)); }