Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions areal/trainer/rl_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ def _save_hf(self, epoch: int, epoch_step: int, global_step: int):
name="critic",
)
# Async mode: synchronization handled by AsyncCheckpointManager
if not self.saver.is_async:
if not self.saver.is_async and not is_single_controller():
dist.barrier(group=self.actor.cpu_group)
Comment thread
Adiactive marked this conversation as resolved.
current_platform.synchronize()

Expand All @@ -1139,8 +1139,9 @@ def _save_recover_checkpoint(self, epoch: int, epoch_step: int, global_step: int
processor=self.processor,
)

dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()
if not is_single_controller():
dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()

def _evaluate_fn(
self,
Expand All @@ -1161,8 +1162,9 @@ def _evaluate_fn(
cnt += 1
self.eval_rollout.wait(cnt, timeout=None)

dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()
if not is_single_controller():
dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()

def _evaluate(
self,
Expand All @@ -1188,8 +1190,9 @@ def _evaluate(
epoch_step,
global_step,
)
dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()
if not is_single_controller():
dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()

def _export_and_commit_stats(self, epoch: int, epoch_step: int, global_step: int):
# Upload statistics to the logger (e.g., wandb)
Expand All @@ -1199,8 +1202,9 @@ def _export_and_commit_stats(self, epoch: int, epoch_step: int, global_step: int
stats.update(self.eval_rollout.export_stats())
self.stats_logger.commit(epoch, epoch_step, global_step, stats)

dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()
if not is_single_controller():
dist.barrier(group=self.actor.cpu_group)
current_platform.synchronize()

def _validate_cfg(self):
"""validate config for incompatible settings before weight initialization, to avoid wasted resources on spawning workers and loading models."""
Expand Down
Loading