diff options
author | pudepiedj <pudepiedj@gmail.com> | 2024-01-11 16:14:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-11 18:14:52 +0200 |
commit | 43f76bf1c362c067fce46bb8dcda0b64af8a9533 (patch) | |
tree | c446cabb97601363b645f2fb661bc48d790478fa /examples | |
parent | 2f043328e3116724d15b915b5c6078e2df860a69 (diff) |
main : print total token count and tokens consumed so far (#4874)
* Token count changes
* Add show token count
* Updating before PR
* Two requested changes
* Move param def posn
Diffstat (limited to 'examples')
-rw-r--r-- | examples/main/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 5ea67051..1f35febb 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -500,7 +500,7 @@ int main(int argc, char ** argv) { while ((n_remain != 0 && !is_antiprompt) || params.interactive) { // predict if (!embd.empty()) { - // Note: n_ctx - 4 here is to match the logic for commandline prompt handling via + // Note: (n_ctx - 4) here is to match the logic for commandline prompt handling via // --prompt or --file which uses the same value. int max_embd_size = n_ctx - 4; @@ -650,6 +650,10 @@ int main(int argc, char ** argv) { n_past += n_eval; LOG("n_past = %d\n", n_past); + // Display total tokens alongside total time + if (n_past % params.token_interval == 0) { + printf("\n\033[31mTokens consumed so far = %d / %d \033[0m\n", n_past, n_ctx); + } } if (!embd.empty() && !path_session.empty()) { |