部署langchain+chatglm

先参考:window零基础部署langchain-ChatGLM_飞奔的屎壳郎的博客-CSDN博客

安装一部分, 

1.GCC安装
gcc64位下载
一定要装64位的gcc,因为我的电脑是w10 64位的,装32位运行langchain报错并配置环境变量
可直接用压缩包中的文件:x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z
软件下载地址:https://sourceforge.net/projects/mingw-w64/files/

安装后解压,然后将bin目录配置到path目录

image.png
gcc64安装验证
gcc -v

2.Visual Studio 2019安装
可直接用压缩包的文件:vs_community__studio2019.exe
官方下载地址:https://visualstudio.microsoft.com/zh-hans/vs/older-downloads/
2019版下载链接,社区版就够用了:https://my.visualstudio.com/Downloads?q=visual%20studio%202019&wt.mc_id=omsftvscom~older-downloads

 注意,需要选择C++开发模块,其余默认,其它根据自己的需求安装就好了,安装路径可以默认,也可以根据自己情况更改一下,然后点击安装就好了,后面都是自动安装了,因为需要在线下载东西,过程有点长,耐心等待一下~~

3.Anaconda安装
可直接用压缩包中的文件:Anaconda3-2023.03-0-Windows-x86_64.exe

下载安装
下载地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

安装的时候选择所有all users,直接下一步就行

4. CUDA安装
安装CUDA11.7
参考https://blog.csdn.net/chen565884393/article/details/127905428

下载安装包
可直接用压缩包的文件:cuda_11.7.1_516.94_windows.exe

下载CUDA,根据自己的配置选择,win10还是win11安装包
下载地址:https://developer.nvidia.com/cuda-11-7-1-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local

检查命令:nvcc -V

6. 安装CUDNN
下载CUDNN
可直接用压缩包的文件:cudnn-windows-x86_64-8.5.0.96_cuda11-archive.zip
下载安装包,在NVIDIA官方网站即可下载,地址为:https://developer.nvidia.com/rdp/cudnn-archive

把这CUDNN中三个文件夹的文件分别拷贝到CUDA安装目录对应的(bin、include、lib)文件夹中即可。CUDA的lib目录有x64 、Win32、cmake三个文件夹,拷到其中的x64这个文件夹中

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\x64

 torch_stable
下载地址:https://download.pytorch.org/whl/torch_stable.html
下载torch==2.0.1+cu117,可以观察到cu117/torch-2.0.1有很多的版本,cp38对应python3.8,win_amd64对应windows的64位操作系统,根据自己的实际情况进行下载即可。 (+cu117表示CUDA10.1,+cpu表示CPU版本)
 

chatglm_langchain_demo

#Setup envirnment

conda create -n langchain python=3.10 -channel  http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

conda activate langchain

# 拉取仓库

git clone https://github.com/imClumsyPanda/langchain-ChatGLM.git

# 安装依赖

cd langchain-ChatGLM

python3 -m pip install -r requirements.txt

python3 -m pip install gradio==3.28.3

python3 -m pip install tabulate

#Download models

git lfs install   #此句我没写

git clone https://huggingface.co/THUDM/chatglm-6b-int4

git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese

python3 webui.py

成功

【langchain_chatglm问中级职称评定】 https://www.bilibili.com/video/BV1GW4y1Z7wu/?share_source=copy_web&vd_source=159f872f790f3f11c2991f350622f681

猜你喜欢

转载自blog.csdn.net/WASEFADG/article/details/131712662