artificialguybr commited on
Commit
42883b5
1 Parent(s): 7b7334f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
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
- # Criar o chat template
35
- prompt_template=f'''<|im_start|>system
36
- {system_message}<|im_end|>
37
- <|im_start|>user
38
- {prompt}<|im_end|>
39
- <|im_start|>assistant
 
 
 
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