Commit dc06c77b authored by chenych's avatar chenych
Browse files

Add GLM-5

parent 8ea010e5
Pipeline #3394 failed with stages
in 0 seconds
......@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2026 Zhipu AI
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
## GLM-5
## 论文
[Qwen3-VL Technical Report](https://arxiv.org/pdf/2511.21631)
[GLM-5: From Vibe Coding to Agentic Engineering](https://z.ai/blog/glm-5)
## 模型简介
- 作为智谱AI新一代旗舰大模型,GLM-5在Coding与Agent能力上取得开源 SOTA 表现,在真实编程场景的使用体感逼近Claude Opus 4.5,擅长复杂系统工程与长程Agent任务:
作为智谱AI新一代旗舰大模型,GLM-5专注于复杂系统工程和长周期智能体任务。扩展模型规模仍是提升通用人工智能(AGI)智能效率的最重要途径之一。与 GLM-4.5 相比,GLM-5 的参数量从 355B(激活参数 32B)扩展至 744B(激活参数 40B),预训练数据量也从 23T tokens 增加到 28.5T tokens。此外,GLM-5 还集成了 DeepSeek 稀疏注意力(DSA)机制,在保持长上下文能力的同时大幅降低了部署成本。
- 参数规模从355B(激活32B)扩展至744B(激活40B),预训练数据从23T提升至28.5T,大幅提升通用智能水平;
- 构建全新“Slime”异步强化学习框架,支持更大模型规模及更复杂强化学习任务,可通过异步智能体强化学习算法持续从长程交互中学习;
- 首次集成DeepSeek Sparse Attention稀疏注意力机制,在维持长文本效果无损的同时,大幅降低模型部署成本、提升Token Efficiency,完全满足产业级部署需求。
<div align=center>
<img src="./doc/qwen3vl_arc.jpg"/>
</div>
1. **Interleaved-MRoPE**: 通过稳健的位置嵌入,在时间、宽度和高度上进行全频分配,增强长时程视频推理。
2. **DeepStack**: 融合多级 ViT 特征,以捕捉精细细节并增强图像与文本的对齐。
3. **Text–Timestamp Alignment:** 超越 T-RoPE,实现基于时间戳的精确事件定位,从而增强视频时间建模能力。
## 环境依赖
| 软件 | 版本 |
| :----------: | :--------------------------------------------: |
| DTK | 26.04.2 |
| python | 3.10.12 |
| transformers | 4.57.6 |
| torch | 2.5.1+das.opt1.dtk2604.20260116.g78471bfd |
| accelerate | 1.12.0 |
| torchvision | 0.20.1+das.opt1.dtk2604.20260116.g65c66897 |
| flash_attn | 2.6.1+das.opt1.dtk2604.20260131.g4edd8bf9 |
| vllm | 0.11.0+das.opt1.rc2.dtk2604.20260128.g0bf89b0c |
| 软件 | 版本 |
| :------: | :------: |
| DTK | 26.04.2 |
| python | 3.10.12 |
| transformers | 5.2.0.dev0 |
| torch | 2.5.1+das.opt1.dtk2604.20260116.g78471bfd |
| vllm | 0.11.0+das.opt1.rc3.dtk2604 |
推荐使用镜像:harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-0130-py3.10-20260202
......@@ -42,7 +22,7 @@
docker run -it \
--shm-size 60g \
--network=host \
--name qwen3 \
--name glm-5 \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
......@@ -53,41 +33,27 @@ docker run -it \
-u root \
-v /opt/hyhal/:/opt/hyhal/:ro \
-v /path/your_code_data/:/path/your_code_data/ \
harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-0130-py3.10-20260202
harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-0130-py3.10-20260202 bash
```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装,其它包参照requirements.txt安装:
```
pip uninstall vllm
pip install vllm-0.11.0+das.opt1.rc3.dtk2604-cp310-cp310-linux_x86_64.whl
pip install -r requirements.txt
```
## 数据集
`暂无`
## 训练
`暂无`
## 推理
### transformers
#### 单机推理
```bash
#普通图文对话
HIP_VISIBLE_DEVICES=0 python qwen3vl_infer.py
#多图像推理
HIP_VISIBLE_DEVICES=0 python qwen3vl_infer_multi_images.py
#视频推理
HIP_VISIBLE_DEVICES=0 python qwen3vl_infer_video.py
```
## vllm
### 多机推理
### vllm
#### 多机推理
1. 加入环境变量
> 请注意:
> 每个节点上的环境变量都写到.sh文件中,保存后各个计算节点分别source`.sh`文件
......@@ -140,96 +106,52 @@ ray start --head --node-ip-address=x.x.x.x --port=6379 --num-gpus=8 --num-cpus=3
# worker节点执行
ray start --address='x.x.x.x:6379' --num-gpus=8 --num-cpus=32
```
3. 启动vllm server
3. 启动vllm server
```bash
vllm serve Qwen/GLM-5 \
--host x.x.x.x \
--port 8000 \
--distributed-executor-backend ray \
--tensor-parallel-size 8 \
--pipeline-parallel-size 2 \
--trust-remote-code \
--dtype bfloat16 \
--max-model-len 32768 \
--max-num-seqs 128 \
--block-size 64 \
--gpu-memory-utilization 0.90 \
--allowed-local-media-path / \
--served-model-name GLM-5
vllm serve zai-org/GLM-5 \
--port 8001 \
--trust-remote-code \
--tensor-parallel-size 32 \
--gpu-memory-utilization 0.85 \
--speculative-config.method mtp \
--speculative-config.num_speculative_tokens 1 \
--tool-call-parser glm47 \
--reasoning-parser glm45 \
--enable-auto-tool-choice \
--served-model-name glm-5
```
启动完成后可通过以下方式访问:
```bash
# /path/to/your/project 请改为图像文件存储的目录
curl http://x.x.x.x:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-vl",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "file:///path/to/your/project/doc/dog.png"
}
},
{
"type": "text",
"text": "请详细描述这张图片的内容。"
}
]
}
],
"max_tokens": 512,
"temperature": 0.7
}'
curl http://localhost:8001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Summarize GLM-5 in one sentence."}
],
"max_tokens": 4096,
"temperature": 1
}'
```
## 效果展示
- image:
<div align=center>
<img src="./doc/demo.jpeg"/>
<img src="./doc/xxx.png"/>
</div>
- text: "Describe this image."
Output:
<div align=center>
<img src="./doc/result.png"/>
</div>
### 精度
`DCU与GPU精度一致,推理框架:transformers、vllm。`
`DCU与GPU精度一致,推理框架:vllm。`
## 预训练权重
| **模型名称** | **权重大小** | **DCU型号** | **最低卡数需求** | **下载地址** |
| :-----------------------------: | :----------: | :---------: | :--------------: | :----------------------------------------------------------: |
| **Qwen3-VL-2B-Instruct** | 2B | K100AI、BW1000 | 1 | [Qwen3-VL-2B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-2B-Instruct) |
| **Qwen3-VL-4B-Instruct** | 4B | K100AI、BW1000 | 1 | [Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) |
| **Qwen3-VL-8B-Instruct** | 8B | K100AI、BW1000 | 1 | [Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct) |
| **Qwen3-VL-32B-Instruct** | 32B | K100AI、BW1000 | 4 | [Qwen3-VL-32B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-32B-Instruct) |
| **Qwen3-VL-30B-A3B-Instruct** | 30B | K100AI、BW1000 | 2 | [Qwen3-VL-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-30B-A3B-Instruct) |
| **Qwen3-VL-30B-A3B-Thinking** | 30B | K100AI、BW1000 | 2 | [Qwen3-VL-30B-A3B-Thinking](https://huggingface.co/Qwen/Qwen3-VL-30B-A3B-Thinking) |
| **Qwen3-VL-235B-A22B-Instruct** | 235B | K100AI、BW1000 | 8 | [Qwen3-VL-235B-A22B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-235B-A22B-Instruct) |
| **Qwen3-VL-235B-A22B-Thinking** | 235B | K100AI、BW1000 | 16 | [Qwen3-VL-235B-A22B-Thinking](https://huggingface.co/Qwen/Qwen3-VL-235B-A22B-Thinking) |
| 模型名称 | 权重大小 | DCU型号 | 最低卡数需求 |下载地址|
|:-----:|:----------:|:----------:|:---------------------:|:----------:|
| GLM-5 | 754B | BW1000 | 32 | [Hugging Face](https://huggingface.co/zai-org/GLM-5) |
## 源码仓库及问题反馈
- https://developer.sourcefind.cn/codes/modelzoo/qwen3-vl_pytorch
- https://developer.sourcefind.cn/codes/modelzoo/glm-5_vllm
## 参考资料
- https://github.com/QwenLM/Qwen3-VL
- https://github.com/zai-org/GLM-5
icon.png

53.8 KB

# 模型唯一标识
modelCode=1858
modelCode=2083
# 模型名称
modelName=Qwen3-VL_pytorch
modelName=GLM-5_vllm
# 模型描述
modelDescription=Qwen3-VL这一代产品在各方面都进行了全面升级,迄今为止 是Qwen 系列中最强大的视觉语言模型。
modelDescription=与 GLM-4.5 相比,GLM-5 的参数量从 355B(激活参数 32B)扩展至 744B(激活参数 40B),预训练数据量也从 23T tokens 增加到 28.5T tokens。此外,GLM-5 还集成了 DeepSeek 稀疏注意力(DSA)机制,在保持长上下文能力的同时大幅降低了部署成本。行过程
# 运行过程
processType=推理
# 算法类别
appCategory=多模态
appCategory=对话问答
# 框架类型
frameType=pytorch
frameType=vllm
# 加速卡类型
accelerateType=BW1000.K100AI
accelerateType=BW1000,
\ No newline at end of file
git+https://github.com/huggingface/transformers.git
pre-commit>=4.2.0
accelerate>=1.10.1
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