Tonic commited on
Commit
01d3cc0
1 Parent(s): c30f436

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -23,7 +23,7 @@ class ChatBot:
23
  new_user_input_ids = tokenizer.encode(input + tokenizer.eos_token, return_tensors="pt")
24
  flat_history = [item for sublist in self.history for item in sublist]
25
  flat_history_tensor = torch.tensor(flat_history).unsqueeze(dim=0)
26
- bot_input_ids = torch.cat([flat_history_tensor, new_user_input_ids], dim=-1) if self history else new_user_input_ids
27
  chat_history_ids = model.generate(bot_input_ids, max_length=2000, pad_token_id=tokenizer.eos_token_id)
28
  self.history.append(chat_history_ids[:, bot_input_ids.shape[-1]:].tolist()[0])
29
  response = tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)
 
23
  new_user_input_ids = tokenizer.encode(input + tokenizer.eos_token, return_tensors="pt")
24
  flat_history = [item for sublist in self.history for item in sublist]
25
  flat_history_tensor = torch.tensor(flat_history).unsqueeze(dim=0)
26
+ bot_input_ids = torch.cat([flat_history_tensor, new_user_input_ids], dim=-1) if self.history else new_user_input_ids
27
  chat_history_ids = model.generate(bot_input_ids, max_length=2000, pad_token_id=tokenizer.eos_token_id)
28
  self.history.append(chat_history_ids[:, bot_input_ids.shape[-1]:].tolist()[0])
29
  response = tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)