Prevent double <BOS_TOKEN> with Command R+

This commit is contained in:
oobabooga 2024-04-06 13:12:16 -07:00
parent 1bdceea2d4
commit dd6e4ac55f

View File

@ -125,7 +125,7 @@ def generate_chat_prompt(user_input, state, **kwargs):
messages.append({"role": "user", "content": user_input}) messages.append({"role": "user", "content": user_input})
def remove_extra_bos(prompt): def remove_extra_bos(prompt):
for bos_token in ['<s>', '<|startoftext|>']: for bos_token in ['<s>', '<|startoftext|>', '<BOS_TOKEN>', '<|endoftext|>']:
while prompt.startswith(bos_token): while prompt.startswith(bos_token):
prompt = prompt[len(bos_token):] prompt = prompt[len(bos_token):]