Skip to content
Open
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
3 changes: 2 additions & 1 deletion verl/trainer/fsdp_sft_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ def _compute_loss_and_backward(self, batch, do_backward=True, n_micro_batches=1)

if self.config.data.balance_dp_token:
torch.distributed.all_reduce(valid_token_this_rank)
dp_size = self.ulysses_device_mesh.size("dp") if use_sp else torch.distributed.get_world_size()
# Valid token is reduced over all ranks (including SP ranks), set dp size to world size
dp_size = torch.distributed.get_world_size()
else:
dp_size = 1

Expand Down