From f5c28362d4c39804f41bc5e1873040d42fed1877 Mon Sep 17 00:00:00 2001 From: Deyao Zhu Date: Wed, 19 Apr 2023 10:53:33 +0300 Subject: [PATCH] fix the issue with strange strikethrough output --- minigpt4/conversation/conversation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/minigpt4/conversation/conversation.py b/minigpt4/conversation/conversation.py index 7cd50bb..676d89f 100644 --- a/minigpt4/conversation/conversation.py +++ b/minigpt4/conversation/conversation.py @@ -160,7 +160,9 @@ class Chat: temperature=temperature, ) output_token = outputs[0] - if output_token[0] == 0: + if output_token[0] == 0: # the model might output a unknow token at the beginning. remove it + output_token = output_token[1:] + if output_token[0] == 1: # some users find that there is a start token at the beginning. remove it output_token = output_token[1:] output_text = self.model.llama_tokenizer.decode(output_token, add_special_tokens=False) output_text = output_text.split('###')[0] # remove the stop sign '###'