From dd6e4ac55f3235c6728bf849618cc5841bd11028 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 6 Apr 2024 13:12:16 -0700 Subject: [PATCH] Prevent double with Command R+ --- modules/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index 5fb5523c..4e0bde1c 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -125,7 +125,7 @@ def generate_chat_prompt(user_input, state, **kwargs): messages.append({"role": "user", "content": user_input}) def remove_extra_bos(prompt): - for bos_token in ['', '<|startoftext|>']: + for bos_token in ['', '<|startoftext|>', '', '<|endoftext|>']: while prompt.startswith(bos_token): prompt = prompt[len(bos_token):]