From 4e4cfdfb67f5ff5f47a99ede1cdda79aaa3b25e3 Mon Sep 17 00:00:00 2001 From: rabidcopy Date: Wed, 22 Mar 2023 17:46:23 -0500 Subject: [PATCH] tokenize and inject reverse prompt as needed this doesn't seem to work if the reverse prompt is tokenized outside earlier on --- main.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index df9d0f152..6bb497770 100644 --- a/main.cpp +++ b/main.cpp @@ -249,12 +249,6 @@ int main(int argc, char ** argv) { params.antiprompt.push_back("### Instruction:\n\n"); } - // tokenize the first reverse prompt - auto first_antiprompt = ::llama_tokenize(ctx, params.prompt,false); - if (!params.antiprompt.empty()) { - auto first_antiprompt = ::llama_tokenize(ctx, params.antiprompt.front(), false); - } - // enable interactive mode if reverse prompt is specified if (params.antiprompt.size() != 0) { params.interactive = true; @@ -365,7 +359,9 @@ int main(int argc, char ** argv) { if (id == llama_token_eos() && params.interactive) { id = llama_token_newline(); if (params.antiprompt.size() != 0) { - // inject first reverse prompt + // tokenize and inject first reverse prompt + auto first_antiprompt = ::llama_tokenize(ctx, "", false); + first_antiprompt = ::llama_tokenize(ctx, params.antiprompt.front(), false); embd_inp.insert(embd_inp.end(), first_antiprompt.begin(), first_antiprompt.end()); } }