-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Server: fallback to chatml, add AlphaMonarch chat template #5628
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
Server: fallback to chatml, add AlphaMonarch chat template #5628
Conversation
@infozzdatalabs Can you please check this out if possible? Thank you! |
I think it's great that it warns in case it doesn't match with any available one, until now it was trial and error without knowing it at all. It would be amazing if I could directly use a template that is not hardcoded, taking it from the model's built-in, but this solves many problems already, thanks a lot! |
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.
Thank you for looking into this and fixing!
But there 2 things still missing IMO:
- For each new template we must add a test in
tests/test-chat-template.cpp
- We should not validate the model's template if a custom template is provided
Thanks to both of you @ngxson @ggerganov for fixing this so fast. Edit: I searched inside #5593 files and found that is a string. |
@ggerganov Bien vu! I've fixed that on the 2 commits above. For the test, before, I only check if output contains a pre-defined string (I was quite lazy to deal with @infozzdatalabs Yeah you need to input a string as argument. I suspect that it doesn't work in your case because the template contains special characters that are reserved by shell language (brackets |
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.
Awesome 🦙
…#5628) * server: fallback to chatml * add new chat template * server: add AlphaMonarch to test chat template * server: only check model template if there is no custom tmpl * remove TODO
…#5628) * server: fallback to chatml * add new chat template * server: add AlphaMonarch to test chat template * server: only check model template if there is no custom tmpl * remove TODO
Closes #5627
Fix server crash if the template is not supported
If the template is not supported, we will now see an error in the log. The server will still work, but fallback to chatml template.
Add new template
New template added: https://huggingface.co/mlabonne/AlphaMonarch-7B/blob/main/tokenizer_config.json#L36
The new template is also updated in the research: #5527
Example for the formatted prompt:
{"timestamp":1708510304,"level":"VERBOSE","function":"format_chat","line":208,"message":"formatted_chat","text":"system\nYou are a helpful assistant.</s>\n<s>user\nhi, how are you</s>\n<s>assistant\n"}