阿里云安装ChatGLM-6B

1.环境配置

1.1环境要求

服务器最好是境外服务器,不然Github资源下载不稳定。

软件版本
Python3.9.15
pytorch1.12.1-gpu-cu113
cuda11.3.0
ubuntu20.04
1.2 安装CUDA11.3.0
wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run
sudo sh cuda_11.3.0_465.19.01_linux.run
1.3 安装python3.9
#----------------OpenSSL安装----------------
# 下载
wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1s/openssl-1.1.1s.tar.gz
# 解压
tar xvzf openssl-1.1.1s.tar.gz
# 进入目录
cd openssl-1.1.1s/
# 配置
./config  --prefix=/usr/local/openssl-1.1.1s
# 编译安装
make && make install

#----------------Python安装----------------
# 下载
wget https://www.python.org/ftp/python/3.9.15/Python-3.9.15.tgz
# 解压
tar -xzf Python-3.9.15.tgz
# 移动到固定目录
mv  Python-3.9.15 /usr/local/share/
# 进入目录
cd /usr/local/share/Python-3.9.15
# 配置
./configure --prefix=/usr/local/python3.9 --with-openssl=/usr/local/openssl-1.1.1s
# 编译安装
make && make install
# 创建软连接
ln -s /usr/local/python3.9/bin/python3.9 /usr/bin/python3.9
ln -s /usr/local/python3.9/bin/python3.9-config /usr/bin/python3.9-config
# pip使用
python3.9 -m pip xxxxxx
1.4 安装pytorch
python3.9 -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

2.安装ChatGLM-6B

  • web_demo.py文件底部share=True的情况启动,会有出现外部临时链接,外网即可访问。一般是https://xxxxxxxxxxxxxx.gradio.live/
  • 接口访问,启动api.py文件即可,模型路径也需要更改为实际路径
apt-get update
apt-get install git-lfs
git init
git lfs install
# 下载源码
git clone https://github.com/THUDM/ChatGLM-6B.git
# 进入目录
cd ChatGLM-6B
# 创建目录
mkdir model
# 进入目录
cd model
# 下载官方模型文件(比较慢,十几个GB)
git clone https://huggingface.co/THUDM/chatglm-6b
# cd到主目录
cd ..
# 更改web_demo.py的模型文件路径为实际路径,一般在5行6行
THUDM/chatglm-6b更改为model/chatglm-6b
# 启动
python3.9 web_demo.py

3.微调

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值