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():
117117 code = dedent (
118118 """
119119 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
120127
121128 # pretend torch.distributed not available
122129 for name in list(torch.distributed.__dict__.keys()):
@@ -125,6 +132,11 @@ def test_import_pytorch_lightning_with_torch_dist_unavailable():
125132
126133 torch.distributed.is_available = lambda: False
127134
135+ # needed for Dynamo in PT 2.5+ compare the torch.distributed source
136+ class _ProcessGroupStub:
137+ pass
138+ torch.distributed.ProcessGroup = _ProcessGroupStub
139+
128140 import lightning.pytorch
129141 """
130142 )
You can’t perform that action at this time.
0 commit comments