Commit 80303715 authored by chenych's avatar chenych
Browse files

Add glm-4.7-flash

parent de15f105
...@@ -21,13 +21,13 @@ GLM-4.7 是智谱最新旗舰模型,GLM-4.7 面向 Agentic Coding 场景强化 ...@@ -21,13 +21,13 @@ GLM-4.7 是智谱最新旗舰模型,GLM-4.7 面向 Agentic Coding 场景强化
## 环境依赖 ## 环境依赖
| 软件 | 版本 | | 软件 | 版本 |
| :------: | :------: | | :------: | :------: |
| DTK | 25.04.2 | | DTK | 26.04 |
| python | 3.10 | | python | 3.10.12 |
| transformers | 4.57.3 | | transformers | 5.2.0 |
| vllm | 0.9.2+das.opt1.dtk25042 | | vllm | 0.15.1+das.opt1.alpha.dtk2604.20260220.g2799735a |
| torch | 2.5.1+das.opt1.dtk25041 | | torch | 2.9.0+das.opt1.dtk2604.20260206.g275d08c2 |
推荐使用镜像: image.sourcefind.cn:5000/dcu/admin/base/vllm:0.9.2-ubuntu22.04-dtk25.04.2-das1.7-py3.10-20251203 推荐使用镜像: harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220
- 挂载地址`-v`根据实际模型情况修改 - 挂载地址`-v`根据实际模型情况修改
...@@ -46,20 +46,52 @@ docker run -it \ ...@@ -46,20 +46,52 @@ docker run -it \
-u root \ -u root \
-v /opt/hyhal/:/opt/hyhal/:ro \ -v /opt/hyhal/:/opt/hyhal/:ro \
-v /path/your_code_data/:/path/your_code_data/ \ -v /path/your_code_data/:/path/your_code_data/ \
image.sourcefind.cn:5000/dcu/admin/base/vllm:0.9.2-ubuntu22.04-dtk25.04.2-das1.7-py3.10-20251203 bash harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220 bash
``` ```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。 更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装,其它包参照requirements.txt安装: 关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装,其它包安装:
```
pip install pycountry
pip install -U transformers
```
## 数据集 ## 数据集
暂无 `暂无`
## 训练 ## 训练
暂无 `暂无`
## 推理 ## 推理
### vllm ### vllm
#### 单机推理
```bash
## serve启动
export ALLREDUCE_STREAM_WITH_COMPUTE=1
vllm serve ZhipuAI/GLM-4.7-Flash \
--tensor-parallel-size 4 \
--speculative-config.method mtp \
--speculative-config.num_speculative_tokens 1 \
--gpu-memory-utilization 0.95 \
--tool-call-parser glm47 \
--reasoning-parser glm45 \
--enable-auto-tool-choice \
--port 8001
# client访问
curl http://localhost:8001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "glm-4.7-flash",
"messages": [
{
"role": "user",
"content": "hello"
}
]
}'
```
#### 多机推理 #### 多机推理
1. 环境变量配置 1. 环境变量配置
```bash ```bash
...@@ -106,14 +138,16 @@ ray start --address='x.x.x.x:6379' --num-gpus=8 --num-cpus=32 ...@@ -106,14 +138,16 @@ ray start --address='x.x.x.x:6379' --num-gpus=8 --num-cpus=32
3. 启动vllm server 3. 启动vllm server
```bash ```bash
vllm serve ZhipuAI/GLM-4.7 \ vllm serve ZhipuAI/GLM-4.7 \
--trust-remote-code \ --distributed-executor-backend ray \
--distributed-executor-backend ray \ --tensor-parallel-size 16 \
--dtype bfloat16 \ --speculative-config.method mtp \
--tensor-parallel-size 16 \ --speculative-config.num_speculative_tokens 1 \
--max-model-len 32768 \ --tool-call-parser glm47 \
--port 8001 \ --reasoning-parser glm45 \
--served-model-name glm-4.7 \ --enable-auto-tool-choice \
--kv-cache-dtype auto --gpu-memory-utilization 0.95 \
--port 8001 \
--served-model-name glm-4.7
``` ```
启动完成后可通过以下方式访问: 启动完成后可通过以下方式访问:
...@@ -133,17 +167,26 @@ curl http://localhost:8001/v1/chat/completions \ ...@@ -133,17 +167,26 @@ curl http://localhost:8001/v1/chat/completions \
``` ```
## 效果展示 ## 效果展示
- GLM-4.7-Flash 推理效果展示
<div align=center>
<img src="./doc/result-glm4.7-flash.png"/>
</div>
- GLM-4.7 推理效果展示
<div align=center> <div align=center>
<img src="./doc/result.png"/> <img src="./doc/result-glm4.7.png"/>
</div> </div>
### 精度 ### 精度
DCU与GPU精度一致,推理框架:vllm。 `DCU与GPU精度一致,推理框架:vllm。`
## 预训练权重 ## 预训练权重
| 模型名称 | 权重大小 | DCU型号 | 最低卡数需求 |下载地址| | 模型名称 | 权重大小 | DCU型号 | 最低卡数需求 |下载地址|
|:-----:|:----------:|:----------:|:---------------------:|:----------:| |:-----:|:----------:|:----------:|:---------------------:|:----------:|
| GLM-4.7 | 358B | BW1000 | 16 | [Modelscope](https://modelscope.cn/models/ZhipuAI/GLM-4.7) | | GLM-4.7 | 355B-A32B | BW1000 | 16 | [Modelscope](https://modelscope.cn/models/ZhipuAI/GLM-4.7) |
| GLM-4.7-Flash| 30B-A3B | BW1000 | 2 | [Modelscope](https://modelscope.cn/models/ZhipuAI/GLM-4.7-Flash) |
## 源码仓库及问题反馈 ## 源码仓库及问题反馈
- https://developer.sourcefind.cn/codes/modelzoo/glm-4.7_vllm - https://developer.sourcefind.cn/codes/modelzoo/glm-4.7_vllm
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment