-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Add chat template for RWKV-World #9968
Conversation
Signed-off-by: Molly Sophia <[email protected]>
Sorry for converting this PR to draft after it's been approved @ggerganov |
Simply exporting the EOS token through the GGUF KV meta data should be enough. Can you point me to a model on HF so I can take a look at the meta data and see what it is missing? |
The model doesn't use EOS token when chatting.
|
Signed-off-by: Molly Sophia <[email protected]>
Signed-off-by: Molly Sophia <[email protected]>
Signed-off-by: Molly Sophia <[email protected]>
I think that old RWKV GGUF models would have to be re-generated after this change. |
Sure, I'll make a contact with people related. |
To be honest, I wouldn't accept models not having a EOS/EOT token token in This template does not have any value for now. It will not compatible with |
I think a EOT token has been added in this PR. This should be okay I guess? |
Hmm ok adding Still not convinced that this is a good way to do, up to you to decide @ggerganov In anyway, I think |
Yes, that makes sense. I've discussed with @BlinkDL about this before. It seems that it's better train the model with special tokens like <|im_start|> in the future. However, current pretrained models tend to use '\n\n' to end a turn of chat. This hack is currently my best solution to this :P |
Yeah I mean it's better not to add these kind of template to Also as this is merged, now some models using this same kind of template, but without proper EOT/EOS, will also be marked as "supported" |
That's a good point too. The matching method for this template is a bit not unique enough. Then I think it's better only keep |
Yes it would be better to leave only Btw, do you have an example of gguf having correct template? I tried this tokenizer_config.json and this gguf but cannot find the template anywhere. |
Okay, I'll open up another PR for this.
May I ask where should this be put?
AFAIK there isn't. There's a chatting example on the hf model page, and the code here is written corresponding to that.
These gguf model are not re-generated yet. For the |
Yeah I just realized, that since there's no existing template here, the matching of template string content has no value XD |
for (auto message : chat) { | ||
std::string role(message->role); | ||
if (role == "user") { | ||
ss << "User: " << message->content << "\n\nAssistant:"; |
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.
But do we need to add a space after Assistant:
? We currently have a space after User:
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.
From what I knew, it's not required according to @BlinkDL 's demo code.
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.
* Add chat template for RWKV-World Signed-off-by: Molly Sophia <[email protected]> * RWKV: Fix the chat template not being used Signed-off-by: Molly Sophia <[email protected]> * RWKV v6: Set EOT token to ``\n\n`` Signed-off-by: Molly Sophia <[email protected]> * readme: add rwkv into supported model list Signed-off-by: Molly Sophia <[email protected]> --------- Signed-off-by: Molly Sophia <[email protected]>
* Add chat template for RWKV-World Signed-off-by: Molly Sophia <[email protected]> * RWKV: Fix the chat template not being used Signed-off-by: Molly Sophia <[email protected]> * RWKV v6: Set EOT token to ``\n\n`` Signed-off-by: Molly Sophia <[email protected]> * readme: add rwkv into supported model list Signed-off-by: Molly Sophia <[email protected]> --------- Signed-off-by: Molly Sophia <[email protected]>
* Add chat template for RWKV-World Signed-off-by: Molly Sophia <[email protected]> * RWKV: Fix the chat template not being used Signed-off-by: Molly Sophia <[email protected]> * RWKV v6: Set EOT token to ``\n\n`` Signed-off-by: Molly Sophia <[email protected]> * readme: add rwkv into supported model list Signed-off-by: Molly Sophia <[email protected]> --------- Signed-off-by: Molly Sophia <[email protected]>
* Add chat template for RWKV-World Signed-off-by: Molly Sophia <[email protected]> * RWKV: Fix the chat template not being used Signed-off-by: Molly Sophia <[email protected]> * RWKV v6: Set EOT token to ``\n\n`` Signed-off-by: Molly Sophia <[email protected]> * readme: add rwkv into supported model list Signed-off-by: Molly Sophia <[email protected]> --------- Signed-off-by: Molly Sophia <[email protected]>
Edit:
Edit2:
Added rwkv-6 into supported model list in README.md, which has been forgotten for some time :D
I have read the contributing guidelines
Self-reported review complexity: