entfane commited on
Commit
fbfce85
·
verified ·
1 Parent(s): 0bef60a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -25,11 +25,10 @@ def analyze(user_message, assistant_reply):
25
  {"role": "assistant", "content": assistant_reply},
26
  ]
27
 
28
- input_ids = tokenizer.apply_chat_template(
29
- messages, tokenize=True, return_tensors="pt"
30
- ).to(DEVICE)
31
 
32
- tokens = tokenizer.convert_ids_to_tokens(input_ids[0])
33
 
34
  with torch.no_grad():
35
  _, _, values = model(input_ids)
 
25
  {"role": "assistant", "content": assistant_reply},
26
  ]
27
 
28
+ text = tokenizer.apply_chat_template(messages, tokenize=False)
29
+ input_ids = tokenizer(text, return_tensors="pt").input_ids.to(DEVICE)
 
30
 
31
+ tokens = tokenizer.convert_ids_to_tokens(input_ids[0].tolist())
32
 
33
  with torch.no_grad():
34
  _, _, values = model(input_ids)