From 67d18498d328f0696b5d28697834dfd6fb152b7e Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sun, 20 Oct 2024 20:10:03 +0300 Subject: [PATCH] speculative : handle params.n_predict == -1 --- examples/speculative/speculative.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/speculative/speculative.cpp b/examples/speculative/speculative.cpp index 4c04bf6cb..ff137682d 100644 --- a/examples/speculative/speculative.cpp +++ b/examples/speculative/speculative.cpp @@ -39,6 +39,11 @@ int main(int argc, char ** argv) { return 1; } + if (params.n_predict < -1) { + LOG_ERR("%s: --n-predict must be >= -1\n", __func__); + return 1; + } + common_init(); if (params.model_draft.empty()) { @@ -441,7 +446,7 @@ int main(int argc, char ** argv) { ++n_past_dft; } - if (n_predict > params.n_predict || has_eos) { + if ((params.n_predict >= 0 && n_predict > params.n_predict) || has_eos) { break; }