@@ -495,9 +495,10 @@ class DeepSpeedEngine(Module):
...
@@ -495,9 +495,10 @@ class DeepSpeedEngine(Module):
# After the distributed backend is initialized we are guaranteed the LOCAL_RANK
# After the distributed backend is initialized we are guaranteed the LOCAL_RANK
# environment variable is set. We must align args.local_rank to this value for
# environment variable is set. We must align args.local_rank to this value for
# backwards compatability with scripts relying on [args|self].local_rank containing
# backwards compatability with scripts relying on [args|self].local_rank containing
# the correct local rank info.
# the correct local rank info. _do_args_sanity_check will ensure this is the case.
args.local_rank=int(os.environ['LOCAL_RANK'])
self.local_rank=int(os.environ['LOCAL_RANK'])
self.local_rank=args.local_rank
ifhasattr(args,'local_rank'):
args.local_rank=self.local_rank
config_file=args.deepspeed_configifhasattr(args,
config_file=args.deepspeed_configifhasattr(args,
'deepspeed_config')elseNone
'deepspeed_config')elseNone
...
@@ -513,15 +514,14 @@ class DeepSpeedEngine(Module):
...
@@ -513,15 +514,14 @@ class DeepSpeedEngine(Module):
assertargs.deepspeed_configisNone,"Not sure how to proceed, we were given both a deepscale_config and deepspeed_config"
assertargs.deepspeed_configisNone,"Not sure how to proceed, we were given both a deepscale_config and deepspeed_config"
args.deepspeed_config=args.deepscale_config
args.deepspeed_config=args.deepscale_config
local_rank_err="DeepSpeed requires a command line parameter of --local_rank [int] and/or setting the LOCAL_RANK environment variable."
assert"LOCAL_RANK"inos.environ,"DeepSpeed requires the LOCAL_RANK environment variable, it is set by the deepspeed launcher, " \
ifhasattr(args,'local_rank'):
"deepspeed.init_distributed, or the torch.distributed launcher. If using a different launcher please ensure LOCAL_RANK is set prior to initializing deepspeed."