nikravan commited on
Commit
a2f9117
·
verified ·
1 Parent(s): 90c63d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -55,11 +55,11 @@ latex_delimiters_set = [{
55
  def predict(message, history, system_prompt, temperature, max_new_tokens, top_k, repetition_penalty, top_p):
56
  # Format history with a given chat template
57
 
58
- stop_tokens = [tokenizer.eos_token_id]
59
- instruction = system_prompt + "\n\n"
60
  for user, assistant in history:
61
- instruction += f"role:user, content: {user}\nrole:assistant, content: {assistant}\n"
62
- instruction += f"role:user, content: {message}\nassistant:"
63
 
64
  print(instruction)
65
 
 
55
  def predict(message, history, system_prompt, temperature, max_new_tokens, top_k, repetition_penalty, top_p):
56
  # Format history with a given chat template
57
 
58
+ stop_tokens = ["<|endoftext|>", "<|im_end|>"]
59
+ instruction = '<|im_start|>system\n' + system_prompt + '\n<|im_end|>\n'
60
  for user, assistant in history:
61
+ instruction += f'<|im_start|>user\n{user}\n<|im_end|>\n<|im_start|>assistant\n{assistant}\n<|im_end|>\n'
62
+ instruction += f'<|im_start|>user\n{message}\n<|im_end|>\n<|im_start|>assistant\n'
63
 
64
  print(instruction)
65