MiniCPM-V_2.0

        MiniCPM-V   官网

        

        MiniCPM-V-2       模型文件下载   

       算力平台AutoDL

        cpolar官方地址                 

安装

  1. 克隆我们的仓库并跳转到相应目录

git clone https://github.com/OpenBMB/MiniCPM-V.git
cd MiniCPM-V

2. 创建 conda 环境

conda create -n minicpmv2 python=3.10 -y
conda activate minicpmv2

3. 安装依赖

pip install -r requirements.txt -i https://pypi.mirrors.ustc.edu.cn/simple 

pip install gradio==3.40.0 -i https://pypi.mirrors.ustc.edu.cn/simple

python web_demo.py
cpolar http 7071

通过以下链接使用我们的网页端推理服务: OmniLMM-12B | MiniCPM-V 2.0.

推理

模型库

模型简介下载链接
MiniCPM-V 2.0最新版本,提供高效而领先的端侧双语多模态理解能力。🤗    
MiniCPM-V第一版 MiniCPM-V🤗    
OmniLMM-12B性能最强的版本🤗    

多轮对话

请参考以下代码使用 MiniCPM-V 和 OmniLMM 进行推理。

from chat import OmniLMMChat, img2base64

chat_model = OmniLMMChat('openbmb/MiniCPM-V-2') # or 'openbmb/OmniLMM-12B'

im_64 = img2base64('./assets/hk_OCR.jpg')

# First round chat 
msgs = [{"role": "user", "content": "Where should I go to buy a camera?"}]

inputs = {"image": im_64, "question": json.dumps(msgs)}
answer = chat_model.chat(inputs)
print(answer)

# Second round chat 
# pass history context of multi-turn conversation
msgs.append({"role": "assistant", "content": answer})
msgs.append({"role": "user", "content": "Where is this store in the image?"})

inputs = {"image": im_64, "question": json.dumps(msgs)}
answer = chat_model.chat(inputs)
print(answer)

可以得到以下输出:

"You should go to the Canon store for a camera."

"The Canon store is located on the right side of the image."

微调

MiniCPM-V

我们支持使用 SWIFT 框架微调 MiniCPM-V 系列模型。SWIFT 支持近 200 种 LLM 和 MLLM(多模态大模型)的训练、推理、评测和部署。支持 PEFT 提供的轻量训练方案和完整的 Adapters 库支持的最新训练技术如 NEFTune、LoRA+、LLaMA-PRO 等。

参考文档:MiniCPM-VMiniCPM-V-2

在算力平台AutoDL遇到的报错:

root@autodl-container-cffc47b4c5-4a5f97c0:~/tf-logs# conda activate minicpmv2 CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run

需要运行 conda init bash

unzip filename.zip
 

unzip filename.zip -d /path/to/directory
解压文件

ls -lh example.zip
显示文件大小

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山山而川_R

谢谢鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值