Skip to content

Commit

Permalink
Added FSDP distributed strategy (#3026)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaddair committed Jan 30, 2023
1 parent 35fde29 commit b5139c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ludwig/distributed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ def load_ddp():
return DDPStrategy


def load_fsdp():
from ludwig.distributed.fsdp import FSDPStrategy

return FSDPStrategy


def load_horovod():
from ludwig.distributed.horovod import HorovodStrategy

Expand All @@ -20,7 +26,7 @@ def load_local():
return LocalStrategy


STRATEGIES = {"ddp": load_ddp, "horovod": load_horovod, "local": load_local}
STRATEGIES = {"ddp": load_ddp, "fsdp": load_fsdp, "horovod": load_horovod, "local": load_local}


def get_current_dist_strategy(allow_local=True) -> Type[DistributedStrategy]:
Expand Down
3 changes: 3 additions & 0 deletions ludwig/distributed/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
class DDPStrategy(DistributedStrategy):
def __init__(self):
self._local_rank, self._local_size = local_rank_and_size()
self._log_on_init()

def _log_on_init(self):
logging.info("Using DDP strategy")

def wrap_model(self, model: nn.Module) -> nn.Module:
Expand Down

0 comments on commit b5139c7

Please sign in to comment.