diff options
author | Kerfuffle <44031344+KerfuffleV2@users.noreply.github.com> | 2023-08-24 10:11:13 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-24 10:11:13 -0600 |
commit | 7694adda8d1111b3cf758ad6c91d754a0a4cacff (patch) | |
tree | a5e05bc0a93112359db8723ecf7dd30ffbdaddc7 /examples | |
parent | fea95c682d0028fdd25853bea58035794a0c964d (diff) |
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.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/main/main.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 1393f0b0..cb8747c2 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -798,7 +798,8 @@ int main(int argc, char ** argv) { } // In interactive mode, respect the maximum number of tokens and drop back to user input when reached. - if (params.interactive && n_remain <= 0 && params.n_predict != -1) { + // We skip this logic when n_predict == -1 (infinite) or -2 (stop at context size). + if (params.interactive && n_remain <= 0 && params.n_predict >= 0) { n_remain = params.n_predict; is_interacting = true; } |