


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


__a     =			logging.get_logger(__name__)

__a     =			{
    """unc-nlp/lxmert-base-uncased""": """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json""",
}






class   __lowercase				(  __snake_case  ):
      UpperCamelCase								=       '''lxmert'''
      UpperCamelCase								=       {}





      def __init__(		self						:					Optional[int]					,       __lowerCamelCase						:					Dict=3_0_5_2_2					,       __lowerCamelCase						:					List[Any]=7_6_8					,       __lowerCamelCase						:					Any=1_2					,       __lowerCamelCase						:					Optional[Any]=9_5_0_0					,       __lowerCamelCase						:					Union[str, Any]=1_6_0_0					,       __lowerCamelCase						:					Union[str, Any]=4_0_0					,       __lowerCamelCase						:					List[Any]=3_0_7_2					,       __lowerCamelCase						:					Any="gelu"					,       __lowerCamelCase						:					Optional[int]=0.1					,       __lowerCamelCase						:					Union[str, Any]=0.1					,       __lowerCamelCase						:					List[str]=5_1_2					,       __lowerCamelCase						:					int=2					,       __lowerCamelCase						:					Any=0.02					,       __lowerCamelCase						:					Union[str, Any]=1e-1_2					,       __lowerCamelCase						:					List[Any]=9					,       __lowerCamelCase						:					Tuple=5					,       __lowerCamelCase						:					List[str]=5					,       __lowerCamelCase						:					Optional[Any]=2_0_4_8					,       __lowerCamelCase						:					Optional[Any]=4					,       __lowerCamelCase						:					List[str]=6.67					,       __lowerCamelCase						:					List[Any]=True					,       __lowerCamelCase						:					Optional[Any]=True					,       __lowerCamelCase						:					Optional[Any]=True					,       __lowerCamelCase						:					str=True					,       __lowerCamelCase						:					List[Any]=True					,       __lowerCamelCase						:					Tuple=True					,       __lowerCamelCase						:					int=True					,       **__lowerCamelCase						:					Dict					,       )    ->   Any:






         """simple docstring"""







         UpperCAmelCase							=     vocab_size
         UpperCAmelCase							=     hidden_size
         UpperCAmelCase							=     num_attention_heads
         UpperCAmelCase							=     hidden_act
         UpperCAmelCase							=     intermediate_size
         UpperCAmelCase							=     hidden_dropout_prob
         UpperCAmelCase							=     attention_probs_dropout_prob
         UpperCAmelCase							=     max_position_embeddings
         UpperCAmelCase							=     type_vocab_size
         UpperCAmelCase							=     initializer_range
         UpperCAmelCase							=     layer_norm_eps
         UpperCAmelCase							=     num_qa_labels
         UpperCAmelCase							=     num_object_labels
         UpperCAmelCase							=     num_attr_labels
         UpperCAmelCase							=     l_layers
         UpperCAmelCase							=     x_layers
         UpperCAmelCase							=     r_layers
         UpperCAmelCase							=     visual_feat_dim
         UpperCAmelCase							=     visual_pos_dim
         UpperCAmelCase							=     visual_loss_normalizer
         UpperCAmelCase							=     task_matched
         UpperCAmelCase							=     task_mask_lm
         UpperCAmelCase							=     task_obj_predict
         UpperCAmelCase							=     task_qa
         UpperCAmelCase							=     visual_obj_loss
         UpperCAmelCase							=     visual_attr_loss
         UpperCAmelCase							=     visual_feat_loss
         UpperCAmelCase							=     {"""vision""": r_layers, """cross_encoder""": x_layers, """language""": l_layers}
         super().__init__(**__lowerCamelCase       )







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   __lowercase				(  unittest.TestCase  ):





      def        _lowercase				(		self						:					Any       )    ->   Union[str, Any]:






         """simple docstring"""







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



