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
Count system prompt tokens #850
Conversation
There're some errors with some models I think 👀 |
The reason being is that: https://huggingface.co/meta-llama/Llama-2-70b-chat-hf is a gated model. Therefore, the tokenizer code from frontend tries to grab the files but it is gated. For now, the behaviour is that: if the model is not gated, the token count is shown. If it is gated, nothing appears. Wwe have two poaaiblities:
wdyt ? |
af36fcc
to
79ea91f
Compare
799bb52
to
9b134a0
Compare
handled it. Only the one error gets thrown in this case |
Just don't do it on llama-2? (as its gated it will never work) maybe it could be in the config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it works it seems to work well, but I sometimes get console errors when switching between different models in the settings without reloading the page? But if I reload the page the tokenization works again. Not sure what is causing it
Yes trying to reproduce that too 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work on local models with chat-ui. I would probably set an explicit key in the config for models that are compatible.
This reverts commit 61c0a22.
Updates:Added string - which would be used in transfomer.js AutoTokenizer
OR
{
tokenizerUrl: string;
tokenizerConfigUrl: string;
} - which would be used to construct transfomer.js PreTrainedTokenizer See Fixed reactivity issues mentioned aboveEditing model system promptsScreen.Recording.2024-03-19.at.12.21.00.PM.movCreating assistnatScreen.Recording.2024-03-19.at.12.08.24.PM.movEditing assistnatScreen.Recording.2024-03-19.at.12.20.18.PM.mov |
classNames="absolute bottom-2 right-2" | ||
prompt={systemPrompt} | ||
modelTokenizer={model.tokenizer} | ||
max_new_tokens={model?.parameters?.max_new_tokens} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use truncate
value instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handled in f47c6bb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works quite well! 🔥
On updating model settings:
On updating assitants settings: