Skip to content

Commit 2129388

Browse files
committed
fix horovod
1 parent a0f80a6 commit 2129388

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pytorch_lightning/strategies/horovod.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
class HorovodStrategy(ParallelStrategy):
3737
"""Plugin for Horovod distributed training integration."""
3838

39-
distributed_backend = "horovod"
39+
# distributed_backend = "horovod"
4040

4141
def __init__(
4242
self,
@@ -197,11 +197,15 @@ def _filter_named_parameters(model: nn.Module, optimizer: Optimizer) -> List[Tup
197197

198198
@classmethod
199199
def register_strategies(cls, strategy_registry: Dict) -> None:
200-
strategy_registry.register(
201-
cls.distributed_backend,
202-
cls,
203-
description=f"{cls.__class__.__name__} Strategy",
204-
)
200+
if _HOROVOD_AVAILABLE:
201+
import horovod.torch as hvd
202+
hvd.init()
203+
204+
strategy_registry.register(
205+
cls.distributed_backend,
206+
cls,
207+
description=f"{cls.__class__.__name__} Strategy",
208+
)
205209

206210
def teardown(self) -> None:
207211
super().teardown()

0 commit comments

Comments
 (0)