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

系统自动打开浏览器:

做一些简单的交互:

(全文完,谢谢阅读)

相关推荐
手写码匠16 分钟前
华为云Flexus+DeepSeek征文|Dify 多 Agent 评测实战:用 DeepSeek-R1 当裁判,打造多智能体系统的自动化质量保障体系
人工智能·深度学习·算法·aigc
汽车仪器仪表相关领域20 分钟前
SIRIUS R1DB/R2DB便携式一体化数据采集系统
大数据·人工智能·功能测试·深度学习·压力测试
头发够用的程序员1 小时前
Nsight Systems 零基础入门:Trace采集与基础操作
人工智能·深度学习·神经网络·计算机视觉·边缘计算·分析工具
云和数据.ChenGuang11 小时前
fastapi的参数剖析
人工智能·深度学习·机器学习·语言模型·状态模式·fastapi
goodlook012312 小时前
LLaMa factory 大模型高效微调(二)
人工智能·深度学习·llama
Chasing__Dreams13 小时前
大模型应用开发--6--Transformer架构介绍
深度学习·架构·transformer
147API13 小时前
蒸馏模型版本升级怎么做,权重、评测器和服务配置一起管
人工智能·深度学习·蒸馏·模型蒸馏
chen_zn9519 小时前
《VLA 系列》π0.5 + KI | 知识隔离 | 离散与连续动作联合训练 | 论文与源码解析
人工智能·深度学习·注意力机制·vla
EasyGBS20 小时前
告别“通用AI”的三大痛点:国标GB28181公网平台EasyGBS+DLTM让企业拥有专属AI安防大脑
人工智能·深度学习·机器学习
就是一顿骚操作21 小时前
VGG:用小卷积块把 CNN 做深的经典解读
人工智能·深度学习·神经网络·cnn·论文解读