Skip to content

Commit 67d1849

Browse files
committed
speculative : handle params.n_predict == -1
1 parent 47bb241 commit 67d1849

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/speculative/speculative.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ int main(int argc, char ** argv) {
3939
return 1;
4040
}
4141

42+
if (params.n_predict < -1) {
43+
LOG_ERR("%s: --n-predict must be >= -1\n", __func__);
44+
return 1;
45+
}
46+
4247
common_init();
4348

4449
if (params.model_draft.empty()) {
@@ -441,7 +446,7 @@ int main(int argc, char ** argv) {
441446
++n_past_dft;
442447
}
443448

444-
if (n_predict > params.n_predict || has_eos) {
449+
if ((params.n_predict >= 0 && n_predict > params.n_predict) || has_eos) {
445450
break;
446451
}
447452

0 commit comments

Comments
 (0)