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
90faf901
Unverified
Commit
90faf901
authored
Apr 17, 2025
by
BearBiscuit
Committed by
GitHub
Apr 16, 2025
Browse files
[verl] Modify the update_weights func to align with verl's resharding (#5345)
Co-authored-by:
Chayenne
<
zhaochen20@outlook.com
>
parent
177320a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
python/sglang/srt/entrypoints/verl_engine.py
python/sglang/srt/entrypoints/verl_engine.py
+6
-3
No files found.
python/sglang/srt/entrypoints/verl_engine.py
View file @
90faf901
...
...
@@ -12,7 +12,7 @@
# limitations under the License.
# ==============================================================================
import
os
from
typing
import
Dict
,
List
,
Literal
,
Optional
,
Tuple
,
Union
from
typing
import
Dict
,
Iterable
,
List
,
Literal
,
Optional
,
Tuple
,
Union
import
torch
import
torch.distributed
as
dist
...
...
@@ -124,7 +124,7 @@ class VerlEngine:
def
update_weights_from_tensor
(
self
,
named_tensors
:
List
[
Tuple
[
str
,
torch
.
Tensor
]],
named_tensors
:
Iterable
[
Tuple
[
str
,
torch
.
Tensor
]],
load_format
:
Optional
[
str
]
=
None
,
):
# Most naive implementation, can optimize a lot if it is bottleneck
...
...
@@ -153,9 +153,12 @@ class VerlEngine:
)
],
load_format
=
load_format
,
flush_cache
=
tensor_index
==
len
(
named_tensors
)
-
1
,
flush_cache
=
False
,
)
if
self
.
_tp_rank
==
0
:
self
.
_engine
.
tokenizer_manager
.
flush_cache
()
def
release_memory_occupation
(
self
):
if
self
.
_tp_rank
==
0
:
self
.
_engine
.
release_memory_occupation
()
...
...
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