Skip to content

Commit 2529fdf

Browse files
committed
up
1 parent 94d671d commit 2529fdf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/diffusers/utils/distributed_utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
# limitations under the License.
1414

1515

16-
try:
17-
import torch
18-
except ImportError:
19-
torch = None
16+
from .import_utils import is_torch_available
2017

2118

2219
def is_torch_dist_rank_zero() -> bool:
23-
if torch is None:
20+
if not is_torch_available():
2421
return True
2522

23+
import torch
24+
2625
dist_module = getattr(torch, "distributed", None)
2726
if dist_module is None or not dist_module.is_available():
2827
return True

0 commit comments

Comments
 (0)