]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Show perplexity ETA in hours and minutes (#1096)
authorslaren <redacted>
Fri, 21 Apr 2023 12:57:57 +0000 (14:57 +0200)
committerGitHub <redacted>
Fri, 21 Apr 2023 12:57:57 +0000 (14:57 +0200)
examples/perplexity/perplexity.cpp

index 80792ea0d95d0a7932e64492d8d457597b171cb0..615157e7b68ece14c6f2ad7cc73b0569d95ec55a 100644 (file)
@@ -53,7 +53,13 @@ void perplexity(llama_context * ctx, const gpt_params & params) {
         auto end_t = std::chrono::high_resolution_clock::now();
         if (i == 0) {
             const float seconds = std::chrono::duration<float>(end_t - start_t).count();
-            printf("%.2f seconds per pass - ETA %.2f hours\n", seconds, (seconds * seq_count) / (60.0*60.0));
+            printf("%.2f seconds per pass - ETA ", seconds);
+            int total_seconds = (int)(seconds * seq_count);
+            if (total_seconds >= 60*60) {
+                printf("%d hours ", total_seconds / (60*60));
+                total_seconds = total_seconds % (60*60);
+            }
+            printf("%d minutes\n", total_seconds / 60);
         }
         // We get the logits for all the tokens in the context window (params.n_ctx)
         // from llama_eval above.  Now, based on https://huggingface.co/docs/transformers/perplexity,