Spaces:
Runtime error
Runtime error
:boom: [Fix] Missing system message for original mistral models
Browse files
messagers/message_composer.py
CHANGED
@@ -63,12 +63,12 @@ class MessageComposer:
|
|
63 |
# Hello, who are you?<|im_end|>
|
64 |
# <|im_start|>assistant
|
65 |
|
66 |
-
# self.messages = self.concat_messages_by_role(messages)
|
67 |
self.messages = messages
|
68 |
self.merged_str = ""
|
69 |
|
70 |
# https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format
|
71 |
if self.model in ["mixtral-8x7b", "mistral-7b"]:
|
|
|
72 |
self.cached_str = ""
|
73 |
for message in self.messages:
|
74 |
role = message["role"]
|
@@ -96,6 +96,7 @@ class MessageComposer:
|
|
96 |
self.merged_str = "\n".join(self.merged_str_list)
|
97 |
# https://huggingface.co/openchat/openchat-3.5-0106
|
98 |
elif self.model in ["openchat-3.5"]:
|
|
|
99 |
self.merged_str_list = []
|
100 |
self.end_of_turn = "<|end_of_turn|>"
|
101 |
for message in self.messages:
|
@@ -217,8 +218,8 @@ class MessageComposer:
|
|
217 |
|
218 |
|
219 |
if __name__ == "__main__":
|
220 |
-
|
221 |
-
model = "nous-mixtral-8x7b"
|
222 |
composer = MessageComposer(model)
|
223 |
messages = [
|
224 |
{
|
|
|
63 |
# Hello, who are you?<|im_end|>
|
64 |
# <|im_start|>assistant
|
65 |
|
|
|
66 |
self.messages = messages
|
67 |
self.merged_str = ""
|
68 |
|
69 |
# https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format
|
70 |
if self.model in ["mixtral-8x7b", "mistral-7b"]:
|
71 |
+
self.messages = self.concat_messages_by_role(messages)
|
72 |
self.cached_str = ""
|
73 |
for message in self.messages:
|
74 |
role = message["role"]
|
|
|
96 |
self.merged_str = "\n".join(self.merged_str_list)
|
97 |
# https://huggingface.co/openchat/openchat-3.5-0106
|
98 |
elif self.model in ["openchat-3.5"]:
|
99 |
+
self.messages = self.concat_messages_by_role(messages)
|
100 |
self.merged_str_list = []
|
101 |
self.end_of_turn = "<|end_of_turn|>"
|
102 |
for message in self.messages:
|
|
|
218 |
|
219 |
|
220 |
if __name__ == "__main__":
|
221 |
+
model = "mixtral-8x7b"
|
222 |
+
# model = "nous-mixtral-8x7b"
|
223 |
composer = MessageComposer(model)
|
224 |
messages = [
|
225 |
{
|