Add timing/ETA
This commit is contained in:
parent
2f8ab68d72
commit
35ae689f78
1 changed files with 6 additions and 0 deletions
6
main.cpp
6
main.cpp
|
@ -801,10 +801,16 @@ void perplexity(const gpt_vocab &vocab, const llama_model &model, const gpt_para
|
||||||
int end = start + params.n_ctx - 1;
|
int end = start + params.n_ctx - 1;
|
||||||
std::vector<gpt_vocab::id> embd(tokens.begin() + start, tokens.begin() + end);
|
std::vector<gpt_vocab::id> embd(tokens.begin() + start, tokens.begin() + end);
|
||||||
std::vector<float> logits;
|
std::vector<float> logits;
|
||||||
|
auto start_t = std::chrono::high_resolution_clock::now();
|
||||||
if (!llama_eval(model, params.n_threads, 0, embd, logits, mem_per_token, true)) {
|
if (!llama_eval(model, params.n_threads, 0, embd, logits, mem_per_token, true)) {
|
||||||
fprintf(stderr, "Failed to predict\n");
|
fprintf(stderr, "Failed to predict\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto end_t = std::chrono::high_resolution_clock::now();
|
||||||
|
if (i == 0) {
|
||||||
|
double seconds = std::chrono::duration<double>(end_t - start_t).count();
|
||||||
|
printf("%.2f seconds per pass - ETA %.2f hours\n", seconds, (seconds * seq_count) / (60.0*60.0));
|
||||||
|
}
|
||||||
// We get the logits for all the tokens in the context window (params.n_ctx)
|
// 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,
|
// from llama_eval above. Now, based on https://huggingface.co/docs/transformers/perplexity,
|
||||||
// calculate the perplexity over the last half the window (so the model always has
|
// calculate the perplexity over the last half the window (so the model always has
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue