

"""simple docstring"""




from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A_				:      Dict           =			{
    "configuration_autoformer": [
        "AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "AutoformerConfig",
    ],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A_				:      int           =			[
						    "AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "AutoformerForPrediction",
						    "AutoformerModel",
						    "AutoformerPreTrainedModel",
						]


if TYPE_CHECKING:
						from .configuration_autoformer import (
						    AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    AutoformerConfig,
						)

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_autoformer import (
												    AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    AutoformerForPrediction,
												    AutoformerModel,
												    AutoformerPreTrainedModel,
												)

else:
						import sys

						A_				:      int           =			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





"""simple docstring"""




import pickle
import unittest

import torch

from accelerate import Accelerator
from accelerate.state import AcceleratorState
from accelerate.test_utils import require_cpu





@require_cpu
class  lowerCamelCase    (unittest.TestCase      ):

			def        SCREAMING_SNAKE_CASE					(       self					:    Dict							) ->     str:
						SCREAMING_SNAKE_CASE__										=   torch.nn.Linear(1_0     ,					1_0							)
						SCREAMING_SNAKE_CASE__										=   torch.optim.SGD(model.parameters()     ,					0.1							)
						SCREAMING_SNAKE_CASE__										=   Accelerator()
						SCREAMING_SNAKE_CASE__										=   accelerator.prepare(__UpperCAmelCase							)
						try:
									pickle.loads(pickle.dumps(__UpperCAmelCase							)							)
						except Exception as e:
									self.fail(F"""Accelerated optimizer pickling failed with {e}"""							)
						AcceleratorState._reset_state()


