nugentc commited on
Commit
0ef0e83
·
1 Parent(s): 9bc6c2f

sort out mappings

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -28,8 +28,9 @@ def chat(message, history=[]):
28
  else:
29
  print("HERE WE GO! ", new_user_input_ids)
30
  bot_input_ids = new_user_input_ids
31
- response_ids = model.generate(bot_input_ids, max_length=500, pad_token_id=tokenizer.eos_token_id)
32
- response = tokenizer.decode(response_ids).replace("<|endoftext|>", "")
 
33
  bot_input_ids = torch.cat([bot_input_ids, response_ids], dim=-1)
34
  history.push((message, response, bot_input_ids))
35
  return response, history, feedback(message)
 
28
  else:
29
  print("HERE WE GO! ", new_user_input_ids)
30
  bot_input_ids = new_user_input_ids
31
+ chat_history_ids = model.generate(bot_input_ids, max_length=500, pad_token_id=tokenizer.eos_token_id)
32
+ response = tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)
33
+ # response = tokenizer.decode(response_ids).replace("<|endoftext|>", "")
34
  bot_input_ids = torch.cat([bot_input_ids, response_ids], dim=-1)
35
  history.push((message, response, bot_input_ids))
36
  return response, history, feedback(message)