[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
@@ -1361,6 +1361,13 @@ class TestTrainerClients:
|
||||
{"gpu": ("args",)}
|
||||
]
|
||||
|
||||
client.update_weights([{"ipc_handles": {"gpu": ("args",)}}, {"names": []}])
|
||||
sent = captured["json"]["update_info"]
|
||||
assert sent[1] == {"names": []}
|
||||
assert pickle.loads(base64.b64decode(sent[0]["ipc_handles_pickled"])) == {
|
||||
"gpu": ("args",)
|
||||
}
|
||||
|
||||
def test_http_client_passes_through_nccl_update_info(self, monkeypatch):
|
||||
"""NCCL update_info has only JSON-native fields and passes unchanged."""
|
||||
captured = {}
|
||||
|
||||
@@ -118,6 +118,46 @@ def test_start_update_finish_delegates_to_engine():
|
||||
assert worker.model_runner.reset_lora_calls == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("rank", "expected"),
|
||||
[(1, {"names": ["rank-1"]}), (2, {"names": []})],
|
||||
)
|
||||
def test_rank_local_update_selects_worker_payload(rank, expected):
|
||||
engine = _RecordingEngine()
|
||||
worker = _make_worker(engine)
|
||||
worker.rank = rank
|
||||
Worker.start_weight_update(worker)
|
||||
|
||||
Worker.update_weights(
|
||||
worker, [{"names": ["rank-0"]}, {"names": ["rank-1"]}, {"names": []}]
|
||||
)
|
||||
|
||||
assert engine.update_calls == [expected]
|
||||
assert worker._weight_update_active is True
|
||||
|
||||
|
||||
def test_rank_local_update_includes_data_parallel_rank():
|
||||
engine = _RecordingEngine()
|
||||
worker = _make_worker(engine)
|
||||
worker.rank = 0
|
||||
worker.vllm_config.parallel_config.data_parallel_size = 4
|
||||
worker.vllm_config.parallel_config.data_parallel_rank = 2
|
||||
Worker.start_weight_update(worker)
|
||||
|
||||
Worker.update_weights(
|
||||
worker,
|
||||
[
|
||||
{"names": ["dp-0"]},
|
||||
{"names": ["dp-1"]},
|
||||
{"names": ["dp-2"]},
|
||||
{"names": ["dp-3"]},
|
||||
],
|
||||
)
|
||||
|
||||
assert engine.update_calls == [{"names": ["dp-2"]}]
|
||||
assert worker._weight_update_active is True
|
||||
|
||||
|
||||
def test_finish_draft_session_keeps_lora_state():
|
||||
engine = _RecordingEngine()
|
||||
engine.supports_draft_weight_update = True
|
||||
|
||||
Reference in New Issue
Block a user