-
-
Notifications
You must be signed in to change notification settings - Fork 910
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 support for Gemma chat template #1530
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,14 @@ def get_turns( # pylint: disable=too-many-return-statements | |
else: | ||
yield role, "" | ||
return | ||
if self.sep_style == SeparatorStyle.GEMMA: | ||
if self.system_message: | ||
raise ValueError("Gemma chat template does not support system messages") | ||
for i, (role, message) in enumerate(self.messages): | ||
prefix = "<bos>" if i == 0 else "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a bit confused about this. I don't think you need to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this is Gemma specific, and this function doesn't have access to the tokenizer, I think this is fine for now. in other formats in this function, we have literal " |
||
message_str = message if message else "" | ||
yield prefix + "<start_of_turn>" + role + "\n", message_str + "<end_of_turn>\n" | ||
return | ||
if self.sep_style == SeparatorStyle.CHATGLM: | ||
# source: https://huggingface.co/THUDM/chatglm-6b/blob/1d240ba371910e9282298d4592532d7f0f3e9f3e/modeling_chatglm.py#L1302-L1308 | ||
# source2: https://huggingface.co/THUDM/chatglm2-6b/blob/e186c891cf64310ac66ef10a87e6635fa6c2a579/modeling_chatglm.py#L926 | ||
|
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.
Would it be possible to use a version instead of commit?
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.