Skip to content

Commit b429796

Browse files
authored
[core] conditionally import torch distributed stuff. (#12420)
conditionally import torch distributed stuff.
1 parent 9ae5b62 commit b429796

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/diffusers/models/attention_dispatch.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Literal, Optional, Tuple, Union
2121

2222
import torch
23-
import torch.distributed._functional_collectives as funcol
23+
24+
25+
if torch.distributed.is_available():
26+
import torch.distributed._functional_collectives as funcol
2427

2528
from ..utils import (
2629
get_logger,

0 commit comments

Comments
 (0)