MiniCPM-V icon indicating copy to clipboard operation
MiniCPM-V copied to clipboard

[BUG] <title>模型只允许一句问题,没有历史消息/上下文

Open JV-X opened this issue 9 months ago • 1 comments

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

  • [x] 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

  • [x] 我已经搜索过FAQ | I have searched FAQ

当前行为 | Current Behavior

我们在测试minicpm-o的时候发现模型不能保存上下文,比如我上一句说了我的名字然后下一句问他我叫什么名字他就说不知道。 我们跟了一下模型的代码,发现代码里写的是只能传一条消息,( MiniCPM-o/models/modeling_minicpmo.py 的 line 1073 ) 不能有多条历史消息,请问我应该如何在模型里加入上下文支持?

期望行为 | Expected Behavior

模型能保存上下文

复现方法 | Steps To Reproduce

根据文档部署模型并对话即可

运行环境 | Environment

- OS: windows11 with wsl2
- Python:
- Transformers:
- PyTorch:
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):

备注 | Anything else?

No response

JV-X avatar Mar 17 '25 01:03 JV-X

这里如果是使用 model.chat 接口的话,需要在传入的 msgs 里包含历史对话信息,streaming 模式在一定上下文长度内会复用 kv-cache,相当于已经记录了上下文

YuzaChongyi avatar May 13 '25 02:05 YuzaChongyi