From da0837f55fa9050713ac6e699357c74f4075a75e Mon Sep 17 00:00:00 2001 From: rabidcopy Date: Wed, 22 Mar 2023 11:01:47 -0500 Subject: [PATCH] tokenize/inject reverse prompt for refactor this doesn't seem right though --- main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 4c4aa3701..df9d0f152 100644 --- a/main.cpp +++ b/main.cpp @@ -250,10 +250,10 @@ int main(int argc, char ** argv) { } // tokenize the first reverse prompt -// std::vector first_antiprompt; -// if (!params.antiprompt.empty()) { -// first_antiprompt = ::llama_tokenize(vocab, params.antiprompt.front(), false); -// } + 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) { @@ -364,10 +364,10 @@ int main(int argc, char ** argv) { // replace end of text token with newline token when in interactive mode if (id == llama_token_eos() && params.interactive) { id = llama_token_newline(); -// if (params.antiprompt.size() != 0) { + if (params.antiprompt.size() != 0) { // inject first reverse prompt -// embd_inp.insert(embd_inp.end(), first_antiprompt.begin(), first_antiprompt.end()); -// } + embd_inp.insert(embd_inp.end(), first_antiprompt.begin(), first_antiprompt.end()); + } } // add it to the context @@ -484,4 +484,4 @@ int main(int argc, char ** argv) { set_console_state(CONSOLE_STATE_DEFAULT); return 0; -} \ No newline at end of file +}