fix instruct mode

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.
This commit is contained in:
rabidcopy 2023-03-23 17:56:16 -05:00 committed by GitHub
parent 4870e455b3
commit b64067704e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -363,7 +363,7 @@ int main(int argc, char ** argv) {
} }
// replace end of text token with newline token when in interactive mode // 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(); id = llama_token_newline.front();
if (params.antiprompt.size() != 0) { if (params.antiprompt.size() != 0) {
// tokenize and inject first reverse prompt // tokenize and inject first reverse prompt
@ -464,8 +464,12 @@ int main(int argc, char ** argv) {
// end of text token // end of text token
if (embd.back() == llama_token_eos()) { if (embd.back() == llama_token_eos()) {
fprintf(stderr, " [end of text]\n"); if (params.instruct) {
break; 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. // In interactive mode, respect the maximum number of tokens and drop back to user input when reached.