Spaces:
Runtime error
Runtime error
artificialguybr
commited on
Commit
•
42883b5
1
Parent(s):
7b7334f
Update app.py
Browse files
app.py
CHANGED
@@ -31,13 +31,17 @@ def user(message, history):
|
|
31 |
def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
|
32 |
history = history or []
|
33 |
|
34 |
-
#
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
40 |
'''
|
|
|
41 |
# Preparando o input
|
42 |
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids # .cuda() se você estiver usando GPU
|
43 |
|
|
|
31 |
def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
|
32 |
history = history or []
|
33 |
|
34 |
+
# A última mensagem do usuário
|
35 |
+
user_prompt = history[-1][0]
|
36 |
+
|
37 |
+
# Definindo o template e o prompt
|
38 |
+
prompt_template = f'''system
|
39 |
+
{system_message.strip()}
|
40 |
+
user
|
41 |
+
{user_prompt}
|
42 |
+
assistant
|
43 |
'''
|
44 |
+
|
45 |
# Preparando o input
|
46 |
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids # .cuda() se você estiver usando GPU
|
47 |
|