Never exit the main loop in interactive mode.
This commit is contained in:
parent
d7def1a752
commit
10f1c9ed30
1 changed files with 14 additions and 4 deletions
12
main.cpp
12
main.cpp
|
@ -1035,12 +1035,22 @@ int main(int argc, char ** argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.interactive) {
|
||||||
|
if (embd.size() && embd.back() == 2) {
|
||||||
|
is_interacting = true;
|
||||||
|
}
|
||||||
|
if (remaining_tokens == 0) {
|
||||||
|
remaining_tokens = params.n_predict;
|
||||||
|
is_interacting = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// end of text token
|
// end of text token
|
||||||
if (embd.back() == 2) {
|
if (embd.size() && embd.back() == 2) {
|
||||||
fprintf(stderr, " [end of text]\n");
|
fprintf(stderr, " [end of text]\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue