Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
e1b63624
Unverified
Commit
e1b63624
authored
Nov 22, 2024
by
Lianmin Zheng
Committed by
GitHub
Nov 22, 2024
Browse files
Only stream output on tp rank 0 (#2124)
parent
c35cd1f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
python/sglang/srt/managers/scheduler.py
python/sglang/srt/managers/scheduler.py
+6
-4
python/sglang/srt/model_executor/model_runner.py
python/sglang/srt/model_executor/model_runner.py
+1
-1
No files found.
python/sglang/srt/managers/scheduler.py
View file @
e1b63624
...
...
@@ -134,8 +134,8 @@ class Scheduler:
)
else
:
self
.
recv_from_tokenizer
=
None
self
.
send_to_tokenizer
=
SimpleNamespace
(
send_pyobj
=
lambda
x
:
None
)
self
.
send_to_detokenizer
=
SimpleNamespace
(
send_pyobj
=
lambda
x
:
None
)
self
.
send_to_tokenizer
=
SimpleNamespace
(
send_pyobj
=
lambda
_
:
None
)
self
.
send_to_detokenizer
=
SimpleNamespace
(
send_pyobj
=
lambda
_
:
None
)
# Init tokenizer
self
.
model_config
=
ModelConfig
(
...
...
@@ -1028,7 +1028,8 @@ class Scheduler:
else
:
self
.
tree_cache
.
cache_unfinished_req
(
req
)
self
.
stream_output
(
batch
.
reqs
)
if
self
.
tp_rank
==
0
:
self
.
stream_output
(
batch
.
reqs
)
def
process_batch_result_decode
(
self
,
batch
:
ScheduleBatch
,
result
):
logits_output
,
next_token_ids
,
bid
=
result
...
...
@@ -1079,7 +1080,8 @@ class Scheduler:
torch
.
cuda
.
current_stream
().
synchronize
()
batch
.
next_batch_sampling_info
.
sampling_info_done
.
set
()
self
.
stream_output
(
batch
.
reqs
)
if
self
.
tp_rank
==
0
:
self
.
stream_output
(
batch
.
reqs
)
self
.
token_to_kv_pool
.
free_group_end
()
...
...
python/sglang/srt/model_executor/model_runner.py
View file @
e1b63624
...
...
@@ -179,7 +179,7 @@ class ModelRunner:
if
self
.
device
==
"cuda"
:
torch
.
cuda
.
set_device
(
self
.
gpu_id
)
backend
=
"nccl"
# T
o
DO(liangan1):Just use gloo to bypass the initilization fail
# T
O
DO(liangan1):
Just use gloo to bypass the initilization fail
# Need to use xccl for xpu backend in the future
elif
self
.
device
==
"xpu"
:
torch
.
xpu
.
set_device
(
self
.
gpu_id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment