cppowboy commited on
Commit
508a16b
1 Parent(s): 6fcf8b4

Update tokenization_minicpm.py

Browse files
Files changed (1) hide show
  1. tokenization_minicpm.py +2 -0
tokenization_minicpm.py CHANGED
@@ -366,6 +366,8 @@ func2(params)
366
  tools_string = ""
367
 
368
  if add_to_system:
 
 
369
  return [message_format(msg, system_suffix=tools_string, user_prefix="") for msg in messages]
370
  else:
371
  return [message_format(msg, system_suffix="", user_prefix=tools_string) for msg in messages]
 
366
  tools_string = ""
367
 
368
  if add_to_system:
369
+ if len(messages) > 0 and messages[0]["role"] != "system":
370
+ messages.insert(0, {"role": "system", "content": ""})
371
  return [message_format(msg, system_suffix=tools_string, user_prefix="") for msg in messages]
372
  else:
373
  return [message_format(msg, system_suffix="", user_prefix=tools_string) for msg in messages]