[RL] Add rank-local IPC weight updates (#52497)
Signed-off-by: aoshen02 <aoshen@inferact.ai> Co-authored-by: OpenAI Codex <noreply@openai.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Roger Wang <hey@rogerw.io>
This commit is contained in:
co-authored by
OpenAI Codex
OpenAI Codex
Roger Wang
parent
a5f82882a6
commit
ee5ae2ae70
@@ -1326,7 +1326,7 @@ class Worker(WorkerBase):
|
||||
self._weight_update_active = True
|
||||
self._weight_update_is_draft = is_draft
|
||||
|
||||
def update_weights(self, update_info: dict) -> None:
|
||||
def update_weights(self, update_info: dict | list[dict]) -> None:
|
||||
"""
|
||||
Receive one weight update chunk from the trainer.
|
||||
|
||||
@@ -1336,7 +1336,8 @@ class Worker(WorkerBase):
|
||||
/ start_draft_weight_update call selected.
|
||||
|
||||
Args:
|
||||
update_info: Dictionary containing backend-specific update info
|
||||
update_info: Backend-specific update info, or a list indexed by
|
||||
global worker rank across data parallel replicas.
|
||||
"""
|
||||
self._check_weight_transfer_engine()
|
||||
assert self.weight_transfer_engine is not None
|
||||
@@ -1348,7 +1349,15 @@ class Worker(WorkerBase):
|
||||
|
||||
with set_current_vllm_config(self.vllm_config):
|
||||
try:
|
||||
self.weight_transfer_engine.update_weights(update_info)
|
||||
if isinstance(update_info, list):
|
||||
parallel_config = self.vllm_config.parallel_config
|
||||
local_update_info = update_info[
|
||||
parallel_config.data_parallel_rank * parallel_config.world_size
|
||||
+ self.rank
|
||||
]
|
||||
else:
|
||||
local_update_info = update_info
|
||||
self.weight_transfer_engine.update_weights(local_update_info)
|
||||
except BaseException:
|
||||
self._weight_update_active = False
|
||||
self.weight_transfer_engine.reset_weight_update_target()
|
||||
|
||||
Reference in New Issue
Block a user