diff --git a/src/lightning/fabric/strategies/deepspeed.py b/src/lightning/fabric/strategies/deepspeed.py index 460d513783bf8..747e3bacda3d7 100644 --- a/src/lightning/fabric/strategies/deepspeed.py +++ b/src/lightning/fabric/strategies/deepspeed.py @@ -40,11 +40,13 @@ _DEEPSPEED_AVAILABLE = ( # DeepSpeed fails under 0.8.2 with torch 2.0: https://github.com/microsoft/DeepSpeed/pull/2863 RequirementCache("deepspeed>=0.8.2") - or not _TORCH_GREATER_EQUAL_2_0 - # check packaging because of https://github.com/microsoft/DeepSpeed/pull/2771 - # remove the packaging check when min version is >=0.8.1 - and RequirementCache("deepspeed") - and RequirementCache("packaging>=20.0") + or ( + not _TORCH_GREATER_EQUAL_2_0 + and RequirementCache("deepspeed") + # check packaging because of https://github.com/microsoft/DeepSpeed/pull/2771 + # remove the packaging check when min version is >=0.8.1 + and RequirementCache("packaging>=20.0") + ) ) if TYPE_CHECKING and _DEEPSPEED_AVAILABLE: import deepspeed