aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorslaren <2141330+slaren@users.noreply.github.com>2023-04-21 14:57:57 +0200
committerGitHub <noreply@github.com>2023-04-21 14:57:57 +0200
commit3d59769c3bb7e72c915646ddb1e239b1face19f5 (patch)
tree0a2155c4ee0325868f03bbaba507476e2e2458f1 /examples
parentd40fded93e1a533e969768e1e335c15c61c296ce (diff)
Show perplexity ETA in hours and minutes (#1096)
Diffstat (limited to 'examples')
-rw-r--r--examples/perplexity/perplexity.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/perplexity/perplexity.cpp b/examples/perplexity/perplexity.cpp
index 80792ea..615157e 100644
--- a/examples/perplexity/perplexity.cpp
+++ b/examples/perplexity/perplexity.cpp
@@ -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,