Skip to main content

H200 Instances with DeepSeek-V3-671B: 探索在线分布式推理服务

HPC-AI,为您提供稳定、高效、快速的高性能算力。您可以在我们的云平台上快速地启动、部署和发布您的专属大模型服务。

Step 0:准备模型

您可以定制化地运行您的专属模型。例如,将您的模型上传至您的instance中或者共享存储中[我该如何上传我的数据?]。

这里,我们为您提供一个使用共享存储挂载著名开源大模型 DeepSeek-V3 的例子。

  1. 首先,我们创建一个用于在多个机器间共享数据的共享存储空间,该空间最大可达1000GB [需要定制化共享存储容量大小?]。 img.png
  2. 接着,我们在共享存储的所在区域内启动一台instance,在该instance的配置界面挂载该共享存储。 img.png
  3. 我们通过jupyter/ssh等方式进入该主机的共享存储目录,使用huggingface-cli[关于 huggingface]下载Deepseek-V3 model
pip install huggingface
pip install huggingface_hub
huggingface-cli download --resume-download deepseek-ai/DeepSeek-V3 --local-dir ./models/DeepSeek-V3

Step 1:配置云主机

  1. 按照Step 0 中配置完模型后,我们在共享存储所在区域内启动两台H200 * 8 Instance,并挂载该高性能共享存储。 img.png img.png

  2. 在该Instance启动后,我们对其进行环境配置。在我们的高性能集群中,我们支持了Infini Band 及 IBGDA特性。因此,您可以根据您的需要在环境变量中开启他们,例如:

# export CUDA_LAUNCH_BLOCKING=1
# export NCCL_DEBUG=INFO
export NCCL_IB_GID_INDEX=3
export NCCL_SOCKET_IFNAME=eth0
export NCCL_IB_DISABLE=0

Step 2: 启动分布式推理服务

在这个示例中,我们以SGLang作为代表,帮助您在两台或者多台节点中分布式的启动您的推理服务。

  1. 环境准备
pip install "sglang[all]>=0.4.8"
apt update
apt install -y libnuma1
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
  1. 多机推理命令

首先,您可以通过ifonfig 获取您的主节点ip

apt-get install net-tools

(base) root@notebook-43f8fcd9-555e-11f0-9522-96891d9dfb5e-0:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1450
...
inet <value_from_ifconfig_eth0_inet> ...
...
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
...

接着,在您的主节点上和从节点上分别使用以下命令

## node0
python3 -m sglang.launch_server --model-path <your_model_path> --tp 16 --dist-init-addr <value_from_ifconfig_eth0_inet>:50000 --nnodes 2 --node-rank 0 --port 30000 --trust-remote-code
## node1
python3 -m sglang.launch_server --model-path <your_model_path> --tp 16 --dist-init-addr <value_from_ifconfig_eth0_inet>:50000 --nnodes 2 --node-rank 1 --port 30000 --trust-remote-code
## node3
...

Step 3. 发布、控制、管理您的服务

  1. 通过instance启动项的配置和HTTP Port参数的配置,您可以将服务发布到特定地址上。

img.png img.png 2. 您可以通过以下指令测试您的服务运行状态

curl -s http://[HttpPortsAddress]/v1/chat/completions \-H "Content-Type: application/json" \-d '{
"model": "DeepSeek-V3",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 50
}'
  1. 关闭服务
ps aux | grep sglang.launch_server
kill -9 pid