大模型部署手记(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

系统自动打开浏览器:

做一些简单的交互:

(全文完,谢谢阅读)

相关推荐
ziwu2 小时前
植物病害识别系统Python+卷积神经网络算法+图像识别+人工智能项目+深度学习项目+计算机课设项目+Django网页界面
人工智能·深度学习·图像识别
大耳朵爱学习6 小时前
掌握Transformer之注意力为什么有效
人工智能·深度学习·自然语言处理·大模型·llm·transformer·大语言模型
qq_15321452646 小时前
【2023工业异常检测文献】SimpleNet
图像处理·人工智能·深度学习·神经网络·机器学习·计算机视觉·视觉检测
B站计算机毕业设计超人8 小时前
计算机毕业设计Python+Flask微博情感分析 微博舆情预测 微博爬虫 微博大数据 舆情分析系统 大数据毕业设计 NLP文本分类 机器学习 深度学习 AI
爬虫·python·深度学习·算法·机器学习·自然语言处理·数据可视化
羊小猪~~8 小时前
深度学习基础案例5--VGG16人脸识别(体验学习的痛苦与乐趣)
人工智能·python·深度学习·学习·算法·机器学习·cnn
AI大模型知识分享12 小时前
Prompt最佳实践|如何用参考文本让ChatGPT答案更精准?
人工智能·深度学习·机器学习·chatgpt·prompt·gpt-3
小言从不摸鱼14 小时前
【AI大模型】ChatGPT模型原理介绍(下)
人工智能·python·深度学习·机器学习·自然语言处理·chatgpt
酱香编程,风雨兼程18 小时前
深度学习——基础知识
人工智能·深度学习
#include<菜鸡>18 小时前
动手学深度学习(pytorch土堆)-04torchvision中数据集的使用
人工智能·pytorch·深度学习
拓端研究室TRL19 小时前
TensorFlow深度学习框架改进K-means聚类、SOM自组织映射算法及上海招生政策影响分析研究...
深度学习·算法·tensorflow·kmeans·聚类