Skip to content

Commit 12f89bb

Browse files
committed
do not call partial state if not initialized
1 parent 348aaba commit 12f89bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/accelerate/accelerator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def __init__(
329329

330330
if deepspeed_plugins is None:
331331
# First check if we're creating another `Accelerator` w/o setting `deepspeed_plugin`
332-
if PartialState._shared_state != {} and PartialState().distributed_type == DistributedType.DEEPSPEED:
332+
if AcceleratorState._shared_state != {} and AcceleratorState().distributed_type == DistributedType.DEEPSPEED:
333333
deepspeed_plugins = AcceleratorState().deepspeed_plugins
334334
else:
335335
# init from env variables
@@ -339,8 +339,8 @@ def __init__(
339339
else:
340340
# If we're creating a second `Accelerator`, users shouldn't be passing in a `deepspeed_plugin`
341341
if (
342-
PartialState().distributed_type == DistributedType.DEEPSPEED
343-
and AcceleratorState._shared_state != {}
342+
AcceleratorState._shared_state != {}
343+
and AcceleratorState().distributed_type == DistributedType.DEEPSPEED
344344
and AcceleratorState().deepspeed_plugins is not None
345345
):
346346
raise NotImplementedError(

0 commit comments

Comments
 (0)