fix chatml
Browse files
app.py
CHANGED
@@ -33,10 +33,10 @@ def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetit
|
|
33 |
history = history or []
|
34 |
|
35 |
messages = BASE_SYSTEM_MESSAGE + system_message.strip() + "\n" + \
|
36 |
-
"\n".join(["\n".join(["
|
37 |
for item in history])
|
38 |
# strip the last `<|end_of_turn|>` from the messages
|
39 |
-
messages = messages.rstrip("<|
|
40 |
# remove last space from assistant, some models output a ZWSP if you leave a space
|
41 |
messages = messages.rstrip()
|
42 |
|
|
|
33 |
history = history or []
|
34 |
|
35 |
messages = BASE_SYSTEM_MESSAGE + system_message.strip() + "\n" + \
|
36 |
+
"\n".join(["\n".join(["<|im_start|>"+"user\n"+item[0]+"<|im_end|>", "<|im_start|>assistant\n"+item[1]+"<|im_end|>"])
|
37 |
for item in history])
|
38 |
# strip the last `<|end_of_turn|>` from the messages
|
39 |
+
messages = messages.rstrip("<|im_end|>")
|
40 |
# remove last space from assistant, some models output a ZWSP if you leave a space
|
41 |
messages = messages.rstrip()
|
42 |
|