summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorklosax <131523366+klosax@users.noreply.github.com>2023-08-23 16:46:03 +0200
committerGitHub <noreply@github.com>2023-08-23 16:46:03 +0200
commit5290c38e6e9b66ee2b543e560e301c1a1a90929c (patch)
tree6206358c397f22fbe5d267bbf128c9a96d5fac60
parentcc34dbda9681418a2b18382446b90cdcec398d82 (diff)
main : insert bos if no tokens (#2727)
* main.cpp : insert bos if no tokens * Update examples/main/main.cpp * Update examples/main/main.cpp --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
-rw-r--r--examples/main/main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index 388e1f7d..0a22f3c2 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.empty()) {
+ embd_inp.push_back(llama_token_bos(ctx));
+ }
+
// Tokenize negative prompt
std::vector<llama_token> guidance_inp;
int guidance_offset = 0;