部署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目录

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 studio 2019\&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,直接下一步就行

  1. 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

  1. 安装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

相关推荐
缘友一世13 小时前
基于LangGraph Cli的智能数据分析助手
langchain·llm·agent·langgraph
老周聊大模型2 天前
LangChain已死?不,是时候重新思考AI工程范式了
人工智能·langchain·mcp
数据智能老司机2 天前
基础图谱增强检索生成(GraphRAG)——智能代理式 RAG
langchain·llm·aigc
deephub2 天前
AI代理性能提升实战:LangChain+LangGraph内存管理与上下文优化完整指南
人工智能·深度学习·神经网络·langchain·大语言模型·rag
都叫我大帅哥3 天前
LangChain分层记忆解决方案:完整案例
python·langchain
alex1003 天前
AI Agent开发学习系列 - langchain之LCEL(5):如何创建一个Agent?
人工智能·python·语言模型·langchain·prompt·向量数据库·ai agent
青Cheng序员石头3 天前
Prompt Engineering vs Vibe Coding vs Context Engineering
langchain·llm·aigc
数据智能老司机3 天前
构建由 LLM 驱动的 Neo4j 应用程序——使用 Neo4j 和 Haystack 实现强大搜索功能
langchain·llm·aigc
都叫我大帅哥4 天前
🚀 LangGraph终极指南:从入门到生产级AI工作流编排
python·langchain
showyoui4 天前
LangChain vs LangGraph:从困惑到清晰的认知之路(扫盲篇)
langchain·ai编程