Skip to content

Commit

Permalink
fixing find stop when maximum number of tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
mgonzs13 committed Jan 20, 2025
1 parent 986b539 commit ea2357a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llama_ros/src/llama_ros/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,13 +824,13 @@ Llama::find_stop(std::vector<struct CompletionOutput> completion_result_list,
}

// respect the maximum number of tokens
if (this->n_past > this->params.n_predict && this->params.n_predict != -1) {
if (this->n_past >= this->params.n_predict && this->params.n_predict >= 0) {
LLAMA_LOG_INFO("Maximum number of tokens reached %d",
this->params.n_predict);
return FULL_STOP;
}

if (this->n_past > this->get_n_ctx() && this->params.n_predict == -2) {
if (this->n_past >= this->get_n_ctx() && this->params.n_predict == -2) {
LLAMA_LOG_INFO("Maximum number of tokens reached %d", this->get_n_ctx());
return FULL_STOP;
}
Expand Down

0 comments on commit ea2357a

Please sign in to comment.