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
4 changes: 4 additions & 0 deletions skyrl-train/skyrl_train/workers/megatron/megatron_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def init_worker_process_group(self):
if not torch.distributed.is_initialized():
torch.distributed.init_process_group(backend="nccl")

# Explicitly wrap torch.distributed.broadcast in torch.no_grad() to avoid a warning in Megatron training where the
# autograd engine tries to track gradients through the default Torch kernel. This fixes a deprecated behaviour in
# PyTorch, preventing potential silent errors in future versions.

if not getattr(torch.distributed, "_skyrl_broadcast_no_grad_patched", False):
_orig_broadcast = torch.distributed.broadcast

Expand Down
Loading