Improve the chat prompt design

This commit is contained in:
oobabooga 2023-01-22 00:35:42 -03:00
parent 139e2f0ab4
commit 23f94f559a

View File

@ -258,7 +258,7 @@ if args.chat or args.cai_chat:
while i >= 0 and len(encode(''.join(rows), tokens)[0]) < 2048-tokens: while i >= 0 and len(encode(''.join(rows), tokens)[0]) < 2048-tokens:
rows.insert(1, f"{name2}: {history[i][1].strip()}\n") rows.insert(1, f"{name2}: {history[i][1].strip()}\n")
count += 1 count += 1
if not (i == 0 and len(history[i][0]) == 0): if not (history[i][0] == '<|BEGIN-VISIBLE-CHAT|>'):
rows.insert(1, f"{name1}: {history[i][0].strip()}\n") rows.insert(1, f"{name1}: {history[i][0].strip()}\n")
count += 1 count += 1
i -= 1 i -= 1
@ -272,7 +272,6 @@ if args.chat or args.cai_chat:
rows.pop(1) rows.pop(1)
question = ''.join(rows) question = ''.join(rows)
question = question.replace('<|BEGIN-VISIBLE-CHAT|>', '')
return question return question
def remove_example_dialogue_from_history(history): def remove_example_dialogue_from_history(history):