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

系统自动打开浏览器:

做一些简单的交互:

(全文完,谢谢阅读)

相关推荐
Sonhhxg_柒3 小时前
【LLM】DeepAgents实战教程及DeepResearch代码分析
人工智能·深度学习·语言模型
网上邻居YY4 小时前
深度学习DL 之 安装PyTorch·GPU版、CUDA(本人Anaconda、Python、PyCharm已提前安装好)
pytorch·经验分享·python·深度学习·pycharm·学习方法
源码之屋4 小时前
计算机毕业设计:Python天气数据采集与可视化分析平台 Django框架 线性回归 数据分析 大数据 机器学习 大模型 气象数据(建议收藏)✅
人工智能·python·深度学习·算法·django·线性回归·课程设计
bryant_meng4 小时前
【Reading Notes】(8.11)Favorite Articles from 2025 November
人工智能·深度学习·业界资讯
Spliceㅤ4 小时前
Transformer
人工智能·深度学习·transformer
杀生丸学AI4 小时前
【4DGS】4C4D:4个摄像头4DGS成像
人工智能·深度学习·三维重建·3dgs·4dgs·动态重建·高斯溅射
盼小辉丶4 小时前
PyTorch实战(41)——Hugging Face在PyTorch中的应用
人工智能·pytorch·深度学习·hugging face
宝贝儿好4 小时前
【LLM】第一章:分词算法BPE、WordPiece、Unigram、分词工具jieba
人工智能·python·深度学习·神经网络·算法·语言模型·自然语言处理
青瓷程序设计4 小时前
基于深度学习的【猫类识别系统】~Python+深度学习+人工智能+算法模型+2026原创+计算机毕设
人工智能·python·深度学习
渡我白衣4 小时前
运筹帷幄——在线学习与实时预测系统
人工智能·深度学习·神经网络·学习·算法·机器学习·caffe