File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
tests/tests_pytorch/utilities Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,13 @@ def test_import_pytorch_lightning_with_torch_dist_unavailable():
117
117
code = dedent (
118
118
"""
119
119
import torch
120
+ try:
121
+ # PyTorch 2.5 relies on torch,distributed._composable.fsdp not
122
+ # existing with USE_DISTRIBUTED=0
123
+ import torch._dynamo.variables.functions
124
+ torch._dynamo.variables.functions._fsdp_param_group = None
125
+ except ImportError:
126
+ pass
120
127
121
128
# pretend torch.distributed not available
122
129
for name in list(torch.distributed.__dict__.keys()):
@@ -125,6 +132,11 @@ def test_import_pytorch_lightning_with_torch_dist_unavailable():
125
132
126
133
torch.distributed.is_available = lambda: False
127
134
135
+ # needed for Dynamo in PT 2.5+ compare the torch.distributed source
136
+ class _ProcessGroupStub:
137
+ pass
138
+ torch.distributed.ProcessGroup = _ProcessGroupStub
139
+
128
140
import lightning.pytorch
129
141
"""
130
142
)
You can’t perform that action at this time.
0 commit comments