Skip to content

Commit 3d59769

Browse files
authored
Show perplexity ETA in hours and minutes (#1096)
1 parent d40fded commit 3d59769

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/perplexity/perplexity.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ void perplexity(llama_context * ctx, const gpt_params & params) {
5353
auto end_t = std::chrono::high_resolution_clock::now();
5454
if (i == 0) {
5555
const float seconds = std::chrono::duration<float>(end_t - start_t).count();
56-
printf("%.2f seconds per pass - ETA %.2f hours\n", seconds, (seconds * seq_count) / (60.0*60.0));
56+
printf("%.2f seconds per pass - ETA ", seconds);
57+
int total_seconds = (int)(seconds * seq_count);
58+
if (total_seconds >= 60*60) {
59+
printf("%d hours ", total_seconds / (60*60));
60+
total_seconds = total_seconds % (60*60);
61+
}
62+
printf("%d minutes\n", total_seconds / 60);
5763
}
5864
// We get the logits for all the tokens in the context window (params.n_ctx)
5965
// from llama_eval above. Now, based on https://huggingface.co/docs/transformers/perplexity,

0 commit comments

Comments
 (0)