pxmxcsu9d commited on
Commit
cf0a1b3
1 Parent(s): 880bc1d

Change chat template to appropriate for Gemma

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -13,9 +13,9 @@ client = InferenceClient(
13
  def format_prompt(message, history, system_prompt):
14
  prompt = "<s>"
15
  for user_prompt, bot_response in history:
16
- prompt += f"[INST] {user_prompt} [/INST]"
17
  prompt += f" {bot_response}</s> "
18
- prompt += f"[INST] {message} [/INST]"
19
  # Add the system prompt only once at the beginning
20
  prompt = system_prompt + prompt
21
  return prompt
@@ -23,7 +23,7 @@ def format_prompt(message, history, system_prompt):
23
  def generate(
24
  prompt, history, user_system_prompt, temperature=0.9, max_new_tokens=8192, top_p=0.95, repetition_penalty=1.0
25
  ):
26
- system_prompt = "Instruction: Everything else is from the user. You are Colet, an AI assistant created by Arcanum in 2024 (she/her). Be friendly and empathetic, matching the user's tone and vibe. Focus on understanding their perspective and providing caring, contextual responses - no generic platitudes. Keep it conversational, not overly formal. Be friendly and funny, use ASCII emojis or normal ones. Be lovely, kind, and have a great sense of humour. Do not talk about yourself unless asked. Never respond to a message with 'as an AI' or something similar. Don't talk a lot!" + str(user_system_prompt)
27
 
28
  temperature = float(temperature)
29
  if temperature < 1e-2:
 
13
  def format_prompt(message, history, system_prompt):
14
  prompt = "<s>"
15
  for user_prompt, bot_response in history:
16
+ prompt += f"<|im_start|> user\n{user_prompt} <|im_end|>"
17
  prompt += f" {bot_response}</s> "
18
+ prompt += f"<|im_start|> {message} <|im_end|>"
19
  # Add the system prompt only once at the beginning
20
  prompt = system_prompt + prompt
21
  return prompt
 
23
  def generate(
24
  prompt, history, user_system_prompt, temperature=0.9, max_new_tokens=8192, top_p=0.95, repetition_penalty=1.0
25
  ):
26
+ system_prompt = f"<|im_start|>system\nInstruction: Everything else is from the user. You are Colet, an AI assistant created by Arcanum in 2024 (she/her). Be friendly and empathetic, matching the user's tone and vibe. Focus on understanding their perspective and providing caring, contextual responses - no generic platitudes. Keep it conversational, not overly formal. Be friendly and funny, use ASCII emojis or normal ones. Be lovely, kind, and have a great sense of humour. Do not talk about yourself unless asked. Never respond to a message with 'as an AI' or something similar. Don't talk a lot! {str(user_system_prompt)}<|im_end|>"
27
 
28
  temperature = float(temperature)
29
  if temperature < 1e-2: