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 '###'