-
-
Notifications
You must be signed in to change notification settings - Fork 945
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 bos_token
and add_generation_prompt
to the alpaca chat template
#2322
base: main
Are you sure you want to change the base?
Conversation
bos_token
and add_generation_prompt
to the alpaca chat template
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.
Thanks for catching that!
That template would still have issues. It can't handle system turns, and also leaves
This template would fix those. Due to the way the original alpaca format handles system prompts, I've limited it to only having a system prompt on the first turn. {{ bos_token }}{% for message in messages %}{% if message['role'] == 'system' and loop.first %}{{ message['content'] }}{% elif message['role'] == 'user' %}{{ '### Instruction:\n' + message['content'] }}{% elif message['role'] == 'assistant' %}{{ '### Response:\n' + message['content'] + eos_token }}{% endif %}{% if not loop.last %}{{ '\n\n' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '\n\n### Response:\n' }}{% endif %}
|
Co-authored-by: xzuyn <xzuyn@users.noreply.github.com>
Please review the changes and proceed with merging..! .cc @NanoCode012 |
Since we're adding an eos_token as well to separate turns (along others), let me think this through as we're modifying a common template. |
Description
Fixes and resolves issues with the alpaca template used when using the axolotl inference feature.
AS-IS
TO-BE
Motivation and Context
How has this been tested?
Screenshots (if appropriate)
Types of changes
Social Handles (Optional)
discord: minpeter