Skip to content

Commit bac8bed

Browse files
authored
eval-callback : check for empty input (#14539)
1 parent b81510a commit bac8bed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/eval-callback/eval-callback.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ static bool run(llama_context * ctx, const common_params & params) {
136136

137137
std::vector<llama_token> tokens = common_tokenize(ctx, params.prompt, add_bos);
138138

139+
if (tokens.empty()) {
140+
LOG_ERR("%s : there are not input tokens to process - (try to provide a prompt with '-p')\n", __func__);
141+
return false;
142+
}
143+
139144
if (llama_decode(ctx, llama_batch_get_one(tokens.data(), tokens.size()))) {
140145
LOG_ERR("%s : failed to eval\n", __func__);
141146
return false;

0 commit comments

Comments
 (0)