Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,13 +97,18 @@ def respond(message, chat_history):
|
|
97 |
|
98 |
|
99 |
|
100 |
-
|
101 |
|
102 |
-
context.append({'role':'user', 'content':f"{
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
#tokenized_chat = tokenizer.apply_chat_template(context, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
105 |
|
106 |
-
bot_message = model.generate(
|
107 |
|
108 |
#bot_message = tokenizer.decode(outputs[0]).split("<|assistant|>")[-1].replace("</s>","")
|
109 |
|
|
|
97 |
|
98 |
|
99 |
|
100 |
+
|
101 |
|
102 |
+
context.append({'role':'user', 'content':f"{message}"})
|
103 |
+
|
104 |
+
prompt = ""
|
105 |
+
for item in context:
|
106 |
+
for key, value in item.items():
|
107 |
+
prompt += f"{key}: {value}\n"
|
108 |
|
109 |
#tokenized_chat = tokenizer.apply_chat_template(context, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
110 |
|
111 |
+
bot_message = model.generate(prompt, temp=0.5, top_k = 40, top_p = 1, max_tokens = max_new_tokens)
|
112 |
|
113 |
#bot_message = tokenizer.decode(outputs[0]).split("<|assistant|>")[-1].replace("</s>","")
|
114 |
|