一、测试条件
sdk4.4版、X86环境(Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz)
、MR100卡、镜像harbor.iluvatar.com.cn:10443/saas/mr-bi150-4.4.0-x86-ubuntu20.04-py3.10-poc-llm-infer:v1.2.3
二、创建容器
1、获取镜像
docker pull harbor.iluvatar.com.cn:10443/saas/mr-bi150-4.4.0-x86-ubuntu20.04-py3.10-poc-llm-infer:v1.2.3
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=sdk440llminfer123 --ipc=host --privileged --cap-add=ALL --pid=host harbor.iluvatar.com.cn:10443/saas/mr-bi150-4.4.0-x86-ubuntu20.04-py3.10-poc-llm-infer:v1.2.3 /bin/bash
三、启动服务
1、魔搭上下载权重
pip install modelscope
pip install --upgrade modelscope
modelscope download --model deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct --local_dir /data/models/DeepSeek-Coder-V2-Lite-Instruct
2、启动模型
export VLLM_ENFORCE_CUDA_GRAPH=1
vllm serve /data/models/DeepSeek-Coder-V2-Lite-Instruct \
--trust-remote-code \
--tensor-parallel-size 2 \
--max-num-seqs 64 \
--enable-chunked-prefill \
--max-model-len 131072 \
--host 0.0.0.0 \
--gpu-memory-utilization 0.90 \
--compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY", "level": 0}'
四、curl请求测试
1、普通Curl请求测试
#使用v1 chat接口
-H "Content-Type: application/json" \
-d '{
"model": "/data/models/DeepSeek-Coder-V2-Lite-Instruct",
"messages": [
{"role": "user", "content": "请详细介绍人工智能"}
],
"max_tokens": 1024
}'
#使用v1 completions接口
-H "Content-Type: application/json" \
-d '{
"model": "/data/models/DeepSeek-Coder-V2-Lite-Instruct",
"prompt": "请详细介绍人工智能",
"max_tokens": 1024,
"temperature": 0.7,
"top_p": 0.9
}'
2、使用jq格式化curl输出
1)、安装jq
apt-get update
apt-get install jq
2)、curl请求测试
DeepSeek-Coder-V2-Lite-Instruct
-H "Content-Type: application/json" \
-d '{
"model": "/data/models/DeepSeek-Coder-V2-Lite-Instruct",
"prompt": "请介绍一下人工智能\n",
"temperature": 0.0,
"max_tokens": 512
}' | jq -r '.choices[0].text'
五、Benchmark测试
1、benchmark工具下载
sftp -P 29880 iluvatar_mr@iftp.iluvatar.com.cn (访问密码请咨询天数售后)
get /client_tmp/support/kk/vllm_benchmark.tar.gz /home/
2、进入容器,执行测试
docker exec -it sdk440llminfer123 bash
cd /data/models/vllm_benchmark
python3 benchmark_serving.py --model /data/models/DeepSeek-Coder-V2-Lite-Instruct --dataset-name random --random-input-len 1024 --random-output-len 1024 --num-prompts 1 --host "0.0.0.0" --port 8000