From 6018c9d78c3a32c6cf30dbbf22b3ddd85932221c Mon Sep 17 00:00:00 2001 From: 65a <65a@63bit.net> Date: Tue, 3 Oct 2023 10:11:53 -0700 Subject: [PATCH] Fix Stopwords/Antiprompt (#248) Signed-off-by: 65a <65a@63bit.net> --- binding.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/binding.cpp b/binding.cpp index bd2f895..149cdfd 100644 --- a/binding.cpp +++ b/binding.cpp @@ -513,11 +513,17 @@ int llama_predict(void* params_ptr, void* state_pr, char* result, bool debug) { : 0; if (last_output.find(antiprompt, search_start_pos) != std::string::npos) { + is_antiprompt = true; break; } } } } + + // found antiprompt + if (is_antiprompt) { + break; + } // end of text token if (!embd.empty() && embd.back() == llama_token_eos(ctx)) {