




"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase_       			=   logging.get_logger(__name__)

lowerCamelCase_       			=   {
    '''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     UpperCamelCase_ (__A  ):
	__magic_name__			   =       '''visual_bert'''





	def __init__(   self      :				str			,			lowerCAmelCase_      :				str=30_522			,			lowerCAmelCase_      :				Optional[Any]=768			,			lowerCAmelCase_      :				Union[str, Any]=512			,			lowerCAmelCase_      :				Optional[int]=12			,			lowerCAmelCase_      :				Union[str, Any]=12			,			lowerCAmelCase_      :				Dict=3_072			,			lowerCAmelCase_      :				List[str]="gelu"			,			lowerCAmelCase_      :				Union[str, Any]=0.1			,			lowerCAmelCase_      :				str=0.1			,			lowerCAmelCase_      :				Tuple=512			,			lowerCAmelCase_      :				int=2			,			lowerCAmelCase_      :				Union[str, Any]=0.0_2			,			lowerCAmelCase_      :				Union[str, Any]=1e-12			,			lowerCAmelCase_      :				List[str]=False			,			lowerCAmelCase_      :				Dict=True			,			lowerCAmelCase_      :				Tuple=1			,			lowerCAmelCase_      :				List[str]=0			,			lowerCAmelCase_      :				Dict=2			,			**lowerCAmelCase_      :				Dict			,			)		->    List[str]:
				super().__init__(pad_token_id=lowerCAmelCase_			,			bos_token_id=lowerCAmelCase_			,			eos_token_id=lowerCAmelCase_			,			**lowerCAmelCase_		)

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











"""simple docstring"""
import json
import os
import tempfile

from transformers.testing_utils import check_json_file_has_correct_format







class     UpperCamelCase_ :
	__magic_name__			   =       None





	def   _SCREAMING_SNAKE_CASE   (   self      :				Any		)		->    List[Any]:
				UpperCAmelCase_  :				Tuple      =      self.feature_extraction_class(**self.feat_extract_dict		)
				UpperCAmelCase_  :				Union[str, Any]      =      json.loads(feat_extract.to_json_string()		)
				for key, value in self.feat_extract_dict.items():
							self.assertEqual(obj[key]			,			lowerCAmelCase_		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				str		)		->    int:
				UpperCAmelCase_  :				Dict      =      self.feature_extraction_class(**self.feat_extract_dict		)

				with tempfile.TemporaryDirectory() as tmpdirname:
							UpperCAmelCase_  :				List[Any]      =      os.path.join(lowerCAmelCase_			,			"feat_extract.json"		)
							feat_extract_first.to_json_file(lowerCAmelCase_		)
							UpperCAmelCase_  :				Any      =      self.feature_extraction_class.from_json_file(lowerCAmelCase_		)

				self.assertEqual(feat_extract_second.to_dict()			,			feat_extract_first.to_dict()		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				int		)		->    Dict:
				UpperCAmelCase_  :				Optional[Any]      =      self.feature_extraction_class(**self.feat_extract_dict		)

				with tempfile.TemporaryDirectory() as tmpdirname:
							UpperCAmelCase_  :				Optional[Any]      =      feat_extract_first.save_pretrained(lowerCAmelCase_		)[0]
							check_json_file_has_correct_format(lowerCAmelCase_		)
							UpperCAmelCase_  :				Any      =      self.feature_extraction_class.from_pretrained(lowerCAmelCase_		)

				self.assertEqual(feat_extract_second.to_dict()			,			feat_extract_first.to_dict()		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				Any		)		->    Optional[Any]:
				UpperCAmelCase_  :				Optional[int]      =      self.feature_extraction_class()
				self.assertIsNotNone(lowerCAmelCase_		)



