Skip to content

Commit d9bddca

Browse files
authored
readability deepspeed condition (Lightning-AI#17232)
1 parent fd4697c commit d9bddca

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/lightning/fabric/strategies/deepspeed.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@
4040
_DEEPSPEED_AVAILABLE = (
4141
# DeepSpeed fails under 0.8.2 with torch 2.0: https://github.com/microsoft/DeepSpeed/pull/2863
4242
RequirementCache("deepspeed>=0.8.2")
43-
or not _TORCH_GREATER_EQUAL_2_0
44-
# check packaging because of https://github.com/microsoft/DeepSpeed/pull/2771
45-
# remove the packaging check when min version is >=0.8.1
46-
and RequirementCache("deepspeed")
47-
and RequirementCache("packaging>=20.0")
43+
or (
44+
not _TORCH_GREATER_EQUAL_2_0
45+
and RequirementCache("deepspeed")
46+
# check packaging because of https://github.com/microsoft/DeepSpeed/pull/2771
47+
# remove the packaging check when min version is >=0.8.1
48+
and RequirementCache("packaging>=20.0")
49+
)
4850
)
4951
if TYPE_CHECKING and _DEEPSPEED_AVAILABLE:
5052
import deepspeed

0 commit comments

Comments
 (0)