nikravan commited on
Commit
1e98994
·
verified ·
1 Parent(s): 4a4974d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -55,11 +55,17 @@ 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 = ["<|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
 
 
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
  stop_tokens = ["<|endoftext|>", "<|im_end|>"]
65
+ instruction = 'system\n' + system_prompt + '\n'
66
  for user, assistant in history:
67
+ instruction += f'user\n{user}\nassistant\n{assistant}\n'
68
+ instruction += f'user\n{message}\nassistant\n'
69
 
70
  print(instruction)
71