QwenLM / Qwen2-VL

Qwen2-VL is the multimodal large language model series developed by Qwen team, Alibaba Cloud.
Apache License 2.0
2.72k stars 157 forks source link

多轮对话 #217

Open wubangcai opened 1 month ago

wubangcai commented 1 month ago

在使用transformer进行模型推理时,多轮对话的messages应该怎么构造?(类似qwen_vl 中history的参数怎么设置)

litao09h commented 1 week ago

是的,缺少多轮demo

THU-Kingmin commented 1 week ago

+1

xiapengchng commented 1 week ago

+1

gxlover0625 commented 6 days ago

我进一步封装了官方代码成为Qwen2VL类,自己实现了chat函数。 用户只需要输入自然语言形式的query,以url、本地路径、base64格式的图片imgs(单图和多图都支持),前文对话history即可,非常简单易用。

使用方式

First turn

history = None response, history = chat_model.chat(query="hello", history=history) print(response, history)

Second turn

For image type, (imgae_url, local_image_path, base64)

For image count, ([image], [image1, image2], ...)

response, history = chat_model.chat(query="please describe the image", imgs=["image_url"], history=history) print(response, history)



# 执行结果
![image](https://github.com/user-attachments/assets/d530d2d1-cf66-45f1-9d39-e582f72a349b)