Skip to content

Commit

Permalink
llama : do a warm-up eval at start for better timings (#1824)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov authored Jun 13, 2023
1 parent 74d4cfa commit 2347e45
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,13 @@ int main(int argc, char ** argv) {

std::vector<llama_token> embd;

// do one empty run to warm up the model
{
const std::vector<llama_token> tmp = { llama_token_bos(), };
llama_eval(ctx, tmp.data(), tmp.size(), 0, params.n_threads);
llama_reset_timings(ctx);
}

while ((n_remain != 0 && !is_antiprompt) || params.interactive) {
// predict
if (embd.size() > 0) {
Expand Down

0 comments on commit 2347e45

Please sign in to comment.