File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -64,22 +64,27 @@ class FRAMEWORK(Enum):
6464except (ImportError , ModuleNotFoundError ):
6565 _torch_dist_imported = None
6666
67-
6867try :
6968 import horovod .torch as hvd
7069
7170 # This redundant import is necessary because horovod does not raise an ImportError if the library is not present
7271 import torch # noqa
72+ #make sure the library is correctly imported
73+ hvd .init ()
7374
7475 _hvd_imported = hvd
76+ except AttributeError :
77+ _hvd_imported = None
78+ print ("horovod.torch is not correctly imported." )
79+ raise
7580except (ModuleNotFoundError , ImportError ):
7681 try :
7782 import horovod .tensorflow as hvd
7883
7984 _hvd_imported = hvd
8085 except (ModuleNotFoundError , ImportError ):
8186 _hvd_imported = None
82-
87+ raise
8388
8489logger = get_logger ()
8590error_handling_agent = (
You can’t perform that action at this time.
0 commit comments