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
ffb32a85
Unverified
Commit
ffb32a85
authored
Nov 03, 2025
by
harrisonlimh
Committed by
GitHub
Nov 03, 2025
Browse files
Conditionally recapture cuda graph after model weight update from disk (#12060)
parent
14d80648
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
python/sglang/srt/managers/io_struct.py
python/sglang/srt/managers/io_struct.py
+2
-0
python/sglang/srt/managers/tp_worker.py
python/sglang/srt/managers/tp_worker.py
+1
-1
python/sglang/srt/model_executor/model_runner.py
python/sglang/srt/model_executor/model_runner.py
+4
-0
No files found.
python/sglang/srt/managers/io_struct.py
View file @
ffb32a85
...
...
@@ -1024,6 +1024,8 @@ class UpdateWeightFromDiskReqInput(BaseReq):
torch_empty_cache
:
bool
=
False
# Whether to keep the scheduler paused after weight update
keep_pause
:
bool
=
False
# Whether to recapture cuda graph after weight udpdate
recapture_cuda_graph
:
bool
=
False
# The trainer step id. Used to know which step's weights are used for sampling.
token_step
:
int
=
0
...
...
python/sglang/srt/managers/tp_worker.py
View file @
ffb32a85
...
...
@@ -100,7 +100,7 @@ class BaseTpWorker(ABC):
def
update_weights_from_disk
(
self
,
recv_req
:
UpdateWeightFromDiskReqInput
):
success
,
message
=
self
.
model_runner
.
update_weights_from_disk
(
recv_req
.
model_path
,
recv_req
.
load_format
recv_req
.
model_path
,
recv_req
.
load_format
,
recv_req
.
recapture_cuda_graph
)
return
success
,
message
...
...
python/sglang/srt/model_executor/model_runner.py
View file @
ffb32a85
...
...
@@ -862,6 +862,7 @@ class ModelRunner:
model_path
:
str
,
load_format
:
str
,
weight_name_filter
:
Optional
[
Callable
[[
str
],
bool
]]
=
None
,
recapture_cuda_graph
:
bool
=
False
,
)
->
tuple
[
bool
,
str
]:
"""Update engine weights in-place from the disk."""
logger
.
info
(
...
...
@@ -917,6 +918,9 @@ class ModelRunner:
self
.
server_args
.
load_format
=
load_format
self
.
load_config
=
load_config
if
recapture_cuda_graph
and
self
.
device
==
"cuda"
:
self
.
init_device_graphs
()
logger
.
info
(
"Update weights end."
)
return
True
,
"Succeeded to update model weights."
...
...
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