当前位置: 首页 > news >正文

MiniCPM-Llama3-V-2_5-int4

MiniCPM-Llama3-V-2_5-int4大模型部署使用环境:

python3.8+cuda11.8其它要求,按照安装文档要求下载即可

我是在算力平台用4090跑的, GPU 显存(8GB)可以部署推理 int4 量化版本,如果推理非量化版本需要更高显存

        MiniCPM-V        仓库文件下载

        openbmb/MiniCPM-Llama3-V-2_5-int4             模型文件下载

        MiniCPM-Llama3-V-2_5                                    非量化模型文件地址

        

        AutoDL算力平台   

        cpolar官方地址     

        MiniCPM-V-2.5                                                   部署应用等

在算力平台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


显示文件大小

ls -lh example.zip
df -h /root/autodl-tmp
tar -xvf 

解压rar文件

# 更新包列表
sudo apt-get update# 安装 unrar
sudo apt-get install unrar# 解压 MiniCPM-Llama3-V-2_5-int4.rar
unrar x MiniCPM-Llama3-V-2_5-int4.rar# 查看解压后的文件
ls -l
unrar x xxx.rar
unrar x

查看磁盘空间大小

df -h /dev/sda1

安装

  1. 克隆我们的仓库并跳转到相应目录
git clone https://github.com/OpenBMB/MiniCPM-V.git
cd MiniCPM-V

2. 创建 conda 环境

conda create -n minicpmv2.5 python=3.8 -y
conda activate minicpmv2.5

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

下载模型文件

git clone https://www.modelscope.cn/OpenBMB/MiniCPM-Llama3-V-2_5-int4.git

参考以下代码进行推理

from chat import OmniLMMChat, img2base64
torch.manual_seed(0)chat_model = OmniLMMChat('openbmb/MiniCPM-Llama3-V-2_5')im_64 = img2base64('./assets/airplane.jpeg')# First round chat 
msgs = [{"role": "user", "content": "Tell me the model of this aircraft."}]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": "Introduce something about Airbus A380."})inputs = {"image": im_64, "question": json.dumps(msgs)}
answer = chat_model.chat(inputs)
print(answer)

python web_demo_2.5.py

以下是做内网穿透需要安装的(如只是部署自己电脑或使用其它方式进入公网则不需要如下)

2.1 安装cpolar

在Ubuntu上打开终端,执行命令

首先,我们需要安装curl:

sudo apt-get install curl | sudo bash
  • 国内安装(支持一键自动安装脚本)
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash

2.2 正常显示版本号即安装成功

cpolar version

2.3 token认证

登录cpolar官网后台,点击左侧的验证,查看自己的认证token,之后将token贴在命令行里

cpolar authtoken xxxxxxx

2.4 简单穿透测试一下

cpolar http 8080

2.5 将cpolar配置为后台服务并开机自启动

sudo systemctl enable cpolar

2.6 启动服务

sudo systemctl start cpolar

2.7 查看服务状态

sudo systemctl status cpolar

正常显示为active,为正常在线状态

http://www.lryc.cn/news/354010.html

相关文章:

  • 压缩能力登顶 小丸工具箱 V1.0 绿色便携版
  • 电子电器架构 - 车载网管功能简介
  • 路由配置总结
  • 从零起航,Python编程全攻略
  • 正运动视觉与运动一体机小课堂----三分钟系列
  • 微信小程序如何跳转微信公众号
  • vi和vim编辑器
  • 纯电动汽车硬件在环测试
  • Flutter 中的 ClipRect 小部件:全面指南
  • 【LeetCode】【209】长度最小的子数组(1488字)
  • 1738. 找出第 K 大的异或坐标值
  • Fortran: stdlib标准库
  • CSS3优秀动画代码示例
  • 嵌入式0基础开始学习 ⅠC语言(4)循环结构
  • 【JAVASE】抽象类
  • 嵌入式硬件中PCB走线与过孔的电流承载能力分析
  • 动态规划之背包问题中如何确定遍历顺序的问题-组合or排列?
  • 开源大模型与闭源大模型
  • python+selenium - UI自动框架之封装查找元素
  • java 拦截器-用户无操作超时退出利用Redis
  • 民国漫画杂志《时代漫画》第16期.PDF
  • 线程池以及日志类的实现
  • 基于长短期记忆网络 LSTM 的送餐时间预测
  • K-means聚类算法详细介绍
  • SAP FS00如何导出会计总账科目表
  • ROS参数服务器
  • QCC---DFU升级变更设备名和地址
  • [力扣题解] 695. 岛屿的最大面积
  • AI模型发展路径探析:开源与闭源,何者更胜一筹?
  • concurrency 并行编程