Skip to content

Commit 8193f38

Browse files
committed
up
1 parent 2529fdf commit 8193f38

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/diffusers/utils/distributed_utils.py

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

1515

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

1821

1922
def is_torch_dist_rank_zero() -> bool:
20-
if not is_torch_available():
23+
if torch is None:
2124
return True
2225

23-
import torch
24-
2526
dist_module = getattr(torch, "distributed", None)
2627
if dist_module is None or not dist_module.is_available():
2728
return True

0 commit comments

Comments
 (0)