Skip to content

Commit

Permalink
Fix for main example getting stuck when -n -2 and --interactive (gger…
Browse files Browse the repository at this point in the history
…ganov#2767)

* Fix for main example getting stuck when -n -2 and --interactive

* Add a comment so future generations may suffer less.
  • Loading branch information
KerfuffleV2 authored and akawrykow committed Aug 29, 2023
1 parent 0b09988 commit bc6237d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bc6237d

Please sign in to comment.