PD分离部署¶
xllm支持PD分离部署,这需要与我们的另一个开源库xllm service配套使用。
xLLM Service依赖¶
首先,我们下载安装xllm service,与安装编译xllm类似:
git clone https://github.com/jd-opensource/xllm-service
cd xllm_service
git submodule init
git submodule update
etcd安装¶
xllm_service依赖etcd,使用etcd官方提供的安装脚本进行安装,其脚本提供的默认安装路径是/tmp/etcd-download-test/etcd,我们可以手动修改其脚本中的安装路径,也可以运行完脚本之后手动迁移:
xLLM Service编译¶
先应用patch:
再执行编译:
可能的错误
这里能会遇到关于boost-locale和boost-interprocess的安装错误:vcpkg-src/packages/boost-locale_x64-linux/include: No such file or directory,/vcpkg-src/packages/boost-interprocess_x64-linux/include: No such file or directory 我们使用vcpkg重新安装这些包:
PD分离运行¶
启动etcd:
./etcd-download-test/etcd --listen-peer-urls 'http://localhost:2390' --listen-client-urls 'http://localhost:2389' --advertise-client-urls 'http://localhost:2391'
ENABLE_DECODE_RESPONSE_TO_SERVICE=true ./xllm_master_serving --etcd_addr="127.0.0.1:12389" --http_server_port 28888 --rpc_server_port 28889 --tokenizer_path=/path/to/tokenizer_config_dir/
以Qwen2-7B为例
- 启动Prefill实例
-
启动Decode实例
需要注意: -
PD分离在指定NPU Device的时候,需要对应的
device_ip,这个每张卡是不一样的,具体的可以在非容器环境下的物理机器上执行下面命令看到,其呈现的address_{i}=后面的值就是对应NPU {i}的device_ip。 etcd_addr需与xllm_service的etcd_addr相同
测试命令和上面类似,注意curl http://localhost:{PORT}/v1/chat/completions ...的PORT选择为启动xLLM service的http_server_port。