Skip to content

Commit 3e73d31

Browse files
committed
lookahead : support -n -1 infinite generation
1 parent 9656026 commit 3e73d31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/lookahead/lookahead.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ int main(int argc, char ** argv) {
311311
++n_predict;
312312
++n_past;
313313

314-
if (n_predict > params.n_predict || has_eos) {
314+
if ((params.n_predict >= 0 && n_predict > params.n_predict) || has_eos) {
315315
break;
316316
}
317317

@@ -433,7 +433,7 @@ int main(int argc, char ** argv) {
433433
}
434434
}
435435

436-
if (n_predict > params.n_predict || has_eos) {
436+
if ((params.n_predict >= 0 && n_predict > params.n_predict) || has_eos) {
437437
break;
438438
}
439439

0 commit comments

Comments
 (0)