windows10 使用Langchain-Chatchat运行模型

环境ROG魔霸3060显卡

内存16G

CUDA版本11.6

步骤1:创建python隔离环境

conda create -n chat python=3.10

步骤2:进入虚拟环境
conda activate chat 

步骤3:

conda install pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 pytorch-cuda=11.6 -c pytorch -c nvidia

步骤4:下载框架

git clone https://github.com/chatchat-space/Langchain-Chatchat.git

步骤6:修改框架

requirements.txt #torch==2.1.2 因为这个是cpu版本不需要

步骤7:下载模型

git clone https://www.modelscope.cn/AI-ModelScope/bge-large-zh-v1.5.git

git clone https://www.modelscope.cn/ZhipuAI/ChatGLM-6B-Int4.git

步骤8:安装依赖

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -r requirements_api.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -r requirements_webui.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/

额外加一个pip install cpm_kernels

步骤9:运行

python copy_config_example.py

步骤10:打开config文件夹修改model_config.py

EMBEDDING_DEVICE = "cuda"

LLM_DEVICE = "cuda"

LLM_MODELS = ["chatglm3-6b"]

"bge-large-zh-v1.5": "E:\\bge-large-zh-v1.5",

"chatglm3-6b": "E:\\chatglm2-6b-int4",

步骤11:初始化向量库

python init_database.py --recreate-vs

运行前再次检查

python -c "import torch; print(torch.cuda.is_available())" # 查看GPU是否可用

python -c "import torch; print(torch.cuda.device_count())" # 查看GPU数量

python -c "import torch; print(torch.cuda.get_device_name(0))" # 根据索引号得到GPU名称

如果还是匹配考虑离线安装

pip install torch-1.13.0+cu116-cp310-cp310-win_amd64.whl

下载地址:

Index of /anaconda/cloud/pytorch/win-64/ | 清华大学开源软件镜像站 | Tsinghua Open Source MirrorIndex of /anaconda/cloud/pytorch/win-64/ | 清华大学开源软件镜像站,致力于为国内和校内用户提供高质量的开源软件镜像、Linux 镜像源服务,帮助用户更方便地获取开源软件。本镜像站由清华大学 TUNA 协会负责运行维护。icon-default.png?t=N7T8https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/

步骤11:启动

python startup.py -a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值