langchain Chatchat 學習實踐(一)——Windows CPU部署記錄
1、下載langchain Chatchat
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
(可選)如果下載不下來,可能使用了代理,需要設置代理地址:
git config --global http.proxy "localhost:你的代理端口"
之后可以取消代理設置:
git config --global --unset http.proxy
2、安裝anaconda,
添加path環境變量
D:\ProgramData\anaconda3
D:\ProgramData\anaconda3\Scripts
D:\ProgramData\anaconda3\Library\bin
3、安裝VS Code(配置好python插件)
4、使用 VS Code打開項目,創建anaconda虛擬環境:



5、安裝依賴,可以切換國內源
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/
6、下載模型
git lfs install
從modescope下載LLM模型和向量模型,速度快
git clone https://www.modelscope.cn/ZhipuAI/chatglm3-6b.git
git clone https://www.modelscope.cn/AI-ModelScope/bge-large-zh.git
7、執行配置文件拷貝程序
python copy_config_example.py
修改文件配置為本地模型路徑,設置CPU運行方式
8、初始化數據庫
python init_database.py --recreate-vs
正常情況下會出現如下不正常情況:
ModuleNotFoundError: No module named 'pwd'
解決方法:
pip install langchain-community==0.0.19
(關于這一點官方git并沒有進行版本依賴更新,或者說明如何處置。當前版本已經無人維護狀態,他們正把精力投入到下一個大版本中)
9、啟動
python startup.py -a
正常情況下會出現如下不正常情況:
卡在啟動過程不動了
原因是主機性能不足以支撐chatglm6b
解決方法:使用qwen0.5B的模型,或使用帶顯卡的主機,或使用在線模型。若使用在線模型,須安裝對應的SDK,如qwen:pip install dashscope
10、訪問UI頁面,進行測試


浙公網安備 33010602011771號