### What this PR does / why we need it?
This PR updates the GLM4.x documentation by adding multi-node like 2 ×
Atlas 800 A2 (64G × 8) deployment tutorial.
- **What changed**: Added instructions for deploying GLM-4.X models
across multiple nodes, including environment variables and example
commands.
- **Why needed**: Although the previous tutorial stated that multi-node
deployment on Atlas 800 A2 (64GB × 8) is **not recommended**, but we
still face some situation that must deploy GLM-4.7 on 2 × Atlas 800 A2
(64G × 8). And we successfully run GLM-4.7 on 2 nodes and it works fine,
so we think it might be the time to update this part.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
- Verified that the new documentation renders correctly in Markdown
format.
- Tested the multi-node deployment steps on 2 × Atlas 800 A2 (64G × 8)
to ensure the commands work as described.
- Confirmed that existing GLM4.x documentation links and structure
remain intact.
- vLLM version: v0.16.0
- vLLM main:
15d76f74e2
---------
Signed-off-by: ZKSU <zksu@outlook.com>
274 lines
9.6 KiB
Markdown
274 lines
9.6 KiB
Markdown
# GLM-4.5/4.6/4.7
|
||
|
||
## Introduction
|
||
|
||
GLM-4.x series models use a Mixture-of-Experts (MoE) architecture and are foundational models specifically designed for agent applications.
|
||
|
||
The `GLM-4.5` model is first supported in `vllm-ascend:v0.10.0rc1`.
|
||
|
||
This document will show the main verification steps of the model, including supported features, feature configuration, environment preparation, single-node and multi-node deployment, accuracy and performance evaluation.
|
||
|
||
## Supported Features
|
||
|
||
Refer to [supported features](../../user_guide/support_matrix/supported_models.md) to get the model's supported feature matrix.
|
||
|
||
Refer to [feature guide](../../user_guide/feature_guide/index.md) to get the feature's configuration.
|
||
|
||
## Environment Preparation
|
||
|
||
### Model Weight
|
||
|
||
- `GLM-4.5`(BF16 version): [Download model weight](https://www.modelscope.cn/models/ZhipuAI/GLM-4.5).
|
||
- `GLM-4.6`(BF16 version): [Download model weight](https://www.modelscope.cn/models/ZhipuAI/GLM-4.6).
|
||
- `GLM-4.7`(BF16 version): [Download model weight](https://www.modelscope.cn/models/ZhipuAI/GLM-4.7).
|
||
- `GLM-4.5-w8a8-with-float-mtp`(Quantized version with mtp): [Download model weight](https://modelers.cn/models/Modelers_Park/GLM-4.5-w8a8).
|
||
- `GLM-4.6-w8a8`(Quantized version without mtp): [Download model weight](https://modelers.cn/models/Modelers_Park/GLM-4.6-w8a8). Because vllm do not support GLM4.6 mtp in October, so we do not provide mtp version. And last month, it supported, you can use the following quantization scheme to add mtp weights to Quantized weights.
|
||
- `Method of Quantify`: [quantization scheme](https://blog.csdn.net/qq_37368095/article/details/156429653?spm=1011.2124.3001.6209). You can use these methods to quantify the model.
|
||
|
||
It is recommended to download the model weight to the shared directory of multiple nodes, such as `/root/.cache/`.
|
||
|
||
### Installation
|
||
|
||
You can use our official docker image to run `GLM-4.x` directly.
|
||
|
||
Select an image based on your machine type and start the docker image on your node, refer to [using docker](../../installation.md#set-up-using-docker).
|
||
|
||
```{code-block} bash
|
||
:substitutions:
|
||
# Update --device according to your device (Atlas A2: /dev/davinci[0-7] Atlas A3:/dev/davinci[0-15]).
|
||
# Update the vllm-ascend image according to your environment.
|
||
# Note you should download the weight to /root/.cache in advance.
|
||
# Update the vllm-ascend image
|
||
export IMAGE=m.daocloud.io/quay.io/ascend/vllm-ascend:|vllm_ascend_version|
|
||
export NAME=vllm-ascend
|
||
|
||
# Run the container using the defined variables
|
||
# Note: If you are running bridge network with docker, please expose available ports for multiple nodes communication in advance.
|
||
docker run --rm \
|
||
--name $NAME \
|
||
--net=host \
|
||
--shm-size=1g \
|
||
--device /dev/davinci0 \
|
||
--device /dev/davinci1 \
|
||
--device /dev/davinci2 \
|
||
--device /dev/davinci3 \
|
||
--device /dev/davinci4 \
|
||
--device /dev/davinci5 \
|
||
--device /dev/davinci6 \
|
||
--device /dev/davinci7 \
|
||
--device /dev/davinci_manager \
|
||
--device /dev/devmm_svm \
|
||
--device /dev/hisi_hdc \
|
||
-v /usr/local/dcmi:/usr/local/dcmi \
|
||
-v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
|
||
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
|
||
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
|
||
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
|
||
-v /etc/ascend_install.info:/etc/ascend_install.info \
|
||
-v /root/.cache:/root/.cache \
|
||
-it $IMAGE bash
|
||
```
|
||
|
||
## Deployment
|
||
|
||
### Single-node Deployment
|
||
|
||
- In low-latency scenarios, we recommend a single-machine deployment.
|
||
- Quantized model `glm4.5_w8a8_with_float_mtp` can be deployed on 1 Atlas 800 A3 (64G × 16) or 1 Atlas 800 A2 (64G × 8).
|
||
|
||
Run the following script to execute online inference.
|
||
|
||
```shell
|
||
#!/bin/sh
|
||
export HCCL_BUFFSIZE=1024
|
||
export OMP_PROC_BIND=false
|
||
export OMP_NUM_THREADS=10
|
||
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
|
||
export HCCL_OP_EXPANSION_MODE=AIV
|
||
|
||
vllm serve /weight/glm4.5_w8a8_with_float_mtp \
|
||
--data-parallel-size 1 \
|
||
--tensor-parallel-size 16 \
|
||
--seed 1024 \
|
||
--served-model-name glm \
|
||
--max-model-len 35000 \
|
||
--max-num-batched-tokens 16384 \
|
||
--max-num-seqs 16 \
|
||
--trust-remote-code \
|
||
--gpu-memory-utilization 0.9 \
|
||
--speculative-config '{"num_speculative_tokens": 1, "model":"/weight/glm4.5_w8a8_with_float_mtp", "method":"mtp"}' \
|
||
--compilation-config '{"cudagraph_capture_sizes": [1,2,4,8,16,32], "cudagraph_mode": "FULL_DECODE_ONLY"}' \
|
||
--async-scheduling
|
||
```
|
||
|
||
**Notice:**
|
||
The parameters are explained as follows:
|
||
|
||
- For single-node deployment, we recommend using `dp1tp16` and turn off expert parallel in low-latency scenarios.
|
||
- `--async-scheduling` Asynchronous scheduling is a technique used to optimize inference efficiency. It allows non-blocking task scheduling to improve concurrency and throughput, especially when processing large-scale models.
|
||
|
||
### Multi-node Deployment
|
||
|
||
Although the former tutorial said "Not recommended to deploy multi-node on Atlas 800 A2 (64G × 8)", but if you insist to deploy GLM-4.x model on multi-node like 2 × Atlas 800 A2 (64G × 8), run the following scripts on two nodes respectively.
|
||
|
||
**Node 0**
|
||
|
||
```shell
|
||
#!/bin/sh
|
||
|
||
# this obtained through ifconfig
|
||
# nic_name is the network interface name corresponding to local_ip of the current node
|
||
nic_name="xxxx"
|
||
local_ip="xxxx"
|
||
|
||
export HCCL_IF_IP=$local_ip
|
||
export GLOO_SOCKET_IFNAME=$nic_name
|
||
export TP_SOCKET_IFNAME=$nic_name
|
||
export HCCL_SOCKET_IFNAME=$nic_name
|
||
export OMP_PROC_BIND=false
|
||
export OMP_NUM_THREADS=1
|
||
export HCCL_BUFFSIZE=200
|
||
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
|
||
export VLLM_ASCEND_BALANCE_SCHEDULING=1
|
||
export HCCL_INTRA_PCIE_ENABLE=1
|
||
export HCCL_INTRA_ROCE_ENABLE=0
|
||
export VLLM_USE_MODELSCOPE=True
|
||
|
||
vllm serve ZhipuAI/GLM-4.7 \
|
||
--host 0.0.0.0 \
|
||
--port 30000 \
|
||
--data-parallel-size 4 \
|
||
--data-parallel-size-local 2 \
|
||
--data-parallel-address $local_ip \
|
||
--data-parallel-rpc-port 13389 \
|
||
--tensor-parallel-size 4 \
|
||
--seed 1024 \
|
||
--async-scheduling \
|
||
--max-num-seqs 16 \
|
||
--max-model-len 16384 \
|
||
--max-num-batched-tokens 4096 \
|
||
--gpu-memory-utilization 0.92 \
|
||
--enable-auto-tool-choice \
|
||
--reasoning-parser glm45 \
|
||
--tool-call-parser glm47 \
|
||
--speculative-config {"num_speculative_tokens":3,"method":"mtp"} \
|
||
--compilation-config {"cudagraph_capture_sizes":[4,16,32,48,64], "cudagraph_mode": "FULL_DECODE_ONLY"} \
|
||
--trust-remote-code \
|
||
--served-model-name glm47
|
||
|
||
```
|
||
|
||
**Node 1**
|
||
|
||
```shell
|
||
#!/bin/sh
|
||
|
||
# this obtained through ifconfig
|
||
# nic_name is the network interface name corresponding to local_ip of the current node
|
||
nic_name="xxxx"
|
||
local_ip="xxxx"
|
||
node0_ip="xxxx" # same as the local_IP address in node 0
|
||
|
||
export HCCL_IF_IP=$local_ip
|
||
export GLOO_SOCKET_IFNAME=$nic_name
|
||
export TP_SOCKET_IFNAME=$nic_name
|
||
export HCCL_SOCKET_IFNAME=$nic_name
|
||
export OMP_PROC_BIND=false
|
||
export OMP_NUM_THREADS=1
|
||
export HCCL_BUFFSIZE=200
|
||
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
|
||
export VLLM_ASCEND_BALANCE_SCHEDULING=1
|
||
export HCCL_INTRA_PCIE_ENABLE=1
|
||
export HCCL_INTRA_ROCE_ENABLE=0
|
||
export VLLM_USE_MODELSCOPE=True
|
||
|
||
vllm serve ZhipuAI/GLM-4.7 \
|
||
--host 0.0.0.0 \
|
||
--port 30000 \
|
||
--headless \
|
||
--data-parallel-size 4 \
|
||
--data-parallel-size-local 2 \
|
||
--data-parallel-start-rank 2 \
|
||
--data-parallel-address $node0_ip \
|
||
--data-parallel-rpc-port 13389 \
|
||
--tensor-parallel-size 4 \
|
||
--seed 1024 \
|
||
--async-scheduling \
|
||
--max-num-seqs 16 \
|
||
--max-model-len 16384 \
|
||
--max-num-batched-tokens 4096 \
|
||
--gpu-memory-utilization 0.92 \
|
||
--enable-auto-tool-choice \
|
||
--reasoning-parser glm45 \
|
||
--tool-call-parser glm47 \
|
||
--speculative-config {"num_speculative_tokens":3,"method":"mtp"} \
|
||
--compilation-config {"cudagraph_capture_sizes":[4,16,32,48,64], "cudagraph_mode": "FULL_DECODE_ONLY"} \
|
||
--trust-remote-code \
|
||
--served-model-name glm47
|
||
```
|
||
|
||
### Prefill-Decode Disaggregation
|
||
|
||
Not test yet.
|
||
|
||
## Accuracy Evaluation
|
||
|
||
Here are two accuracy evaluation methods.
|
||
|
||
### Using AISBench
|
||
|
||
1. Refer to [Using AISBench](../../developer_guide/evaluation/using_ais_bench.md) for details.
|
||
|
||
2. After execution, you can get the result, here is the result of `GLM4.6` in `vllm-ascend:main` (after `vllm-ascend:0.13.0rc1`) for reference only.
|
||
|
||
| dataset | version | metric | mode | vllm-api-general-chat | note |
|
||
|----- | ----- | ----- | ----- | -----| ----- |
|
||
| gsm8k | - | accuracy | gen | 96.13 | 1 Atlas 800 A3 (64G × 16) |
|
||
| gsm8k | - | accuracy | gen | 96.06 | GPU |
|
||
|
||
### Using Language Model Evaluation Harness
|
||
|
||
Not test yet.
|
||
|
||
## Performance
|
||
|
||
### Using AISBench
|
||
|
||
Refer to [Using AISBench for performance evaluation](../../developer_guide/evaluation/using_ais_bench.md#execute-performance-evaluation) for details.
|
||
|
||
### Using vLLM Benchmark
|
||
|
||
Run performance evaluation of `GLM-4.x` as an example.
|
||
|
||
Refer to [vllm benchmark](https://docs.vllm.ai/en/latest/contributing/benchmarks.html) for more details.
|
||
|
||
There are three `vllm bench` subcommands:
|
||
|
||
- `latency`: Benchmark the latency of a single batch of requests.
|
||
- `serve`: Benchmark the online serving throughput.
|
||
- `throughput`: Benchmark offline inference throughput.
|
||
|
||
Take the `serve` as an example. Run the code as follows.
|
||
|
||
```shell
|
||
vllm bench serve \
|
||
--backend vllm \
|
||
--dataset-name prefix_repetition \
|
||
--prefix-repetition-prefix-len 22400 \
|
||
--prefix-repetition-suffix-len 9600 \
|
||
--prefix-repetition-output-len 1024 \
|
||
--num-prompts 1 \
|
||
--prefix-repetition-num-prefixes 1 \
|
||
--ignore-eos \
|
||
--model glm \
|
||
--tokenizer /weight/glm4.5_w8a8_with_float_mtp \
|
||
--seed 1000 \
|
||
--host 0.0.0.0 \
|
||
--port 8000 \
|
||
--endpoint /v1/completions \
|
||
--max-concurrency 1 \
|
||
--request-rate 1 \
|
||
```
|
||
|
||
After about several minutes, you can get the performance evaluation result.
|