winglian commited on
Commit
2ba20aa
1 Parent(s): 7be4af1

fix chatml

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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(["User: "+item[0]+"<|end_of_turn|>", "Assistant: "+item[1]+"<|end_of_turn|>"])
37
  for item in history])
38
  # strip the last `<|end_of_turn|>` from the messages
39
- messages = messages.rstrip("<|end_of_turn|>")
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