windows启动langchain-chatglm(v0.1.16版本)详细教程

前提电脑硬件要求:内存:32GB;显卡:rtx 3060,显存 12GB(用cpu加载模型很慢很慢,建议使用cuda)

一、安装Anconda

1.安装教程参考:https://blog.csdn.net/weixin_50083085/article/details/134788906

二、下载 langchain-ChatGLM源码部署

1.可以码云搜索地址下载:https://gitee.com/luolei520/langchain-chatglm.git (我这是v0.1.16版本) 最新版本可去github下载:https://github.com/imClumsyPanda/langchain-ChatGLM
2.下载完成后解压,通过cmd命令进入到文件夹
在这里插入图片描述

在这里插入图片描述
3.通过conda创建虚拟环境并进入虚拟环境(这里创建python为3.10版本名字叫ChatGLM 的虚拟环境)

//conda create -n 虚拟环境名称 python==版本号  
conda create -n ChatGLM python==3.10 
//在langchain-ChatGLM源码文件下启动虚拟环境
conda activate ChatGLM

在这里插入图片描述
4.将pycocotools复制到当前虚拟Python环境中
a.查看虚拟环境python位置

where python

在这里插入图片描述

b.在源码中找到pycocotools2.0.2
在这里插入图片描述
c.将pycocotools2.0.2里面的两个文件夹复制到虚拟环境python里面

在这里插入图片描述
在这里插入图片描述
5.安装其他python第三方库

//使用阿里云进行加速  下载时间较长,需等待一会
pip install   -r requirements.txt  -i https://mirrors.aliyun.com/pypi/simple/

在这里插入图片描述
6.下载torch;可以根据自己的硬件去此网站下载对应的torch:https://download.pytorch.org/whl/torch_stable.html

//torch-2.0.1+cu117-cp310-cp310-win_amd64.whl 解析:torch-版本号 cu117:cuda版本为11.7 cp310:python版本为3.10 win_amd64:表示windows系统64位
//如果报错 可能与当前硬件不匹配,需到此网站找自己硬件对应的版本:https://download.pytorch.org/whl/torch_stable.html
pip install torch==2.0.1+cu117 -f https://download.pytorch.org/whl/torch_stable.html

7.下载模型(我这里embedding_model使用的是:text2vec,llm_model使用的是:chatglm-6b),下载地址: https://openi.pcl.ac.cn/Learning-Develop-Union/LangChain-ChatGLM-Webui/datasets
8.将下载好的模型解压,在源码里面创建model文件夹将模型放里面并建一个空的__init__.py
在这里插入图片描述
在这里插入图片描述

9.修改configs文件夹里面的model_config.py配置文件
a.修改embedding模型存储位置
在这里插入图片描述
b.修改LLM 模型存储位置
在这里插入图片描述
c.修改模型启动设备
在这里插入图片描述
在这里插入图片描述
10.启动项目

python webui.py

在这里插入图片描述
在这里插入图片描述

总结:建议在cuda上跑模型,能避免很多报错

  • 23
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值