chrisociepa commited on
Commit
219e64a
1 Parent(s): 78e4f96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -71,17 +71,12 @@ def predict(message, history, system_prompt, temperature, max_new_tokens, top_k,
71
  instruction += ' ' + message + ' [/INST]'
72
  elif CHAT_TEMPLATE == "Bielik":
73
  stop_tokens = ["</s>"]
74
- prompt_builder = ["<s>"]
75
- if history:
76
- for human, assistant in history:
77
- if system_prompt:
78
- prompt_builder.append(f"[INST] <<SYS>>\n{system_prompt}\n<</SYS>>\n\n{human} [/INST] {assistant}</s>")
79
- system_prompt = None
80
- else:
81
- prompt_builder.append(f"[INST] {human} [/INST] {assistant}</s>")
82
- prompt_builder.append(f"[INST] {message} [/INST]")
83
- else:
84
- prompt_builder.append(f"[INST] <<SYS>>\n{system_prompt}\n<</SYS>>\n\n{message} [/INST]")
85
  instruction = ''.join(prompt_builder)
86
  else:
87
  raise Exception("Incorrect chat template, select 'ChatML' or 'Mistral Instruct'")
 
71
  instruction += ' ' + message + ' [/INST]'
72
  elif CHAT_TEMPLATE == "Bielik":
73
  stop_tokens = ["</s>"]
74
+ prompt_builder = ["<s>[INST] "]
75
+ if system_prompt:
76
+ prompt_builder.append(f"<<SYS>>\n{system_prompt}\n<</SYS>>\n\n")
77
+ for human, assistant in history:
78
+ prompt_builder.append(f"{human} [/INST] {assistant}</s>[INST] "))
79
+ prompt_builder.append(f"{message} [/INST]")
 
 
 
 
 
80
  instruction = ''.join(prompt_builder)
81
  else:
82
  raise Exception("Incorrect chat template, select 'ChatML' or 'Mistral Instruct'")