project-baize commited on
Commit
38028f5
1 Parent(s): b80d9fe

Update app_modules/utils.py

Browse files
Files changed (1) hide show
  1. app_modules/utils.py +2 -1
app_modules/utils.py CHANGED
@@ -131,6 +131,7 @@ def detect_language(code):
131
  return language, code_without_language
132
 
133
  def convert_to_markdown(text):
 
134
  def replace_leading_tabs_and_spaces(line):
135
  new_line = []
136
 
@@ -287,7 +288,7 @@ def greedy_search(input_ids: torch.Tensor,
287
  return
288
 
289
  def generate_prompt_with_history(text,history,tokenizer,max_length=2048):
290
- prompt = "The following is a conversation between a human and an AI assistant named Baize (named after a mythical creature in Chinese folklore). Baize is an open-source AI assistant developed by UCSD and Sun Yat-Sen University. The human and the AI assistant take turns chatting. Human statements start with [|Human|] and AI assistant statements start with [|AI|]. The AI assistant always replies in Markdown format. The AI assistant (Baize) always declines to engage with topics, questions, or requests related to unethical, controversial, or sensitive issues. Complete the transcript in exactly that format.\n[|Human|]Hello!\n[|AI|]Hi! How can I help you?"
291
  history = ["\n[|Human|]{}\n[|AI|]{}".format(x[0],x[1]) for x in history]
292
  history.append("\n[|Human|]{}\n[|AI|]".format(text))
293
  history_text = ""
 
131
  return language, code_without_language
132
 
133
  def convert_to_markdown(text):
134
+ text = text.replace("$","$")
135
  def replace_leading_tabs_and_spaces(line):
136
  new_line = []
137
 
 
288
  return
289
 
290
  def generate_prompt_with_history(text,history,tokenizer,max_length=2048):
291
+ prompt = "The following is a conversation between a human and an AI assistant named Baize (named after a mythical creature in Chinese folklore). Baize is an open-source AI assistant developed by UCSD and Sun Yat-Sen University. The human and the AI assistant take turns chatting. Human statements start with [|Human|] and AI assistant statements start with [|AI|]. The AI assistant always provides responses in as much detail as possible, and in Markdown format. The AI assistant always declines to engage with topics, questions and instructions related to unethical, controversial, or sensitive issues. Complete the transcript in exactly that format.\n[|Human|]Hello!\n[|AI|]Hi!"
292
  history = ["\n[|Human|]{}\n[|AI|]{}".format(x[0],x[1]) for x in history]
293
  history.append("\n[|Human|]{}\n[|AI|]".format(text))
294
  history_text = ""