阿里云安装ChatGLM-6B

本文详细介绍了如何在阿里云环境中配置机器学习平台PAI,包括安装CUDA11.3.0、Python3.9、PyTorch1.12.1以及ChatGLM-6B模型。此外,还提到了使用境外服务器以确保稳定下载GitHub资源,以及微调ChatGLM-6B模型的步骤。
摘要由CSDN通过智能技术生成

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
    评论
根据引用\[1\]和引用\[2\]的信息,ChatGLM-6B-INT4和ChatGLM-6B是两个不同的模型ChatGLM-6B-INT4是ChatGLM-6B模型的一个变种,它使用了INT4量化技术,可以在保持相对较高的模型性能的同时,减少模型的存储空间和计算资源需求。因此,ChatGLM-6B-INT4相对于ChatGLM-6B来说,具有更小的模型体积和更高的推理效率。 #### 引用[.reference_title] - *1* [ChatGLM-6B-INT4部署](https://blog.csdn.net/weixin_43890157/article/details/131614431)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [本地部署 ChatGLM-6B](https://blog.csdn.net/engchina/article/details/130527699)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [【ChatGLM】使用ChatGLM-6B-INT4模型进行P-Tunning训练记录及参数讲解](https://blog.csdn.net/sinat_14840559/article/details/131124471)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值