OpenBMB / MiniCPM-V

MiniCPM-V 2.6: A GPT-4V Level MLLM for Single Image, Multi Image and Video on Your Phone
Apache License 2.0
11.83k stars 831 forks source link

[BUG] 通过官方提供的llama.cpp转成gguf后,部署到ollama,通过open-webui访问,但不支持图片为什么 #171

Closed kevinchi8781 closed 3 months ago

kevinchi8781 commented 3 months ago

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

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

当前行为 | Current Behavior

微信截图_20240529000624

以下是ModelFile:

FROM ./model-8B-F16.gguf

TEMPLATE """{{ if .System }}<|start_header_id|>system<|end_header_id|>

{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>

{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>

{{ .Response }}<|eot_id|>"""

PARAMETER stop "<|start_header_id|>" PARAMETER stop "<|end_header_id|>" PARAMETER stop "<|eot_id|>" PARAMETER num_keep 4 PARAMETER num_ctx 2048

期望行为 | Expected Behavior

能够通过ollama--open-webui--实现多模态对话

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

4080显卡,win11,ollama

备注 | Anything else?

No response

kevinchi8781 commented 3 months ago

如果用这个地址 https://github.com/OpenBMB/ollama/blob/minicpm-v2.5/examples/minicpm-v2.5/Modelfile 的ModelFILE就会报错

C:\AI\ollama\models\gguf\MiniCPM-Llama3-V-2_5-gguf>ollama create minicpm-v2.5-12 -f Modelfile transferring model data using existing layer sha256:a7a6ce348ebc060ceb8aa973f3b0bad5d3007b7ced23228c0e1aeba59c1fb72f using existing layer sha256:391d11736c3cd24a90417c47b0c88975e86918fcddb1b00494c4d715b08af13e using existing layer sha256:2190828de961641d5a7b034d11c3e34f3a7e91e9ec195309770fb337231cc085 using existing layer sha256:2c527a8fcba5865389ee84c9f4d34ed4bb2370d40da78e7fe27dfb3046793997 creating new layer sha256:0add732133d832b284ea9a7b07d233b3ccbe6c22c71508077f46f906f1e175f5 writing manifest success

C:\AI\ollama\models\gguf\MiniCPM-Llama3-V-2_5-gguf>ollama run minicpm-v2.5-12:latest Error: llama runner process has terminated: exit status 0xc0000409

qkxie commented 3 months ago

一样的问题。无论是ollama还是用open-webui,都无法识别图片

chrischjh commented 3 months ago

这里也在讨论:https://github.com/OpenBMB/MiniCPM-V/issues/97#issuecomment-2137080578

tc-mb commented 3 months ago

一样的问题。无论是ollama还是用open-webui,都无法识别图片

请问一下,确认是通过我们fork出来的ollama代码build并开启server的么? 因为官方的ollama会使用官方llama.cpp的分支,而llama.cpp还没有合并我们的分支。 这导致现在用ollama官方的版本跑我们的模型,虽然是可以跑的。但图像部分是解析不了的,只相当于一个普通的语言模型而已。

tc-mb commented 3 months ago

是否已有关于该错误的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

微信截图_20240529000624

以下是ModelFile:

FROM ./model-8B-F16.gguf

TEMPLATE """{{ if .System }}<|start_header_id|>system<|end_header_id|>

{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>

{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>

{{ .Response }}<|eot_id|>"""

PARAMETER stop "<|start_header_id|>" PARAMETER stop "<|end_header_id|>" PARAMETER stop "<|eot_id|>" PARAMETER num_keep 4 PARAMETER num_ctx 2048

期望行为 | Expected Behavior

能够通过ollama--open-webui--实现多模态对话

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

4080显卡,win11,ollama

备注 | Anything else?

No response

请确认按照这个readme的步骤使用我们fork的ollama及分支 https://github.com/OpenBMB/ollama/blob/minicpm-v2.5/examples/minicpm-v2.5/README.md

qkxie commented 3 months ago

找到原因了。在Modelfile里面,需要同事from 这两个模型:

ggml-model-Q4_K.gguf
mmproj-model-f16.gguf

不能省略mmproj-model-f16.gguf。否则就无法读取图片。

knsew commented 3 months ago

为什么直接从ollama下载的模型也不支持图片识别?

hhao commented 3 months ago

需要重新编译ollama,这里下载的模型可正常运行:https://ollama.com/hhao/openbmb-minicpm-llama3-v-2_5

TonyHuang6666 commented 3 months ago

需要重新编译ollama,这里下载的模型可正常运行:https://ollama.com/hhao/openbmb-minicpm-llama3-v-2_5

你好,我按照你的步骤https://ollama.com/hhao/openbmb-minicpm-llama3-v-2_5:q2_K在WSL的docker中部署了Ollama,可以正常运行你的模型,但是不管是Web UI还是命令行的方式都无法让它分析图片。 2024-06-05_021602 2024-06-05_022816 如图所示,在Web UI中输入图片以后模型并没有运行,在WSL的命令行中无法导入图片。

qkxie commented 3 months ago

@TonyHuang6666

你这个情况我遇到过。根本原因就是这个gguf文件在构建Modelfile的时候,漏掉了另一个模型导致的问题。你需要把mmproj-model-f16.gguf也导入进来,它才能正常读取图片。

image

hhao commented 3 months ago

需要重新编译ollama,这里下载的模型可正常运行:https://ollama.com/hhao/openbmb-minicpm-llama3-v-2_5

你好,我按照你的步骤https://ollama.com/hhao/openbmb-minicpm-llama3-v-2_5:q2_K在WSL的docker中部署了Ollama,可以正常运行你的模型,但是不管是Web UI还是命令行的方式都无法让它分析图片。)

如图所示,在Web UI中输入图片以后模型并没有运行,在WSL的命令行中无法导入图片。

docker exec 是进入到docker镜像里面,镜像里找不到/root/MD.jpg这个路径,解决办法是在本机WSL里装一个客户端:

curl -fsSL https://ollama.com/install.sh | sh
# 在 WSL 里执行,才能找到  /root/MD.jpg
ollama run hhao/openbmb-minicpm-llama3-v-2_5:q2_K
TonyHuang6666 commented 3 months ago

需要重新编译ollama,这里下载的模型可正常运行:https://ollama.com/hhao/openbmb-minicpm-llama3-v-2_5

你好,我按照你的步骤https://ollama.com/hhao/openbmb-minicpm-llama3-v-2_5:q2_K在WSL的docker中部署了Ollama,可以正常运行你的模型,但是不管是Web UI还是命令行的方式都无法让它分析图片。)

如图所示,在Web UI中输入图片以后模型并没有运行,在WSL的命令行中无法导入图片。

docker exec 是进入到docker镜像里面,镜像里找不到/root/MD.jpg这个路径,解决办法是在本机WSL里装一个客户端:

curl -fsSL https://ollama.com/install.sh | sh
# 在 WSL 里执行,才能找到  /root/MD.jpg
ollama run hhao/openbmb-minicpm-llama3-v-2_5:q2_K

感谢大哥指导