[feat] Add explicit /start_weight_update and /finish_weight_update APIs for weight transfer (#39212)

This commit is contained in:
Sumanth R Hegde
2026-05-08 18:03:33 -07:00
committed by GitHub
parent 30f519e947
commit e3b65a5ba0
19 changed files with 287 additions and 53 deletions
+20
View File
@@ -1908,6 +1908,20 @@ class LLM:
"init_weight_transfer_engine", kwargs={"init_info": init_info_dict}
)
def start_weight_update(self, is_checkpoint_format: bool = True) -> None:
"""
Start a new weight update.
Args:
is_checkpoint_format: Whether incoming weights are in checkpoint
format (need layerwise processing) or kernel format (direct
copy).
"""
self.llm_engine.collective_rpc(
"start_weight_update",
kwargs={"is_checkpoint_format": is_checkpoint_format},
)
def update_weights(self, request: WeightTransferUpdateRequest | dict) -> None:
"""
Update the weights of the model.
@@ -1923,6 +1937,12 @@ class LLM:
"update_weights", kwargs={"update_info": update_info_dict}
)
def finish_weight_update(self) -> None:
"""
Finish the current weight update.
"""
self.llm_engine.collective_rpc("finish_weight_update")
def __repr__(self) -> str:
"""Return a transformers-style hierarchical view of the model."""
# Cache the result to avoid repeated collective_rpc calls