AMD显卡部署chatGLM
这篇文档只会记录一些比较重要的步骤和信息,并不会把所有的命令像流水账一样记录。
● 老外整理的,AMD显卡部署Text generation web UI的教程
● Text generation web UI项目地址
https://github.com/oobabooga/text-generation-webui
● github 代理
● chatGLM的模型下载地址
https://huggingface.co/THUDM/chatglm-6b
● AMD显卡驱动下载
https://www.amd.com/zh-hans/support
下载后安装amdgpu-install:
sudo apt install [下载的驱动安装包]
然后用amdgpu-install 安装驱动:
sudo amdgpu-install --no-dkms
接着安装rocm-dev:
sudo amdgpu-install rocm-dev
● 更换pip源为国内的阿里源,提升下载速度
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
更换源之后,使用pip install -r requirements.txt这个指令的时候会报错,因为阿里的源不被信任,需要添加信任,需要改写为:
pip install -r requirements.txt --trusted-host mirrors.aliyun.com
● 编译bitsandbytes的时候,报错fatal error:'cmath' file not found
可以在终端输入:
sudo apt install libstdc++-12-dev
安装了之后,再次编译,这个错误就会消失
● 添加用户到render和video组
请在终端运行以下两条命令并重启
sudo usermod -a -G render $LOGNAME
sudo usermod -a -G video $LOGNAME
● 编写启动脚本
将以下命令复制到文本编辑器,保存为launch.sh,放在text-generation-webUI文件夹下,文件属性设置允许执行文件:
export HSA_OVERRIDE_GFX_VERSION=10.3.0 HCC_AMDGPU_TARGET=gfx1030
source ./venv/bin/activate
python server.py --chat --trust-remote-code --auto-devices