Update README.md
Browse files
README.md
CHANGED
@@ -55,27 +55,18 @@ for step in range(100):
|
|
55 |
chat_history.append("A: " + user_input)
|
56 |
while len(chat_history) > 5:
|
57 |
chat_history.pop(0)
|
58 |
-
# print(chat_history)
|
59 |
hist = ""
|
60 |
for chat in chat_history:
|
61 |
hist += "\n" + chat
|
62 |
hist += "\nB: "
|
63 |
-
# print("====", len(chat_history))
|
64 |
-
# print("===>", hist.replace("\n", " / "))
|
65 |
-
# print("----")
|
66 |
-
# encode the new user input, add the eos_token and return a tensor in Pytorch
|
67 |
new_user_input_ids = tokenizer.encode(hist, return_tensors='pt')
|
68 |
-
# print(new_user_input_ids)
|
69 |
|
70 |
-
# append the new user input tokens to the chat history
|
71 |
-
#bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids
|
72 |
bot_input_ids = new_user_input_ids
|
73 |
|
74 |
# generated a response while limiting the total chat history to 1000 tokens,
|
75 |
chat_history_ids = model.generate(
|
76 |
bot_input_ids, max_length=200,
|
77 |
pad_token_id=tokenizer.eos_token_id,
|
78 |
-
#no_repeat_ngram_size=3,
|
79 |
do_sample=True,
|
80 |
#top_k=100,
|
81 |
#top_p=0.7,
|
|
|
55 |
chat_history.append("A: " + user_input)
|
56 |
while len(chat_history) > 5:
|
57 |
chat_history.pop(0)
|
|
|
58 |
hist = ""
|
59 |
for chat in chat_history:
|
60 |
hist += "\n" + chat
|
61 |
hist += "\nB: "
|
|
|
|
|
|
|
|
|
62 |
new_user_input_ids = tokenizer.encode(hist, return_tensors='pt')
|
|
|
63 |
|
|
|
|
|
64 |
bot_input_ids = new_user_input_ids
|
65 |
|
66 |
# generated a response while limiting the total chat history to 1000 tokens,
|
67 |
chat_history_ids = model.generate(
|
68 |
bot_input_ids, max_length=200,
|
69 |
pad_token_id=tokenizer.eos_token_id,
|
|
|
70 |
do_sample=True,
|
71 |
#top_k=100,
|
72 |
#top_p=0.7,
|