We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 94d671d commit 2529fdfCopy full SHA for 2529fdf
1 file changed
src/diffusers/utils/distributed_utils.py
@@ -13,16 +13,15 @@
13
# limitations under the License.
14
15
16
-try:
17
- import torch
18
-except ImportError:
19
- torch = None
+from .import_utils import is_torch_available
20
21
22
def is_torch_dist_rank_zero() -> bool:
23
- if torch is None:
+ if not is_torch_available():
24
return True
25
+ import torch
+
26
dist_module = getattr(torch, "distributed", None)
27
if dist_module is None or not dist_module.is_available():
28
0 commit comments