ecyht2 commited on
Commit
bddf825
1 Parent(s): bcec825

fix: Fixed prompt format

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -18,10 +18,10 @@ def format_prompt(message, history):
18
  logging.debug("Input Message: %s", message)
19
  logging.debug("Input History: %s", history)
20
 
21
- prompt = "<|im_start|>system\n" +\
22
- "You are Dolphin, a helpful AI assistant.<|im_end|>"
23
- prompt += "<|im_start|>user\n" + f"{message}<|im_end|>"
24
- prompt += "<|im_start|>assistant"
25
 
26
  return prompt
27
 
@@ -29,6 +29,7 @@ def format_prompt(message, history):
29
  def generate(
30
  prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
31
  ):
 
32
  logging.info("Generating Response")
33
  logging.debug("Input Prompt: %s", prompt)
34
  logging.debug("Input History: %s", history)
 
18
  logging.debug("Input Message: %s", message)
19
  logging.debug("Input History: %s", history)
20
 
21
+ for user_prompt, bot_response in history:
22
+ prompt += f"<s> [INST] {user_prompt} [/INST]"
23
+ prompt += f" {bot_response}</s> "
24
+ prompt += f"[INST] {message} [/INST]"
25
 
26
  return prompt
27
 
 
29
  def generate(
30
  prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
31
  ):
32
+ """Generates the text based on user prompt."""
33
  logging.info("Generating Response")
34
  logging.debug("Input Prompt: %s", prompt)
35
  logging.debug("Input History: %s", history)