From 23f94f559a406da69a9f67f615c78f2713ad3697 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 22 Jan 2023 00:35:42 -0300 Subject: [PATCH] Improve the chat prompt design --- server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server.py b/server.py index 695f31d6..d8dc7921 100644 --- a/server.py +++ b/server.py @@ -258,7 +258,7 @@ if args.chat or args.cai_chat: while i >= 0 and len(encode(''.join(rows), tokens)[0]) < 2048-tokens: rows.insert(1, f"{name2}: {history[i][1].strip()}\n") 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") count += 1 i -= 1 @@ -272,7 +272,6 @@ if args.chat or args.cai_chat: rows.pop(1) question = ''.join(rows) - question = question.replace('<|BEGIN-VISIBLE-CHAT|>', '') return question def remove_example_dialogue_from_history(history):