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

系统自动打开浏览器:

做一些简单的交互:

(全文完,谢谢阅读)

相关推荐
梦云澜1 小时前
论文阅读(十二):全基因组关联研究中生物通路的图形建模
论文阅读·人工智能·深度学习
IT古董2 小时前
【深度学习】常见模型-Transformer模型
人工智能·深度学习·transformer
摸鱼仙人~4 小时前
Attention Free Transformer (AFT)-2020论文笔记
论文阅读·深度学习·transformer
python算法(魔法师版)4 小时前
深度学习深度解析:从基础到前沿
人工智能·深度学习
kakaZhui4 小时前
【llm对话系统】大模型源码分析之 LLaMA 位置编码 RoPE
人工智能·深度学习·chatgpt·aigc·llama
struggle20255 小时前
一个开源 GenBI AI 本地代理(确保本地数据安全),使数据驱动型团队能够与其数据进行互动,生成文本到 SQL、图表、电子表格、报告和 BI
人工智能·深度学习·目标检测·语言模型·自然语言处理·数据挖掘·集成学习
davenian8 小时前
DeepSeek-R1 论文. Reinforcement Learning 通过强化学习激励大型语言模型的推理能力
人工智能·深度学习·语言模型·deepseek
CM莫问9 小时前
什么是门控循环单元?
人工智能·pytorch·python·rnn·深度学习·算法·gru
kakaZhui12 小时前
【llm对话系统】大模型 Llama 源码分析之 LoRA 微调
pytorch·深度学习·chatgpt·aigc·llama
eso198312 小时前
深度学习模型在汽车自动驾驶领域的应用
深度学习·自动驾驶·汽车