Skip to content

Commit 7694add

Browse files
authored
Fix for main example getting stuck when -n -2 and --interactive (#2767)
* Fix for main example getting stuck when -n -2 and --interactive * Add a comment so future generations may suffer less.
1 parent fea95c6 commit 7694add

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/main/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,8 @@ int main(int argc, char ** argv) {
798798
}
799799

800800
// In interactive mode, respect the maximum number of tokens and drop back to user input when reached.
801-
if (params.interactive && n_remain <= 0 && params.n_predict != -1) {
801+
// We skip this logic when n_predict == -1 (infinite) or -2 (stop at context size).
802+
if (params.interactive && n_remain <= 0 && params.n_predict >= 0) {
802803
n_remain = params.n_predict;
803804
is_interacting = true;
804805
}

0 commit comments

Comments
 (0)