一、测试环境
- SDK版本:4.4.0
- GPU型号:MR100
- 模型所需最低GPU数量:4
- CPU架构:X86_64
二、创建容器
1. 获取镜像
docker pull registry.iluvatar.com.cn:10443/customer/sz/vllm0.17.0-4.4.0-x86:v6
2. 创建容器
使用以下命令创建并启动容器:
docker run -dit -v /usr/src:/usr/src -v /lib/modules:/lib/modules -v /dev:/dev -v /data:/data -v /home:/home --network=host --name=GLM-4.7-Flash --ipc=host --privileged --cap-add=ALL --pid=host registry.iluvatar.com.cn:10443/customer/sz/vllm0.17.0-4.4.0-x86:v6 /bin/bash
三、模型部署
以下操作在容器内执行
#进入容器
docker exec -it GLM-4.7-Flash bash
1. 下载权重
通过ModelScope下载GLM-4.7-Flash模型权重:
pip install modelscope pip install --upgrade modelscope modelscope download --model ZhipuAI/GLM-4.7-Flash --local_dir GLM-4.7-Flash
2. 启动服务
export VLLM_ENFORCE_CUDA_GRAPH=1 vllm serve /data/models/GLM-4.7-Flash -tp 4 --port 8000 --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY", "level": 0}'
四、API功能验证
1. 基础curl请求测试
curl -s -X POST "http://127.0.0.1:8000/v1/chat/completions" -H "Content-Type: application/json" -d '{
"model": "'"/data/models/GLM-4.7-Flash"'",
"messages": [{"role": "user", "content": "请介绍一下人工智能"}],
"temperature": 0.7,
"top_p": 0.9,
"chat_template_kwargs": {
"enable_thinking": false
}
}'
2、使用jq格式化curl输出
curl -s -X POST "http://127.0.0.1:8000/v1/chat/completions" -H "Content-Type: application/json" -d '{
"model": "'"/data/models/GLM-4.7-Flash"'",
"messages": [{"role": "user", "content": "请介绍一下人工智能"}],
"temperature": 0.7,
"top_p": 0.9,
"chat_template_kwargs": {
"enable_thinking": false
}
}' | jq -r '.choices[0].message.content'
五、Benchmark测试
vllm bench serve --model /data/models/GLM-4.7-Flash --num-prompt 1 --max-concurrency 1 --port 8000 --random_input_len 1024 --random_output_len 1024