从零开始学ChatGLM3-6b大模型在 本地平台的部署推理

项目介绍

ChatGLM3-6B 是 ChatGLM 系列最新一代的开源模型,在保留了前两代模型对话流畅、部署门槛低等众多优秀特性的基础上,ChatGLM3-6B 引入了如下特性:

  1. 更强大的基础模型: ChatGLM3-6B 的基础模型 ChatGLM3-6B-Base 采用了更多样的训练数据、更充分的训练步数和更合理的训练策略。在语义、数学、推理、代码、知识等不同角度的数据集上测评显示,ChatGLM3-6B-Base 具有在 10B 以下的预训练模型中最强的性能。
  2. 更完整的功能支持: ChatGLM3-6B 采用了全新设计的 Prompt 格式,除正常的多轮对话外。同时原生支持工具调用(Function Call)、代码执行(Code Interpreter)和 Agent 任务等复杂场景。
  3. 更全面的开源序列: 除了对话模型 ChatGLM3-6B 外,还开源了基础模型 ChatGLM-6B-Base、长文本对话模型 ChatGLM3-6B-32K。以上所有权重对学术研究完全开放,在填写问卷进行登记后亦允许免费商业使用

环境介绍

AMD Ryzen 5 3500X 6-Core Processor   3.59 GHz

内存 32.0 GB

Windows 10 企业版

2张N卡:

NVIDIA GeForce RTX 3060 Ti  8G显存

NVIDIA GeForce RTX 3060  12G显存

大容量硬盘:12T

https://blog.csdn.net/weixin_44626085/article/details/132919803

一、环境准备

In [4]:

# 确认GPU型号与显存大小

(base) ai001@CHINAMI-I6IUQDH:~$ nvidia-smi
Mon Apr  8 19:18:23 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.07             Driver Version: 537.34       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3060 Ti     On  | 00000000:04:00.0  On |                  N/A |
| 55%   55C    P3              38W / 200W |   2292MiB /  8192MiB |     38%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   1  NVIDIA GeForce RTX 3060        On  | 00000000:07:00.0 Off |                  N/A |
|  0%   35C    P8               7W / 170W |      0MiB / 12288MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A        38      G   /Xwayland                                 N/A      |
|    1   N/A  N/A        38      G   /Xwayland                                 N/A      |
+---------------------------------------------------------------------------------------+
(base) ai001@CHINAMI-I6IUQDH:~$

1.下载模型文件

GitHub - THUDM/ChatGLM3: ChatGLM3 series: Open Bilingual Chat LLMs | 开源双语对话语言模型

2.模型列表

 

Model Seq Length Download
ChatGLM3-6B 8k HuggingFace | ModelScope | WiseModel
ChatGLM3-6B-Base 8k HuggingFace | ModelScope | WiseModel
ChatGLM3-6B-32K 32k HuggingFace | ModelScope | WiseModel
ChatGLM3-6B-128K 128k HuggingFace | ModelScope

 

!pip install modelscope -i  https://pypi.tuna.tsinghua.edu.cn/simple/

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Requirement already satisfied: modelscope in c:\programdata\anaconda3-py311\lib\site-packages (1.13.3)
Requirement already satisfied: addict in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (2.4.0)
Requirement already satisfied: attrs in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (22.1.0)
Requirement already satisfied: datasets>=2.14.5 in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (2.18.0)
Requirement already satisfied: einops in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (0.7.0)
Requirement already satisfied: filelock>=3.3.0 in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (3.9.0)
Requirement already satisfied: gast>=0.2.2 in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (0.5.4)
Requirement already satisfied: huggingface-hub in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (0.22.2)
Requirement already satisfied: numpy in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (1.24.3)
Requirement already satisfied: oss2 in c:\programdata\anaconda3-py311\lib\site-packages (from modelscope) (2.18.4)
Requirement already satisfied: pandas in c:\programdata\anaconda3-py311\lib\site-packages (from mode
  • 33
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值