Tonic commited on
Commit
51db12e
·
1 Parent(s): 616a905

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -21,7 +21,6 @@ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
21
  model = transformers.AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_8bit=True)
22
 
23
  class OrcaChatBot:
24
- # Code below from [microsoft/ari9dam](https://huggingface.co/spaces/ari9dam/Orca-2-13B)
25
  def __init__(self, model, tokenizer, system_message="You are Orca, an AI language model created by Microsoft. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior."):
26
  self.model = model
27
  self.tokenizer = tokenizer
@@ -38,6 +37,8 @@ class OrcaChatBot:
38
  for role, message in self.conversation_history:
39
  if message.strip():
40
  prompt += f"<|im_start|>{role}\n{message}<|im_end|>\n"
 
 
41
  prompt += "<|im_start|> assistant\n"
42
  return prompt
43
 
 
21
  model = transformers.AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_8bit=True)
22
 
23
  class OrcaChatBot:
 
24
  def __init__(self, model, tokenizer, system_message="You are Orca, an AI language model created by Microsoft. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior."):
25
  self.model = model
26
  self.tokenizer = tokenizer
 
37
  for role, message in self.conversation_history:
38
  if message.strip():
39
  prompt += f"<|im_start|>{role}\n{message}<|im_end|>\n"
40
+ if role == "assistant":
41
+ prompt += f"{self.tokenizer.eos_token}\n" # Add EOS token after assistant's messages
42
  prompt += "<|im_start|> assistant\n"
43
  return prompt
44