Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Persistent Context Token Counts #68

Merged
merged 3 commits into from
Jun 1, 2024

Conversation

neCo2
Copy link
Contributor

@neCo2 neCo2 commented May 25, 2024

Removed all the useless stuff from #62, now it just gives you a little token count display next to the title of the text field/at the bottom right of the modals. There's also a table in the context modal showing all token counts.

firefox_2024-05-25_11-52-48
firefox_2024-05-25_11-52-59

@lmg-anon
Copy link
Owner

lmg-anon commented Jun 1, 2024

lgtm! Thank you for the contribution!

Removed all the useless stuff from #62

That wasn't actually 100% useless; we do need a more accurate implementation of something like "n_keep" in Mikupad. Using "n_keep" is one way to do it, but I guess it would be better if we could do something like:

  • Tokenize the memory tokens (including WI).
  • Tokenize the prompt.
  • Truncate the prompt tokens to the context length minus the memory tokens count.
  • Join the memory tokens and prompt tokens as the new prompt.
  • Detokenize the new prompt (or just send the already tokenized prompt if possible).

However, I guess some endpoints don't support detokenization (like Koboldcpp), or prompts as tokens (like Koboldcpp), so this may not be feasible, and in this case we would be forced to use "n_keep".

@lmg-anon lmg-anon merged commit 9278fff into lmg-anon:main Jun 1, 2024
@neCo2 neCo2 deleted the persistent-context-token-counts branch June 1, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants