Skip to content

Commit

Permalink
main : print error on empty input (#8456)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov authored Jul 12, 2024
1 parent f532262 commit 6af51c0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6af51c0

Please sign in to comment.