[Bugfix] Fix level-2 sleep/wake/reload with enable_lora=True (#39935)

Signed-off-by: Silen Naihin <silen.naihin@gmail.com>
Co-authored-by: Dakai An <dakaian108@gmail.com>
Co-authored-by: Jiangyun Zhu <riverclouds.zhu@qq.com>
This commit is contained in:
Silen Naihin
2026-08-06 09:13:10 +08:00
committed by GitHub
co-authored by Dakai An Jiangyun Zhu
parent 8cfa01cdd2
commit b50fdebce0
11 changed files with 252 additions and 4 deletions
+6
View File
@@ -160,6 +160,7 @@ class Worker(WorkerBase):
# is available, since the engine needs a reference to the model.
self.weight_transfer_engine: WeightTransferEngine | None = None
self._weight_update_active = False
self._weight_update_is_draft = False
# Torch/CUDA profiler. Enabled and configured through profiler_config.
# Profiler wrapper is created lazily in profile() when start is called,
@@ -1272,6 +1273,7 @@ class Worker(WorkerBase):
self.weight_transfer_engine.reset_weight_update_target()
raise
self._weight_update_active = True
self._weight_update_is_draft = is_draft
def update_weights(self, update_info: dict) -> None:
"""
@@ -1316,6 +1318,10 @@ class Worker(WorkerBase):
self.weight_transfer_engine.reset_weight_update_target()
self._weight_update_active = False
# Weight transfer bypasses GPUModelRunner.reload_weights().
if not self._weight_update_is_draft:
self.model_runner.reset_lora_state()
def shutdown(self) -> None:
gc.unfreeze()