Ubuntu 部署ChatGLM3-6B模型

部署环境

云服务器配置32C256G GPU:v100
操作系统 :Ubuntu22.04
CUDA版本:12.2

安装驱动

sudo ubuntu-drivers autoinstall

安装anaconda

anaconda官网下载安装包

anaconda下载链接Anaconda3-2024.02-1-Linux-x86_64.sh
选择正确的版本进行下载,本次选择Linux版本下载,得到Anaconda3-2024.02-1-Linux-x86_64.sh文件

#因为我这里创建好了/root/anaconda3的目录,所以加了-u参数
sh Anaconda3-2024.02-1-Linux-x86_64.sh -u
yes
yes

按照流程安装后,要重新进入命令行,才生效

配置conda参数

# 配置conda环境
conda config --show channels
conda config --remove channels defaults
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

#配置conda 环境
conda create -n chatglm3-6b python=3.10
conda activate chatglm3-6b

安装pytorch

pytorch版本选择链接

在这里插入图片描述

conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

下载模型代码及模型权重

# 下载ChatGLM3代码
git clone https://github.com/THUDM/ChatGLM3.git

# 下载git lfs 
git lfs install 
# 如果上述git 命令不支持请安装git-lfs
apt install git-lfs

在这里插入图片描述

# 下载模型文件,这一步比较久
# 由于国内无法访问hugging face 所以这里用model scope
git clone https://www.modelscope.cn/ZhipuAI/chatglm3-6b-128k.git

运行模型

修改basic_demo 中的cli_demo.py,指定特定的大模型文件

在这里插入图片描述
···
pip install -r requirement.txt
···

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值