From cc429592d570e4cda5ba3bd89482169476822d70 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 30 Mar 2023 10:36:27 +0200 Subject: [PATCH] ensure deepspeed condition --- src/lightning/fabric/strategies/deepspeed.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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