Skip to content

Commit daa215d

Browse files
committed
update USE_DISTRIBUTED=0 test
1 parent 19324fa commit daa215d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/tests_fabric/utilities/test_imports.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ def test_import_fabric_with_torch_dist_unavailable():
2323
code = dedent(
2424
"""
2525
import torch
26+
try:
27+
# PyTorch 2.5 relies on torch,distributed._composable.fsdp not
28+
# existing with USE_DISTRIBUTED=0
29+
import torch._dynamo.variables.functions
30+
torch._dynamo.variables.functions._fsdp_param_group = None
31+
except ImportError:
32+
pass
2633
2734
# pretend torch.distributed not available
2835
for name in list(torch.distributed.__dict__.keys()):
@@ -31,6 +38,11 @@ def test_import_fabric_with_torch_dist_unavailable():
3138
3239
torch.distributed.is_available = lambda: False
3340
41+
# needed for Dynamo in PT 2.5+ compare the torch.distributed source
42+
class _ProcessGroupStub:
43+
pass
44+
torch.distributed.ProcessGroup = _ProcessGroupStub
45+
3446
import lightning.fabric
3547
"""
3648
)

0 commit comments

Comments
 (0)