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
357fb2db
"vscode:/vscode.git/clone" did not exist on "0c71189abeaa8ab4b28dd7e5a309ac75c64968a2"
Unverified
Commit
357fb2db
authored
May 05, 2025
by
Junrong Lin
Committed by
GitHub
May 04, 2025
Browse files
fix: fix broadcast_pyobj breaking VerlEngine (#5997)
parent
95c231e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
python/sglang/srt/entrypoints/verl_engine.py
python/sglang/srt/entrypoints/verl_engine.py
+3
-2
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+4
-1
No files found.
python/sglang/srt/entrypoints/verl_engine.py
View file @
357fb2db
...
...
@@ -37,6 +37,7 @@ class VerlEngine:
monkey_patch_torch_reductions
()
self
.
_device_mesh_cpu
=
device_mesh_cpu
self
.
_tp_rank
=
device_mesh_cpu
.
get_local_rank
()
self
.
_rank
=
device_mesh_cpu
.
get_rank
()
self
.
_tp_size
=
device_mesh_cpu
.
size
()
tp_size_per_node
=
self
.
_tp_size
//
nnodes
node_rank
=
self
.
_tp_rank
//
tp_size_per_node
...
...
@@ -114,7 +115,7 @@ class VerlEngine:
# Most naive implementation, can extract tensor and send via gloo if too slow
[
output
]
=
broadcast_pyobj
(
data
=
[
output
],
rank
=
self
.
_
tp_
rank
,
rank
=
self
.
_rank
,
dist_group
=
self
.
_device_mesh_cpu
.
get_group
(),
src
=
self
.
_device_mesh_cpu
.
mesh
[
0
].
item
(),
force_cpu_device
=
False
,
...
...
@@ -157,7 +158,7 @@ class VerlEngine:
)
if
self
.
_tp_rank
==
0
:
self
.
_engine
.
tokenizer_manager
.
flush_cache
()
self
.
_engine
.
flush_cache
()
def
release_memory_occupation
(
self
):
if
self
.
_tp_rank
==
0
:
...
...
python/sglang/srt/utils.py
View file @
357fb2db
...
...
@@ -897,7 +897,10 @@ def broadcast_pyobj(
src
:
int
=
0
,
force_cpu_device
:
bool
=
True
,
):
"""Broadcast inputs from rank=0 to all other ranks with torch.dist backend."""
"""Broadcast inputs from src rank to all other ranks with torch.dist backend.
The `rank` here refer to the source rank on global process group (regardless
of dist_group argument).
"""
device
=
torch
.
device
(
"cuda"
if
torch
.
cuda
.
is_available
()
and
not
force_cpu_device
else
"cpu"
)
...
...
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