Staticaliza commited on
Commit
2a52702
1 Parent(s): f4d0a63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -8,13 +8,14 @@ API_TOKEN = os.environ.get("API_TOKEN")
8
 
9
  KEY = os.environ.get("KEY")
10
 
11
- SPECIAL_SYMBOLS = ["", ""] # ["‹", "›"] ['"', '"']
 
12
 
13
  DEFAULT_INPUT = "User: Hi!"
14
  DEFAULT_WRAP = "Statical: %s"
15
  DEFAULT_INSTRUCTION = "Statical is a helpful chatbot who is communicating with people."
16
 
17
- DEFAULT_STOPS = '["", "⠀"]' # '["‹", "›"]' '[\"\\\"\"]'
18
 
19
  API_ENDPOINTS = {
20
  "Falcon": "tiiuae/falcon-180B-chat",
@@ -34,10 +35,11 @@ for model_name, model_endpoint in API_ENDPOINTS.items():
34
  CLIENTS[model_name] = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {API_TOKEN}" })
35
 
36
  def format(instruction, history, input, wrap):
37
- sy_l, sy_r = SPECIAL_SYMBOLS[0], SPECIAL_SYMBOLS[1]
 
38
  wrapped_input = wrap % ("")
39
- formatted_history = "".join(f"{sy_l}{message[0]}{sy_r}\n{sy_l}{message[1]}{sy_r}\n" for message in history)
40
- formatted_input = f"{sy_l}{instruction}{sy_r}\n{formatted_history}{sy_l}{input}{sy_r}\n{sy_l}"
41
  return f"{formatted_input}{wrapped_input}", formatted_input
42
 
43
  def predict(access_key, instruction, history, input, wrap, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):
 
8
 
9
  KEY = os.environ.get("KEY")
10
 
11
+ SPECIAL_SYMBOLS_AI = ["", ""]
12
+ SPECIAL_SYMBOLS_USER = ["⠀", "⠀"] # ["‹", "›"] ['"', '"']
13
 
14
  DEFAULT_INPUT = "User: Hi!"
15
  DEFAULT_WRAP = "Statical: %s"
16
  DEFAULT_INSTRUCTION = "Statical is a helpful chatbot who is communicating with people."
17
 
18
+ DEFAULT_STOPS = '["", "⠀"]' # '["‹", "›"]' '[\"\\\"\"]'
19
 
20
  API_ENDPOINTS = {
21
  "Falcon": "tiiuae/falcon-180B-chat",
 
35
  CLIENTS[model_name] = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {API_TOKEN}" })
36
 
37
  def format(instruction, history, input, wrap):
38
+ sy_la, sy_ra = SPECIAL_SYMBOLS_AI[0], SPECIAL_SYMBOLS_AI[1]
39
+ sy_l, sy_r = SPECIAL_SYMBOLS_USER[0], SPECIAL_SYMBOLS_USER[1]
40
  wrapped_input = wrap % ("")
41
+ formatted_history = "".join(f"{sy_l}{message[0]}{sy_r}{sy_la}{message[1]}{sy_la}" for message in history)
42
+ formatted_input = f"{sy_l}{instruction}{sy_r}{formatted_history}{sy_l}{input}{sy_r}{sy_la}"
43
  return f"{formatted_input}{wrapped_input}", formatted_input
44
 
45
  def predict(access_key, instruction, history, input, wrap, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):