-
-
Notifications
You must be signed in to change notification settings - Fork 871
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
fixing prompt template of chatml by removal of linebreak #922
Conversation
Could you provide an example with before and after using |
I think the difference is that there's just an extra token 13. @winglian seems like you made <|im_start|> and <|im_end|> to be special tokens, can you provide me some pointers on how did you do that in axolotl? |
You can add them to # bos/eos/pad/unk
special_tokens:
# others
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.
I noticed this a while back but forgot about it. I think this is a good fix for this silent bug.
Is axolotl robust enough to deal with the extra tokens in the vocabulary? For example, |
yes, it handles it correctly. Are you asking specifically about LoRA? (in which case you need to manually specify the lm_head and embed_tokens layers as |
just notice this, for the last few tokens (ending):
why is there a token id 28705 there? Any clues? |
…cloud#922) Co-authored-by: Timothy Lim <timothyyonglee.lim@kxrdev.com>
The following change seems to fix the double EOS token: register_conv_template( |
Resolves the double EOS token issue at the end of prompts when using Chatml template with shareGPT.py. axolotl-ai-cloud#922 (comment)
@noobmaster29 what happen to your PR? |
Someone on Discord mentioned that the change did not solve the issue of double EOS tokens. I have not had time to replicate it yet but I will try to look at it tomorrow. |
It may be caused by dataset cache. Though the code is changed to |
Could you try a fresh process and see if it still produces double EOS and new line characters? |
Resolves the double EOS token issue at the end of prompts when using Chatml template with shareGPT.py. axolotl-ai-cloud#922 (comment)
reference to discord chat:
"""
hi <@208256080092856321> , went through the code step-by-step and found that there's an extra linebreak ('\n') in the separator of ChatML so the separator will end up having two linebreaks . You can see it here: https://github.com/OpenAccess-AI-Collective/axolotl/blob/a581e9f8f66e14c22ec914ee792dd4fe073e62f6/src/axolotl/prompt_strategies/sharegpt.py#L16 and https://github.com/OpenAccess-AI-Collective/axolotl/blob/a48dbf6561cc74c275a48070f397334a2c367dd5/src/axolotl/monkeypatch/fastchat_conversation_turns.py#L117 . A typical silent killer of prompt template for those not aware but the model is most probably robust enough to still reply coherently since it's just a linebreak.
"""