adding llama3 fastchat conversation monkeypatch (#1539)
Browse files* adding llama3 fastchat conversation monkeypatch
* Updated conversation turns to work with PR3259 of FastChat
* fixed bos token
* bump fastchat version
---------
Co-authored-by: Wing Lian <[email protected]>
requirements.txt
CHANGED
|
@@ -28,7 +28,7 @@ scipy
|
|
| 28 |
scikit-learn==1.2.2
|
| 29 |
pynvml
|
| 30 |
art
|
| 31 |
-
fschat @ git+https://github.com/lm-sys/FastChat.git@
|
| 32 |
gradio==3.50.2
|
| 33 |
tensorboard
|
| 34 |
|
|
|
|
| 28 |
scikit-learn==1.2.2
|
| 29 |
pynvml
|
| 30 |
art
|
| 31 |
+
fschat @ git+https://github.com/lm-sys/FastChat.git@27a05b04a35510afb1d767ae7e5990cbd278f8fe
|
| 32 |
gradio==3.50.2
|
| 33 |
tensorboard
|
| 34 |
|
src/axolotl/monkeypatch/fastchat_conversation_turns.py
CHANGED
|
@@ -123,6 +123,17 @@ def get_turns( # pylint: disable=too-many-return-statements
|
|
| 123 |
else:
|
| 124 |
yield role, ""
|
| 125 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
if self.sep_style == SeparatorStyle.GEMMA:
|
| 127 |
if self.system_message:
|
| 128 |
raise ValueError("Gemma chat template does not support system messages")
|
|
|
|
| 123 |
else:
|
| 124 |
yield role, ""
|
| 125 |
return
|
| 126 |
+
if self.sep_style == SeparatorStyle.LLAMA3:
|
| 127 |
+
if self.system_message:
|
| 128 |
+
# For llama3, the system message is NOT incorporated into the first human instruction
|
| 129 |
+
# All messages follow <|start_header_id|>' + role + '<|end_header_id|>\n\n'+ message + '<|eot_id|>
|
| 130 |
+
yield "", system_prompt
|
| 131 |
+
for i, (role, message) in enumerate(self.messages):
|
| 132 |
+
if message:
|
| 133 |
+
yield f"<|start_header_id|>{role}<|end_header_id|>\n\n", f"{message.strip()}<|eot_id|>"
|
| 134 |
+
else:
|
| 135 |
+
yield f"<|start_header_id|>{role}<|end_header_id|>\n\n", ""
|
| 136 |
+
return
|
| 137 |
if self.sep_style == SeparatorStyle.GEMMA:
|
| 138 |
if self.system_message:
|
| 139 |
raise ValueError("Gemma chat template does not support system messages")
|