

"""simple docstring"""




from ...configuration_utils import PretrainedConfig
from ...utils import logging


A_				:      List[str]           =			logging.get_logger(__name__)

A_				:      Optional[int]           =			{"ctrl": "https://huggingface.co/ctrl/resolve/main/config.json"}





class  lowerCamelCase    (A__      ):
			lowerCamelCase__ :		Tuple       		=				'ctrl'
			lowerCamelCase__ :		Dict       		=				['past_key_values']
			lowerCamelCase__ :		Any       		=				{
			    'max_position_embeddings': 'n_positions',
			    'hidden_size': 'n_embd',
			    'num_attention_heads': 'n_head',
			    'num_hidden_layers': 'n_layer',
			}

			def __init__(       self					:    Dict     ,					__UpperCAmelCase					:    Tuple=2_4_6_5_3_4     ,					__UpperCAmelCase					:    str=2_5_6     ,					__UpperCAmelCase					:    Any=1_2_8_0     ,					__UpperCAmelCase					:    List[str]=8_1_9_2     ,					__UpperCAmelCase					:    int=4_8     ,					__UpperCAmelCase					:    List[Any]=1_6     ,					__UpperCAmelCase					:    List[Any]=0.1     ,					__UpperCAmelCase					:    List[Any]=0.1     ,					__UpperCAmelCase					:    Optional[int]=1e-6     ,					__UpperCAmelCase					:    Any=0.02     ,					__UpperCAmelCase					:    Union[str, Any]=True     ,					**__UpperCAmelCase					:    str     ,					) ->     int:
						SCREAMING_SNAKE_CASE__										=   vocab_size
						SCREAMING_SNAKE_CASE__										=   n_positions
						SCREAMING_SNAKE_CASE__										=   n_embd
						SCREAMING_SNAKE_CASE__										=   n_layer
						SCREAMING_SNAKE_CASE__										=   n_head
						SCREAMING_SNAKE_CASE__										=   dff
						SCREAMING_SNAKE_CASE__										=   resid_pdrop
						SCREAMING_SNAKE_CASE__										=   embd_pdrop
						SCREAMING_SNAKE_CASE__										=   layer_norm_epsilon
						SCREAMING_SNAKE_CASE__										=   initializer_range

						SCREAMING_SNAKE_CASE__										=   use_cache

						super().__init__(**__UpperCAmelCase							)





"""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()


