From 07961c1a56920132021e9427c3853219e0eb102d Mon Sep 17 00:00:00 2001 From: Deyao Zhu Date: Sun, 22 Oct 2023 22:29:58 +0300 Subject: [PATCH] fix the demo in conversation template --- minigpt4/models/minigpt_base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/minigpt4/models/minigpt_base.py b/minigpt4/models/minigpt_base.py index 58edb1a..cd051ec 100644 --- a/minigpt4/models/minigpt_base.py +++ b/minigpt4/models/minigpt_base.py @@ -172,12 +172,12 @@ class MiniGPTBase(BaseModel): batch_size = len(conv_q) for batch_idx in range(batch_size): questions, answers = conv_q[batch_idx], conv_a[batch_idx] - questions = [self.llama_tokenizer(q, + questions = [self.llama_tokenizer(self.llama_tokenizer.bos_token + q, return_tensors="pt", add_special_tokens=False).to(self.device) for q in questions[1:]] # the first question is handled in the prompt wrap function, skip it - answers = [self.llama_tokenizer(q, - return_tensors="pt", - add_special_tokens=False).to(self.device) for q in answers] + answers = [self.llama_tokenizer(a + self.end_sym, + return_tensors="pt", + add_special_tokens=False).to(self.device) for a in answers] cur_id = [] cur_target = [] for i in range(len(questions)):