Skip to content

Commit 9560b20

Browse files
committed
add docs.
1 parent 2e03c78 commit 9560b20

File tree

2 files changed

+145
-1
lines changed

2 files changed

+145
-1
lines changed

docs/CN/source/getting_started/quickstart.rst

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
.. code-block:: console
9595
96-
$ CUDA_VISIBLE_DEVICES=0 python -m lightllm.server.api_server \
96+
$ python -m lightllm.server.api_server \
9797
$ --model_dir /your/model/path \
9898
$ --run_mode "pd_master" \
9999
$ --host /your/host/ip \
@@ -165,3 +165,107 @@
165165
$ cd test
166166
$ python benchmark_client.py --num_clients 100 --input_num 2000 --tokenizer_path /nvme/DeepSeek-R1/ --url http://127.0.01:8000/generate_stream
167167
168+
169+
3. PD 分离多PD_Master节点类型启动模型服务
170+
-------------------------
171+
查找本机IP
172+
173+
.. code-block:: console
174+
175+
$ hostname -i
176+
177+
运行MPS(可选, 有mps支持性能会好特别多,但是部分显卡和驱动环境开启mps会容易出现错误,建议升级驱动到较高版本,特别是H系列卡)
178+
179+
.. code-block:: console
180+
181+
$ nvidia-cuda-mps-control -d
182+
183+
184+
运行config_server服务
185+
.. code-block:: console
186+
187+
$ python -m lightllm.server.api_server \
188+
$ --run_mode "config_server" \
189+
$ --config_server_host /your/host/ip \
190+
$ --config_server_port 60088 \
191+
192+
193+
运行pd_master服务, 在多pd_master节点模式下,可以开启多个pd_master服务,来实现负载均衡,单个pd_master因为python gil锁的原因
194+
其并发性能存在上限。
195+
196+
.. code-block:: console
197+
198+
$ python -m lightllm.server.api_server \
199+
$ --model_dir /your/model/path \
200+
$ --run_mode "pd_master" \
201+
$ --host /your/host/ip \
202+
$ --port 60011 \
203+
$ --config_server_host <config_server_host> \
204+
$ --config_server_port <config_server_port>
205+
206+
新建终端,运行prefill服务
207+
208+
.. code-block:: console
209+
210+
$ CUDA_VISIBLE_DEVICES=0,1 KV_TRANS_USE_P2P=1 LOADWORKER=1 python -m lightllm.server.api_server --model_dir /data/fengdahu/model/Qwen2-7B/ \
211+
$ --run_mode "prefill" \
212+
$ --host /your/host/ip \
213+
$ --port 8017 \
214+
$ --tp 2 \
215+
$ --nccl_port 2732 \
216+
$ --max_total_token_num 400000 \
217+
$ --tokenizer_mode fast \
218+
$ --use_dynamic_prompt_cache \
219+
$ --max_req_total_len 16000 \
220+
$ --running_max_req_size 128 \
221+
$ --disable_cudagraph \
222+
$ --config_server_host <config_server_host> \
223+
$ --config_server_port <config_server_port>
224+
225+
新建终端,运行decoding服务
226+
227+
.. code-block:: console
228+
229+
$ CUDA_VISIBLE_DEVICES=2,3 KV_TRANS_USE_P2P=1 LOADWORKER=10 python -m lightllm.server.api_server --model_dir /data/fengdahu/model/Qwen2-7B/ \
230+
$ --run_mode "decode" \
231+
$ --host /your/host/ip \
232+
$ --port 8118 \
233+
$ --nccl_port 12322 \
234+
$ --tp 2 \
235+
$ --max_total_token_num 400000 \
236+
$ --graph_max_len_in_batch 2048 \
237+
$ --graph_max_batch_size 16 \
238+
$ --tokenizer_mode fast \
239+
$ --use_dynamic_prompt_cache \
240+
$ --config_server_host <config_server_host> \
241+
$ --config_server_port <config_server_port>
242+
243+
.. note::
244+
prefill和decoding阶段的tp大小保持一致, 目前可以支持 prefill 和 decode 节点的数量是变化的,同时prefill 和 decode可以跨机部署。
245+
246+
247+
4. (可选)测试模型服务
248+
-------------------------
249+
250+
在新的终端,使用下面的指令对模型服务进行测试, 在多pd_master模式下,每个pd_master都可以作为访问入口:
251+
252+
.. code-block:: console
253+
254+
$ curl http://server_ip:server_port/generate \
255+
$ -H "Content-Type: application/json" \
256+
$ -d '{
257+
$ "inputs": "What is AI?",
258+
$ "parameters":{
259+
$ "max_new_tokens":17,
260+
$ "frequency_penalty":1
261+
$ }
262+
$ }'
263+
264+
265+
对于DeepSeek-R1模型,可以用如下脚本进行测试:
266+
267+
.. code-block:: console
268+
269+
$ cd test
270+
$ python benchmark_client.py --num_clients 100 --input_num 2000 --tokenizer_path /nvme/DeepSeek-R1/ --url http://127.0.01:8000/generate_stream
271+

test/test.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,43 @@ CUDA_VISIBLE_DEVICES=1 KV_TRANS_USE_P2P=1 LOADWORKER=10 python -m lightllm.serve
7171
LOADWORKER=8 python -m lightllm.server.api_server --port 8018 --model_dir /dev/shm/llama2-7b-chat --tp 2 --graph_max_batch_size 16 --use_dynamic_prompt_cache
7272

7373

74+
# 多 pd_master 节点部署实列
75+
python -m lightllm.server.api_server --run_mode "config_server" --config_server_host 10.120.114.74 --config_server_port 60088
76+
77+
python -m lightllm.server.api_server --model_dir /mtc/models/DeepSeek-V2-Lite-Chat --run_mode "pd_master" --host 10.120.114.74 --port 60011 --config_server_host 10.120.114.74 --config_server_port 60088
78+
79+
python -m lightllm.server.api_server --model_dir /mtc/models/DeepSeek-V2-Lite-Chat --run_mode "pd_master" --host 10.120.114.74 --port 60012 --config_server_host 10.120.114.74 --config_server_port 60088
80+
81+
82+
nvidia-cuda-mps-control -d
83+
CUDA_VISIBLE_DEVICES=0 KV_TRANS_USE_P2P=1 LOADWORKER=1 python -m lightllm.server.api_server --model_dir /mtc/models/DeepSeek-V2-Lite-Chat \
84+
--run_mode "prefill" \
85+
--host 10.120.178.74 \
86+
--port 8019 \
87+
--tp 1 \
88+
--nccl_port 2732 \
89+
--max_total_token_num 40000 \
90+
--tokenizer_mode fast \
91+
--use_dynamic_prompt_cache \
92+
--max_req_total_len 16000 \
93+
--running_max_req_size 128 \
94+
--disable_cudagraph \
95+
--config_server_host 10.120.114.74 \
96+
--config_server_port 60088
97+
98+
CUDA_VISIBLE_DEVICES=1 KV_TRANS_USE_P2P=1 LOADWORKER=10 python -m lightllm.server.api_server --model_dir /mtc/models/DeepSeek-V2-Lite-Chat \
99+
--run_mode "decode" \
100+
--host 10.120.178.74 \
101+
--port 8121 \
102+
--nccl_port 12322 \
103+
--tp 1 \
104+
--max_total_token_num 40000 \
105+
--graph_max_len_in_batch 2048 \
106+
--graph_max_batch_size 16 \
107+
--tokenizer_mode fast \
108+
--use_dynamic_prompt_cache \
109+
--config_server_host 10.120.114.74 \
110+
--config_server_port 60088
111+
112+
113+

0 commit comments

Comments
 (0)