Skip to content

Commit

Permalink
Including support for Deepspeed 0.8.0 (#14506)
Browse files Browse the repository at this point in the history
### Description
Including Support for Deepspeed 0.8.0.



### Motivation and Context
Deepspeed 0.8.0 has a bug fix and mlfow integration.
  • Loading branch information
ajindal1 authored and rui-ren committed Feb 3, 2023
1 parent e9d2034 commit f63cbeb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion orttraining/orttraining/python/training/optim/_ds_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,27 @@ def can_be_modified(self):
# it's safe to update the version supporting list. Otherwise, or the file is moved or renamed,
# we need to check the implementation of these functions in detail.
ds_version = Version(deepspeed.__version__)
if ds_version > Version("0.7.3") or ds_version < Version("0.4.0"):
if ds_version > Version("0.8.0") or ds_version < Version("0.4.0"):
warnings.warn(
"Skip modifying optimizer because of unsupported DeepSpeed version {}, "
"supported version: 0.4.0 - 0.7.3.".format(deepspeed.__version__),
UserWarning,
)
return False

try:
from deepspeed.accelerator import get_accelerator
except ImportError as e:
warnings.warn("Unable to import get_accelerator from deepspeed.accelerator", UserWarning)
else:
if not get_accelerator().device_name().startswith("cuda"):
warnings.warn(
"Skip modifying optimizer as device is not supported, "
"device name: {}".format(get_accelerator().device_name()),
UserWarning,
)
return False

return self.check_requirements(
["has_overflow_serial", "get_grad_norm_direct", "has_overflow_partitioned_grads_serial"],
require_apex=False,
Expand Down

0 comments on commit f63cbeb

Please sign in to comment.