Spaces:
Build error
Build error
sort out mappings
Browse files
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 |
-
|
32 |
-
response = tokenizer.decode(
|
|
|
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)
|