
"""simple docstring"""




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


UpperCAmelCase__      :    Optional[int]    							= logging.get_logger(__name__)

UpperCAmelCase__      :    str    							= {
    'uclanlp/visualbert-vqa': 'https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json',
    'uclanlp/visualbert-vqa-pre': 'https://huggingface.co/uclanlp/visualbert-vqa-pre/resolve/main/config.json',
    'uclanlp/visualbert-vqa-coco-pre': (
        'https://huggingface.co/uclanlp/visualbert-vqa-coco-pre/resolve/main/config.json'
    ),
    'uclanlp/visualbert-vcr': 'https://huggingface.co/uclanlp/visualbert-vcr/resolve/main/config.json',
    'uclanlp/visualbert-vcr-pre': 'https://huggingface.co/uclanlp/visualbert-vcr-pre/resolve/main/config.json',
    'uclanlp/visualbert-vcr-coco-pre': (
        'https://huggingface.co/uclanlp/visualbert-vcr-coco-pre/resolve/main/config.json'
    ),
    'uclanlp/visualbert-nlvr2': 'https://huggingface.co/uclanlp/visualbert-nlvr2/resolve/main/config.json',
    'uclanlp/visualbert-nlvr2-pre': 'https://huggingface.co/uclanlp/visualbert-nlvr2-pre/resolve/main/config.json',
    'uclanlp/visualbert-nlvr2-coco-pre': (
        'https://huggingface.co/uclanlp/visualbert-nlvr2-coco-pre/resolve/main/config.json'
    )
    # See all VisualBERT models at https://huggingface.co/models?filter=visual_bert
}



class 	lowerCAmelCase_						(a__  ):


				"""simple docstring"""



				__UpperCamelCase      :						Any					       =   '''visual_bert'''



				def __init__(self   ,       SCREAMING_SNAKE_CASE__=3_05_22   ,       SCREAMING_SNAKE_CASE__=7_68   ,       SCREAMING_SNAKE_CASE__=5_12   ,       SCREAMING_SNAKE_CASE__=12   ,       SCREAMING_SNAKE_CASE__=12   ,       SCREAMING_SNAKE_CASE__=30_72   ,       SCREAMING_SNAKE_CASE__="gelu"   ,       SCREAMING_SNAKE_CASE__=0.1   ,       SCREAMING_SNAKE_CASE__=0.1   ,       SCREAMING_SNAKE_CASE__=5_12   ,       SCREAMING_SNAKE_CASE__=2   ,       SCREAMING_SNAKE_CASE__=0.02   ,       SCREAMING_SNAKE_CASE__=1E-12   ,       SCREAMING_SNAKE_CASE__=False   ,       SCREAMING_SNAKE_CASE__=True   ,       SCREAMING_SNAKE_CASE__=1   ,       SCREAMING_SNAKE_CASE__=0   ,       SCREAMING_SNAKE_CASE__=2   ,       **SCREAMING_SNAKE_CASE__   ,       )					->		Tuple:



											"""simple docstring"""




											super().__init__(pad_token_id=SCREAMING_SNAKE_CASE__   ,       bos_token_id=SCREAMING_SNAKE_CASE__   ,       eos_token_id=SCREAMING_SNAKE_CASE__   ,       **SCREAMING_SNAKE_CASE__    )

											SCREAMING_SNAKE_CASE__						:       List[Any]           =   vocab_size
											SCREAMING_SNAKE_CASE__						:       List[str]           =   max_position_embeddings
											SCREAMING_SNAKE_CASE__						:       str           =   hidden_size
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   visual_embedding_dim
											SCREAMING_SNAKE_CASE__						:       str           =   num_hidden_layers
											SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   num_attention_heads
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   intermediate_size
											SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   hidden_act
											SCREAMING_SNAKE_CASE__						:       Optional[int]           =   hidden_dropout_prob
											SCREAMING_SNAKE_CASE__						:       int           =   attention_probs_dropout_prob
											SCREAMING_SNAKE_CASE__						:       str           =   initializer_range
											SCREAMING_SNAKE_CASE__						:       Optional[int]           =   type_vocab_size
											SCREAMING_SNAKE_CASE__						:       List[Any]           =   layer_norm_eps
											SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   bypass_transformer
											SCREAMING_SNAKE_CASE__						:       List[str]           =   special_visual_initialize






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


				"""simple docstring"""



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



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       List[Any]           =   torch.nn.Linear(10   ,       10    )
											SCREAMING_SNAKE_CASE__						:       Optional[int]           =   torch.optim.SGD(model.parameters()   ,       0.1    )
											SCREAMING_SNAKE_CASE__						:       int           =   Accelerator()
											SCREAMING_SNAKE_CASE__						:       List[Any]           =   accelerator.prepare(SCREAMING_SNAKE_CASE__    )
											try:
																		pickle.loads(pickle.dumps(SCREAMING_SNAKE_CASE__    )    )
											except Exception as e:
																		self.fail(F'''Accelerated optimizer pickling failed with {e}'''    )
											AcceleratorState._reset_state()




