Skip to content

Commit 82d0a47

Browse files
committed
up
1 parent 7242b5f commit 82d0a47

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/diffusers/hooks/context_parallel.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
from typing import Dict, List, Type, Union
1818

1919
import torch
20-
import torch.distributed._functional_collectives as funcol
21-
22-
from ..models._modeling_parallel import (
23-
ContextParallelConfig,
24-
ContextParallelInput,
25-
ContextParallelModelPlan,
26-
ContextParallelOutput,
27-
)
20+
21+
22+
if torch.distributed.is_available():
23+
import torch.distributed._functional_collectives as funcol
24+
25+
from ..models._modeling_parallel import (
26+
ContextParallelConfig,
27+
ContextParallelInput,
28+
ContextParallelModelPlan,
29+
ContextParallelOutput,
30+
)
2831
from ..utils import get_logger
2932
from ..utils.torch_utils import unwrap_module
3033
from .hooks import HookRegistry, ModelHook

0 commit comments

Comments
 (0)