[Core][Frontend] Add weight version tagging for RL rollouts (#49040)
Signed-off-by: Shuolei Wang <shuoleiwang123@gmail.com> Signed-off-by: Shuolei Wang <948904026@qq.com>
This commit is contained in:
@@ -1247,7 +1247,7 @@ class RecordingClient:
|
||||
self.order.append("update")
|
||||
self.last_update_info = update_info
|
||||
|
||||
def finish_weight_update(self) -> None:
|
||||
def finish_weight_update(self, weight_version: str | None = None) -> None:
|
||||
self.order.append("finish")
|
||||
|
||||
|
||||
@@ -1303,6 +1303,10 @@ class TestTrainerClients:
|
||||
assert isinstance(update_req, WeightTransferUpdateRequest)
|
||||
assert update_req.update_info == {"names": ["w"]}
|
||||
|
||||
client.finish_weight_update("step-42")
|
||||
handle.finish_weight_update.remote.assert_called_once_with()
|
||||
handle.update_weight_version.remote.assert_called_once_with("step-42")
|
||||
|
||||
def test_http_client_pickles_ipc_handles_for_json(self, monkeypatch):
|
||||
"""HTTP update_weights must encode raw ipc_handles as a base64 pickle."""
|
||||
captured = {}
|
||||
@@ -1334,6 +1338,9 @@ class TestTrainerClients:
|
||||
client.update_weights(update_info)
|
||||
assert captured["json"]["update_info"] == update_info
|
||||
|
||||
client.finish_weight_update("step-42")
|
||||
assert captured["json"] == {"weight_version": "step-42"}
|
||||
|
||||
|
||||
class TestModuleSource:
|
||||
"""`ModuleSource` metadata vs. materialized iteration (dense, no GPU)."""
|
||||
|
||||
@@ -148,6 +148,7 @@ def test_openapi_stateless(case: schemathesis.Case):
|
||||
"/start_draft_weight_update",
|
||||
"/update_weights",
|
||||
"/finish_weight_update",
|
||||
"/update_weight_version",
|
||||
):
|
||||
return
|
||||
|
||||
|
||||
@@ -234,6 +234,7 @@ def test_update_weights_calls_engine():
|
||||
assert shapes == test_shapes
|
||||
|
||||
llm.finish_weight_update()
|
||||
assert llm.get_weight_version() == "default"
|
||||
|
||||
|
||||
@create_new_process_for_each_test()
|
||||
@@ -259,6 +260,8 @@ def test_full_weight_transfer_flow():
|
||||
weight_transfer_config=WeightTransferConfig(backend="nccl"),
|
||||
)
|
||||
|
||||
assert llm.get_weight_version() == "default"
|
||||
|
||||
# Step 1: Initialize weight transfer engine
|
||||
llm.init_weight_transfer_engine(
|
||||
WeightTransferInitRequest(init_info={"test_param": "flow_test"})
|
||||
@@ -278,8 +281,15 @@ def test_full_weight_transfer_flow():
|
||||
)
|
||||
)
|
||||
|
||||
assert llm.get_weight_version() == "default"
|
||||
|
||||
# Step 4: Finish weight update
|
||||
llm.finish_weight_update()
|
||||
llm.finish_weight_update("step-42")
|
||||
|
||||
assert llm.get_weight_version() == "step-42"
|
||||
|
||||
llm.update_weight_version("manual-version")
|
||||
assert llm.get_weight_version() == "manual-version"
|
||||
|
||||
# Verify the full flow completed
|
||||
def check_flow(self):
|
||||
|
||||
Reference in New Issue
Block a user