YC-Chen commited on
Commit
88c05b4
1 Parent(s): 7eddd34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -100,6 +100,17 @@ with gr.Blocks() as demo:
100
 
101
 
102
  def bot(history, max_new_tokens, temperature, top_p, top_k, system_prompt):
 
 
 
 
 
 
 
 
 
 
 
103
  data = {
104
  "model": MODEL_NAME,
105
  "messages": str(message),
 
100
 
101
 
102
  def bot(history, max_new_tokens, temperature, top_p, top_k, system_prompt):
103
+ chat_data = []
104
+ for user_msg, assistant_msg in history:
105
+ chat_data += [
106
+ {"role": "user", user_msg},
107
+ {"role": "assistant", "content": assistant_msg},
108
+ ]
109
+ message = tokenizer.apply_chat_template(chat, tokenize=False)
110
+ message = message[3:] # remove SOT token
111
+
112
+ print(message)
113
+
114
  data = {
115
  "model": MODEL_NAME,
116
  "messages": str(message),