仓库地址

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


根据仓库里面的readme.md的快速上手进行安装

https://github.com/chatchat-space/Langchain-Chatchat#快速上手


models的获取

使用国内镜像进行获取

https://aliendao.cn/models/THUDM/chatglm2-6b

https://aliendao.cn/models/moka-ai/m3e-base


这个只能一个个文件进行下载,还不能同时下载多个,有点麻烦


接着修改configs/model_config.py中的MODEL_ROOT_PATH

MODEL_ROOT_PATH = "D:/Test/models"


执行启动,会有一些错误

$ python startup.py -a

错误1:AttributeError: 'ChatGLMTokenizer' object has no attribute 'tokenizer'

原因是transformers版本不对,需要安装4.33.2

 pip uninstall transformers
 pip install transformers==4.33.2

错误2:OSError: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory D:\Test\models\THUDM\chatglm2-6b.

原因,model文件没有下载完全


错误3:OSError: D:\Test\models\chatglm2-6b does not appear to have a file named configuration_chatglm.py. Checkout 'https://huggingface.co/D:\Test\models\chatglm2-6b/main' for available files.

这里有点奇怪,原来的model路径是D:\Test\models\THUDM\chatglm2-6b,但是上面的路径是D:\Test\models\chatglm2-6b,所以我把chatglm2-6b文件夹放到上层文件夹,然后就可以了

为了保险起见,将m3e-base 也放到上层文件夹


启动起来后,会自动打开主界面,但是有一点问题,响应速度很慢,问一句话,要等十几秒才能回答,且是一点一点出来

查看了下,cpu的占比90%,gpu才3%,这里不知道如何使用gpu