Skip to content

Commit

Permalink
Only initialize when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
pomonam committed Jul 7, 2024
1 parent 2df875b commit c918176
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kronfluence/utils/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def apply_fsdp(
RuntimeError:
If the distributed initialization fails.
"""
dist.init_process_group("nccl", rank=rank, world_size=world_size)
if not dist.is_initialized():
dist.init_process_group("nccl", rank=rank, world_size=world_size)
device = torch.device(f"cuda:{local_rank}")
torch.cuda.set_device(local_rank)

Expand Down

0 comments on commit c918176

Please sign in to comment.