Skip to content

Commit 5290c38

Browse files
klosaxggerganov
andauthored
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 <[email protected]>
1 parent cc34dbd commit 5290c38

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/main/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ int main(int argc, char ** argv) {
197197
embd_inp = session_tokens;
198198
}
199199

200+
// Should not run without any tokens
201+
if (embd_inp.empty()) {
202+
embd_inp.push_back(llama_token_bos(ctx));
203+
}
204+
200205
// Tokenize negative prompt
201206
std::vector<llama_token> guidance_inp;
202207
int guidance_offset = 0;

0 commit comments

Comments
 (0)