def _exec_pipeline_swap_step(self, cur_step, arg_mbs, kwarg_mbs):
"""Execute a pipeline activation-swap control step."""
if self._swap_session is None:
raise RuntimeError("Pipeline swap step executed without an active run session.")
if cur_step.type == MetaStepType.SWAP_LAUNCH_OFFLOAD:
swap_launch_offload(cur_step, self, arg_mbs, kwarg_mbs, self._swap_session)
elif cur_step.type == MetaStepType.SWAP_WAIT_OFFLOAD:
swap_wait_offload(cur_step, self._swap_session)
elif cur_step.type == MetaStepType.SWAP_LAUNCH_LOAD:
swap_launch_load(cur_step, self._swap_session)
elif cur_step.type == MetaStepType.SWAP_WAIT_LOAD:
swap_wait_load(cur_step, self._swap_session)
def run_microbatches(self, arg_mbs: list, kwarg_mbs: list, losses: list) -> None: