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
This commit is contained in:
parent
2f043328e3
commit
43f76bf1c3
4 changed files with 15 additions and 3 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue