We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2529fdf commit 8193f38Copy full SHA for 8193f38
1 file changed
src/diffusers/utils/distributed_utils.py
@@ -13,15 +13,16 @@
13
# limitations under the License.
14
15
16
-from .import_utils import is_torch_available
+try:
17
+ import torch
18
+except ImportError:
19
+ torch = None
20
21
22
def is_torch_dist_rank_zero() -> bool:
- if not is_torch_available():
23
+ if torch is None:
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