chatglm2-6b本地部署(v0.1)

1.前置工具:安装anaconda,安装cuda/cudnn

2.下载安装包和模型

源码安装包:https://github.com/THUDM/ChatGLM2-6B

模型:https://huggingface.co/models?sort=trending&search=chatglm

3.创建并激活环境

conda create --name ChatGLM2B python==3.8.10

conda activate ChatGLM2B

4.安装pytorch(cudnn为11.7版本)

conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c nvidia

5.进到项目中安装依赖:

pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

6.网页方式启动

执行命令:python web_demo.py

7.其他启动方式

api方式部启动,执行命令: python api.py (需安装pip install fastapi uvicorn)

命令行方式启动,执行命令:python cli_demo.py

参考教程:https://blog.csdn.net/SupermarketX/article/details/131550536

你可能感兴趣的:(chatglm)