Skip to content

Commit c62c8f1

Browse files
authored
Do not attempt to import distributed primitives on MacOS
As PyTorch is by default compiled without distributed support on Mac
1 parent 8c715c5 commit c62c8f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tp.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
import torch
1010
import torch.distributed as dist
1111
from torch import nn
12-
from torch.distributed import _functional_collectives as funcol
12+
if os.uname().sysname != "Darwin":
13+
from torch.distributed import _functional_collectives as funcol
14+
else:
15+
# Distributed is not supported on MacOS
16+
funcol = None
1317

1418
from model import Attention, FeedForward, Transformer
1519
from quantize import WeightOnlyInt4Linear

0 commit comments

Comments
 (0)