diff options
author | rabidcopy <rabidcopy@yahoo.com> | 2023-03-24 10:22:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-24 17:22:39 +0200 |
commit | 863f65e2e32dc1e6d23c96a4811bf382d6b2a548 (patch) | |
tree | ed00c666be4a5e6a225a64909a3eaf52fcf5023f | |
parent | afd220d9c665e4c19107120ace2f0cb742e28aa1 (diff) |
fix instruct mode (#445)
changes to EOS behavior in interactive and reverse prompt handling broke instruct mode by erroneously injecting instruct mode's reverse prompt and an extra newline.
-rw-r--r-- | main.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -387,7 +387,7 @@ 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) { + if (id == llama_token_eos() && params.interactive && !params.instruct) { id = llama_token_newline.front(); if (params.antiprompt.size() != 0) { // tokenize and inject first reverse prompt @@ -488,8 +488,12 @@ int main(int argc, char ** argv) { // end of text token if (embd.back() == llama_token_eos()) { - fprintf(stderr, " [end of text]\n"); - break; + if (params.instruct) { + is_interacting = true; + } else { + fprintf(stderr, " [end of text]\n"); + break; + } } // In interactive mode, respect the maximum number of tokens and drop back to user input when reached. |