Skip to content

Commit e7c3bbf

Browse files
committed
fix horovod
1 parent dd9eb49 commit e7c3bbf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytorch_lightning/trainer/connectors/accelerator_connector.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575

7676
log = logging.getLogger(__name__)
7777

78+
if _HOROVOD_AVAILABLE:
79+
import horovod.torch as hvd
80+
7881

7982
class AcceleratorConnector:
8083
def __init__(
@@ -562,8 +565,6 @@ def handle_horovod(self):
562565
"Install with \n $HOROVOD_WITH_PYTORCH=1 pip install horovod[pytorch]"
563566
)
564567

565-
import horovod.torch as hvd
566-
567568
hvd.init()
568569
if isinstance(self.accelerator, GPUAccelerator):
569570
# Horovod assigns one local GPU per process

0 commit comments

Comments
 (0)