From 38028f588172dc7126075ab84730b8bebf7541d1 Mon Sep 17 00:00:00 2001 From: Baize Date: Sat, 1 Apr 2023 13:45:09 +0000 Subject: [PATCH] Update app_modules/utils.py --- app_modules/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app_modules/utils.py b/app_modules/utils.py index c34e261..0a0453d 100644 --- a/app_modules/utils.py +++ b/app_modules/utils.py @@ -131,6 +131,7 @@ def detect_language(code): return language, code_without_language def convert_to_markdown(text): + text = text.replace("$","$") def replace_leading_tabs_and_spaces(line): new_line = [] @@ -287,7 +288,7 @@ def greedy_search(input_ids: torch.Tensor, return def generate_prompt_with_history(text,history,tokenizer,max_length=2048): - 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?" + 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!" history = ["\n[|Human|]{}\n[|AI|]{}".format(x[0],x[1]) for x in history] history.append("\n[|Human|]{}\n[|AI|]".format(text)) history_text = ""