-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Add alpaca chat template (repush of #7383) #8159
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In any cases, having
\n\n
after system message makes more sense to me. Could we delete the template fordeepseek
below and move it here?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.
I think it might give people the impression that they are the same prompt though when actually they are quite different:
deepseek-coder
requires anEOS
token (and a non-default<|EOT|>
vs</s>
one!) and from the two models I tested that can use multi-turn alpaca; it seems adding anEOS
token like</s>
confuses them quite badly (AFAIK, it's the only template like this).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.
If you look in the previous PR that I closed accidentally, then there are some examples of
phind-codellama
getting very confused when I tried to use theEOS
token.I am unsure how people use alpaca for creative writing, but am going to try it over the weekend using mikupad, which seems to have forgotten to add any
EOS
tokens to any of their prompts (but nobody seems to have noticed or cared, and the models seem to have been writing fiction fine!?).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.
Probably we can also patch
llama_chat_apply_template_internal
to take the EOS as an input (can be read fromllama_model
). Since this function is used internally, we can change the signature whenever we want.Do you think that will be a better solution?
That sounds to me like a bit of mess when the world moving from single-turn to multi-turn template 1 year ago. Back then, no one care about putting EOS after model's response because we can match stop sequence (
### User:
). In fact, for this reason, I was skeptical to add alpaca template in the first place, since some models are trained solely with single-turn dataset.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.
It may be worth looking at the model files of the few genuine multiturn Alpaca models to see if they even have a EOS token defined. Sadly it was the now deleted "wizard" models that mainly used this but some of the early "meta" models and
phind-codellama
also used it.The mikupad devs just fixed all their templates after I pointed this out.