Skip to content

Commit

Permalink
Add try-except block for deepspeed import handling
Browse files Browse the repository at this point in the history
Signed-off-by: abdullah-ibm <abdullah@ibm.com>
  • Loading branch information
abdullah-ibm committed Oct 13, 2024
1 parent f33994d commit c274e44
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/instructlab/training/main_ds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0

# Standard
from copy import deepcopy
Expand All @@ -12,8 +12,18 @@

# Third Party
from accelerate import Accelerator
from deepspeed.ops.adam import DeepSpeedCPUAdam, FusedAdam
from deepspeed.runtime.zero.utils import ZeRORuntimeException
try:
from deepspeed.ops.adam import DeepSpeedCPUAdam, FusedAdam
except ImportError:
DeepSpeedCPUAdam = None
FusedAdam = None
print("DeepSpeed Adam optimizers are not available. Some features may be unavailable.")

try:
from deepspeed.runtime.zero.utils import ZeRORuntimeException
except ImportError:
ZeRORuntimeException = None
print("ZeRORuntimeException is not available. Some features may be unavailable.")

# pylint: disable=no-name-in-module
from instructlab.dolomite.hf_models import GPTDolomiteForCausalLM
Expand Down

0 comments on commit c274e44

Please sign in to comment.