[Bugfix][KVConnector] Finalize saves on steps without a forward (#57775)

Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
Yifan Qiao
2026-09-25 00:06:36 +00:00
committed by GitHub
co-authored by OpenAI Codex Kimi Code
parent 7833ff25dd
commit b3a87b2d04
11 changed files with 56 additions and 37 deletions
+4 -9
View File
@@ -35,9 +35,7 @@ class KVConnector:
def finish_forward(self) -> None:
pass
def post_forward(
self, finished_req_ids: set[str], wait_for_save: bool = True
) -> KVConnectorOutput | None:
def post_forward(self, finished_req_ids: set[str]) -> KVConnectorOutput | None:
return None
def no_forward(self, scheduler_output: "SchedulerOutput") -> ModelRunnerOutput:
@@ -97,9 +95,7 @@ class ActiveKVConnector(KVConnector):
def reset_capture_state(self) -> None:
self.kv_connector.reset_capture_state()
def post_forward(
self, finished_req_ids: set[str], wait_for_save: bool = True
) -> KVConnectorOutput | None:
def post_forward(self, finished_req_ids: set[str]) -> KVConnectorOutput | None:
if self._disabled:
return None
@@ -107,8 +103,7 @@ class ActiveKVConnector(KVConnector):
self._start_load_kv()
output = KVConnectorOutput()
if wait_for_save:
self.kv_connector.wait_for_save()
self.kv_connector.wait_for_save()
transfer_results = self.kv_connector.get_transfer_results(finished_req_ids)
output.finished_sending = transfer_results.finished_sending or None
output.finished_recving = transfer_results.finished_recving or None
@@ -129,7 +124,7 @@ class ActiveKVConnector(KVConnector):
self.pre_forward(scheduler_output)
self.finish_forward()
finished_req_ids = scheduler_output.finished_req_ids
kv_connector_output = self.post_forward(finished_req_ids, wait_for_save=False)
kv_connector_output = self.post_forward(finished_req_ids)
return ModelRunnerOutput.with_kv_conn_output_only(kv_connector_output)
def set_disabled(self, disabled: bool) -> None: