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:
parent
4870e455b3
commit
b64067704e
1 changed files with 7 additions and 3 deletions
6
main.cpp
6
main.cpp
|
@ -363,7 +363,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
|
||||
|
@ -464,9 +464,13 @@ int main(int argc, char ** argv) {
|
|||
|
||||
// end of text token
|
||||
if (embd.back() == llama_token_eos()) {
|
||||
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.
|
||||
if (params.interactive && remaining_tokens <= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue