Skip to content

Commit

Permalink
fix(cpp): incorrect num_tokens_predicted
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Oct 5, 2023
1 parent 68fe09c commit 6dd9865
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cpp/rn-llama.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,11 @@ struct llama_rn_context
);
}

bool tg = true;
while (n_past < embd.size())
{
int n_eval = (int)embd.size() - n_past;
tg = n_eval == 1;
if (n_eval > params.n_batch)
{
n_eval = params.n_batch;
Expand Down Expand Up @@ -457,7 +459,9 @@ struct llama_rn_context
}
last_n_tokens.erase(last_n_tokens.begin());
last_n_tokens.push_back(result.tok);
num_tokens_predicted++;
if (tg) {
num_tokens_predicted++;
}
}

// add it to the context
Expand Down

0 comments on commit 6dd9865

Please sign in to comment.