Synchronize model weights.
(self)
| 478 | ) |
| 479 | |
| 480 | async def sync_weight(self) -> None: |
| 481 | """Synchronize model weights.""" |
| 482 | # call this method before training start to load the latest model weights |
| 483 | if self.rollout_coordinator is not None and self.explore_step_num == 0: |
| 484 | await self._finish_eval_step(step=0) |
| 485 | |
| 486 | self.logger.info(f"Explorer sync_weights at step {self.explore_step_num} started.") |
| 487 | if self.use_nccl_sync: |
| 488 | await self._nccl_weights_update() |
| 489 | else: # pull weights from Synchronizer |
| 490 | await self._pull_latest_weights() |
| 491 | self.logger.info( |
| 492 | f"Explorer sync_weights at step {self.explore_step_num} finished, model version = {self.model_version}." |
| 493 | ) |
| 494 | |
| 495 | await self.save_checkpoint() |
| 496 | |
| 497 | async def _finish_steps(self, start_step: int, end_step: int) -> None: |
| 498 | for step in range(start_step, end_step + 1): |
no test coverage detected