From 295e9945f918794cee623eda7ea0635b98696234 Mon Sep 17 00:00:00 2001 From: Molly Sophia Date: Fri, 6 Sep 2024 16:34:47 +0800 Subject: [PATCH] common: warmup: Handle situation when eos=bos=-1 Signed-off-by: Molly Sophia --- common/common.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/common.cpp b/common/common.cpp index d22b049681c9f..6a6471b857bce 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -2531,7 +2531,12 @@ struct llama_init_result llama_init_from_gpt_params(gpt_params & params) { if (bos != -1) { tmp.push_back(bos); } - tmp.push_back(eos); + if (eos != -1) { + tmp.push_back(eos); + } + if (tmp.empty()) { + tmp.push_back(0); + } if (llama_model_has_encoder(model)) { llama_encode(lctx, llama_batch_get_one(tmp.data(), tmp.size(), 0, 0));