Explorar o código

perplexity : fix ETA by warming up the model with an empty run

Georgi Gerganov %!s(int64=2) %!d(string=hai) anos
pai
achega
8f429fa511
Modificáronse 2 ficheiros con 8 adicións e 8 borrados
  1. 8 0
      common/common.cpp
  2. 0 8
      examples/main/main.cpp

+ 8 - 0
common/common.cpp

@@ -752,6 +752,14 @@ std::tuple<struct llama_model *, struct llama_context *> llama_init_from_gpt_par
         params.logit_bias[llama_token_eos(lctx)] = -INFINITY;
     }
 
+    {
+        LOG("warming up the model with an empty run\n");
+
+        const std::vector<llama_token> tmp = { llama_token_bos(lctx), };
+        llama_eval(lctx, tmp.data(), tmp.size(), 0, params.n_threads);
+        llama_reset_timings(lctx);
+    }
+
     return std::make_tuple(model, lctx);
 }
 

+ 0 - 8
examples/main/main.cpp

@@ -492,14 +492,6 @@ int main(int argc, char ** argv) {
     std::vector<llama_token> embd;
     std::vector<llama_token> embd_guidance;
 
-    {
-        LOG("warming up the model with an empty run\n");
-
-        const std::vector<llama_token> tmp = { llama_token_bos(ctx), };
-        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) {