大模型部署手记(2)baichuan2+Windows GPU

1.简介

组织机构:百川智能(前搜狗CEO王小川创立)

代码仓:GitHub - baichuan-inc/Baichuan2: A series of large language models developed by Baichuan Intelligent Technology

模型:baichuan-inc/Baichuan2-7B-Chat-4bits

下载:https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat-4bits

镜像下载:https://aliendao.cn/models/baichuan-inc/Baichuan2-7B-Chat-4bits

硬件环境:暗影精灵7Plus

Windows版本:Windows 11家庭中文版 Insider Preview 22H2

内存 32G

GPU显卡:Nvidia GTX 3080 Laptop (16G)

参考资料:https://zhuanlan.zhihu.com/p/658999248

2.代码和模型下载

下载代码仓:

git clone GitHub - baichuan-inc/Baichuan2: A series of large language models developed by Baichuan Intelligent Technology

打开 https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat-4bits 下载模型

并将其拷贝到 d:\Baichuan2\baichuan-inc\Baichuan2-7B-Chat-4bits 目录

3.安装依赖

创建conda环境

conda create -n baichuan2 python=3.10

conda activate baichuan2

cd Baichuan2

安装量化包:

pip install bitsandbytes --prefer-binary --extra-index-url=https://jllllll.github.io/bitsandbytes-windows-webui

安装Pytorch 2.0.1 for CUDA

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

安装加速包:

pip install xformers

将代码 cli_demo.py 改成4bit量化的模型:

d:

cd d:\Baichuan2

pip install -r requirements.txt

4.部署验证

运行命令行模式:

python cli_demo.py

做一些简单的交互:

修改web_demo.py文件:

运行网页模式:

python web_demo.py

这里好像哪里不对,但是系统提示可以使用streamlit运行:

streamlit run web_demo.py

系统自动打开浏览器:

做一些简单的交互:

(全文完,谢谢阅读)

相关推荐
谦行3 分钟前
工欲善其事,必先利其器—— PyTorch 深度学习基础操作
pytorch·深度学习·ai编程
xwz小王子31 分钟前
Nature Communications 面向形状可编程磁性软材料的数据驱动设计方法—基于随机设计探索与神经网络的协同优化框架
深度学习
生信碱移2 小时前
大语言模型时代,单细胞注释也需要集思广益(mLLMCelltype)
人工智能·经验分享·深度学习·语言模型·自然语言处理·数据挖掘·数据可视化
硅谷秋水2 小时前
通过模仿学习实现机器人灵巧操作:综述(上)
人工智能·深度学习·机器学习·计算机视觉·语言模型·机器人
开心快乐幸福一家人2 小时前
Spark-SQL与Hive集成及数据分析实践
人工智能·pytorch·深度学习
小宋加油啊3 小时前
深度学习小记(包括pytorch 还有一些神经网络架构)
pytorch·深度学习·神经网络
沛沛老爹3 小时前
从线性到非线性:简单聊聊神经网络的常见三大激活函数
人工智能·深度学习·神经网络·激活函数·relu·sigmoid·tanh
何大春4 小时前
【视频时刻检索】Text-Video Retrieval via Multi-Modal Hypergraph Networks 论文阅读
论文阅读·深度学习·神经网络·计算机视觉·视觉检测·论文笔记
旧故新长4 小时前
支持Function Call的本地ollama模型对比评测-》开发代理agent
人工智能·深度学习·机器学习
微学AI5 小时前
融合注意力机制和BiGRU的电力领域发电量预测项目研究,并给出相关代码
人工智能·深度学习·自然语言处理·注意力机制·bigru