fix the bug in conversation template

This commit is contained in:
Deyao Zhu 2023-10-13 15:53:08 +03:00
parent 7b9003dc4d
commit 5b60674e8f

View File

@ -12,6 +12,7 @@ import torch
import html import html
import gradio as gr import gradio as gr
import torchvision.transforms as T
import torch.backends.cudnn as cudnn import torch.backends.cudnn as cudnn
from minigpt4.common.config import Config from minigpt4.common.config import Config
@ -73,7 +74,7 @@ CONV_VISION = Conversation(
messages=[], messages=[],
offset=2, offset=2,
sep_style=SeparatorStyle.SINGLE, sep_style=SeparatorStyle.SINGLE,
sep="</s>", sep="",
) )
@ -474,7 +475,7 @@ def gradio_answer(chatbot, chat_state, img_list, temperature):
def gradio_stream_answer(chatbot, chat_state, img_list, temperature): def gradio_stream_answer(chatbot, chat_state, img_list, temperature):
print('chat state', chat_state) print('chat state', chat_state.get_prompt())
if not isinstance(img_list[0], torch.Tensor): if not isinstance(img_list[0], torch.Tensor):
chat.encode_img(img_list) chat.encode_img(img_list)
streamer = chat.stream_answer(conv=chat_state, streamer = chat.stream_answer(conv=chat_state,