From 59b2d302c8780ed83e6a0201b741574ee51a1a5e Mon Sep 17 00:00:00 2001 From: xaviviro Date: Thu, 4 Jan 2024 13:03:04 +0100 Subject: [PATCH] Added chatglm3 conversation type for training models like TinyLLama (#1036) * Added chatgml3 conversation type for training models like TinyLLama * Added chatgml3 conversation type for training models like TinyLLama with lint * Added chatgml3 conversation type for training models like TinyLLama with lint --- src/axolotl/monkeypatch/fastchat_conversation_turns.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/axolotl/monkeypatch/fastchat_conversation_turns.py b/src/axolotl/monkeypatch/fastchat_conversation_turns.py index 068261da3..aafdabe54 100644 --- a/src/axolotl/monkeypatch/fastchat_conversation_turns.py +++ b/src/axolotl/monkeypatch/fastchat_conversation_turns.py @@ -147,6 +147,15 @@ def get_turns( # pylint: disable=too-many-return-statements else: yield role + "\n", "" return + if self.sep_style == SeparatorStyle.CHATGLM3: + if self.system_message: + yield "", system_prompt + for role, message in self.messages: + if message: + yield role + "\n", " " + message + else: + yield role + return if self.sep_style == SeparatorStyle.CHATINTERN: # source: https://huggingface.co/internlm/internlm-chat-7b-8k/blob/bd546fa984b4b0b86958f56bf37f94aa75ab8831/modeling_internlm.py#L771 seps = [self.sep, self.sep2]