Respect the maximum number of tokens in interactive.

This commit is contained in:
Johnman 2023-03-19 19:26:17 +01:00
parent 084e2f0ec0
commit 9d89bedf1a

View file

@ -1055,7 +1055,7 @@ int main(int argc, char ** argv) {
} }
// end of text token // end of text token
if (embd.back() == 2) { if (embd.size() && embd.back() == 2) {
if (params.interactive) { if (params.interactive) {
is_interacting = true; is_interacting = true;
} else { } else {
@ -1063,6 +1063,12 @@ int main(int argc, char ** argv) {
break; break;
} }
} }
// In interactive mode, respect the maximum number of tokens and drop back to user input when reached.
if (params.interactive && remaining_tokens <= 0) {
remaining_tokens = params.n_predict;
is_interacting = true;
}
} }
#if defined (_WIN32) #if defined (_WIN32)