
'''simple docstring'''




import copy
import os
from typing import Union

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


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

lowercase			:				int    		=			{
    'BridgeTower/bridgetower-base': 'https://huggingface.co/BridgeTower/bridgetower-base/blob/main/config.json',
    'BridgeTower/bridgetower-base-itm-mlm': (
        'https://huggingface.co/BridgeTower/bridgetower-base-itm-mlm/blob/main/config.json'
    ),
}





class  A				(							__snake_case						):
     __magic_name__						=		'''bridgetower_vision_model'''





     def __init__(							self						,			SCREAMING_SNAKE_CASE=768						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=3						,			SCREAMING_SNAKE_CASE=16						,			SCREAMING_SNAKE_CASE=288						,			SCREAMING_SNAKE_CASE=1						,			SCREAMING_SNAKE_CASE=1e-05						,			SCREAMING_SNAKE_CASE=False						,			SCREAMING_SNAKE_CASE=True						,			SCREAMING_SNAKE_CASE=False						,			**SCREAMING_SNAKE_CASE						,			) ->				Optional[Any]:






         """simple docstring"""






         super().__init__(**SCREAMING_SNAKE_CASE	)
         A       :   List[str]					=						hidden_size
         A       :   Optional[int]					=						num_hidden_layers
         A       :   Dict					=						num_channels
         A       :   Tuple					=						patch_size
         A       :   Optional[Any]					=						image_size
         A       :   Dict					=						initializer_factor
         A       :   List[Any]					=						layer_norm_eps
         A       :   Optional[int]					=						stop_gradient
         A       :   Optional[Any]					=						share_layernorm
         A       :   Optional[int]					=						remove_last_layer





     @classmethod
     def 				__lowerCAmelCase							(							cls						,			SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	) ->				"PretrainedConfig":






         """simple docstring"""






         A,  A       :   Any					=						cls.get_config_dict(SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	)

         if config_dict.get('''model_type'''	) == "bridgetower":
             A       :   List[Any]					=						config_dict['''text_config''']

         if "model_type" in config_dict and hasattr(cls						,			'''model_type'''	) and config_dict["model_type"] != cls.model_type:
             logger.warning(
                 F'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
                 F'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'	)

         return cls.from_dict(SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	)





class  A				(							__snake_case						):
     __magic_name__						=		'''bridgetower_text_model'''





     def __init__(							self						,			SCREAMING_SNAKE_CASE=50265						,			SCREAMING_SNAKE_CASE=768						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=1						,			SCREAMING_SNAKE_CASE=3072						,			SCREAMING_SNAKE_CASE="gelu"						,			SCREAMING_SNAKE_CASE=0.1						,			SCREAMING_SNAKE_CASE=0.1						,			SCREAMING_SNAKE_CASE=514						,			SCREAMING_SNAKE_CASE=1						,			SCREAMING_SNAKE_CASE=1e-05						,			SCREAMING_SNAKE_CASE=1						,			SCREAMING_SNAKE_CASE=0						,			SCREAMING_SNAKE_CASE=2						,			SCREAMING_SNAKE_CASE="absolute"						,			SCREAMING_SNAKE_CASE=True						,			**SCREAMING_SNAKE_CASE						,			) ->				List[str]:






         """simple docstring"""






         super().__init__(**SCREAMING_SNAKE_CASE	)

         A       :   List[Any]					=						vocab_size
         A       :   int					=						hidden_size
         A       :   List[Any]					=						num_hidden_layers
         A       :   Any					=						num_attention_heads
         A       :   Any					=						hidden_act
         A       :   Union[str, Any]					=						initializer_factor
         A       :   Dict					=						intermediate_size
         A       :   Dict					=						hidden_dropout_prob
         A       :   List[str]					=						attention_probs_dropout_prob
         A       :   Any					=						max_position_embeddings
         A       :   int					=						type_vocab_size
         A       :   List[Any]					=						layer_norm_eps
         A       :   List[Any]					=						position_embedding_type
         A       :   List[Any]					=						use_cache
         A       :   List[str]					=						pad_token_id
         A       :   Dict					=						bos_token_id
         A       :   Tuple					=						eos_token_id





     @classmethod
     def 				__lowerCAmelCase							(							cls						,			SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	) ->				"PretrainedConfig":






         """simple docstring"""






         A,  A       :   Optional[Any]					=						cls.get_config_dict(SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	)

         if config_dict.get('''model_type'''	) == "bridgetower":
             A       :   List[Any]					=						config_dict['''text_config''']

         if "model_type" in config_dict and hasattr(cls						,			'''model_type'''	) and config_dict["model_type"] != cls.model_type:
             logger.warning(
                 F'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
                 F'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'	)

         return cls.from_dict(SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	)





class  A				(							__snake_case						):
     __magic_name__						=		'''bridgetower'''





     def __init__(							self						,			SCREAMING_SNAKE_CASE=True						,			SCREAMING_SNAKE_CASE="gelu"						,			SCREAMING_SNAKE_CASE=768						,			SCREAMING_SNAKE_CASE=1						,			SCREAMING_SNAKE_CASE=1e-05						,			SCREAMING_SNAKE_CASE=False						,			SCREAMING_SNAKE_CASE="add"						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=6						,			SCREAMING_SNAKE_CASE=False						,			SCREAMING_SNAKE_CASE=False						,			SCREAMING_SNAKE_CASE=None						,			SCREAMING_SNAKE_CASE=None						,			**SCREAMING_SNAKE_CASE						,			) ->				Tuple:






         """simple docstring"""






         A       :   Union[str, Any]					=						kwargs.pop('''text_config_dict'''						,			SCREAMING_SNAKE_CASE	)
         A       :   Dict					=						kwargs.pop('''vision_config_dict'''						,			SCREAMING_SNAKE_CASE	)

         super().__init__(**SCREAMING_SNAKE_CASE	)
         A       :   int					=						share_cross_modal_transformer_layers
         A       :   str					=						hidden_act
         A       :   List[Any]					=						hidden_size
         A       :   List[Any]					=						initializer_factor
         A       :   List[Any]					=						layer_norm_eps
         A       :   Optional[Any]					=						share_link_tower_layers
         A       :   Optional[Any]					=						link_tower_type
         A       :   Union[str, Any]					=						num_attention_heads
         A       :   str					=						num_hidden_layers
         A       :   int					=						tie_word_embeddings
         A       :   Optional[Any]					=						init_layernorm_from_vision_encoder

         if text_config is None:
             A       :   Any					=						{}
             logger.info('''`text_config` is `None`. Initializing the `BridgeTowerTextConfig` with default values.'''	)

         if vision_config is None:
             A       :   List[str]					=						{}
             logger.info('''`vision_config` is `None`. Initializing the `BridgeTowerVisionConfig` with default values.'''	)

         A       :   Union[str, Any]					=						BridgeTowerTextConfig(**SCREAMING_SNAKE_CASE	)
         A       :   Dict					=						BridgeTowerVisionConfig(**SCREAMING_SNAKE_CASE	)





     @classmethod
     def 				__lowerCAmelCase							(							cls						,			SCREAMING_SNAKE_CASE						,			SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	) ->				List[Any]:






         """simple docstring"""






         return cls(text_config=text_config.to_dict()						,			vision_config=vision_config.to_dict()						,			**SCREAMING_SNAKE_CASE	)





     def 				__lowerCAmelCase							(							self	) ->				List[Any]:






         """simple docstring"""






         A       :   List[str]					=						copy.deepcopy(self.__dict__	)
         A       :   List[str]					=						self.text_config.to_dict()
         A       :   Tuple					=						self.vision_config.to_dict()
         A       :   Any					=						self.__class__.model_type
         return output






'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowercase			:				Union[str, Any]    		=			logging.get_logger(__name__)

lowercase			:				str    		=			{
    'bert-base-uncased': 'https://huggingface.co/bert-base-uncased/resolve/main/config.json',
    'bert-large-uncased': 'https://huggingface.co/bert-large-uncased/resolve/main/config.json',
    'bert-base-cased': 'https://huggingface.co/bert-base-cased/resolve/main/config.json',
    'bert-large-cased': 'https://huggingface.co/bert-large-cased/resolve/main/config.json',
    'bert-base-multilingual-uncased': 'https://huggingface.co/bert-base-multilingual-uncased/resolve/main/config.json',
    'bert-base-multilingual-cased': 'https://huggingface.co/bert-base-multilingual-cased/resolve/main/config.json',
    'bert-base-chinese': 'https://huggingface.co/bert-base-chinese/resolve/main/config.json',
    'bert-base-german-cased': 'https://huggingface.co/bert-base-german-cased/resolve/main/config.json',
    'bert-large-uncased-whole-word-masking': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking': (
        'https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-uncased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-base-cased-finetuned-mrpc': 'https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/config.json',
    'bert-base-german-dbmdz-cased': 'https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/config.json',
    'bert-base-german-dbmdz-uncased': 'https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese': 'https://huggingface.co/cl-tohoku/bert-base-japanese/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-cased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-uncased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/config.json'
    ),
    'wietsedv/bert-base-dutch-cased': 'https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/config.json',
    # See all BERT models at https://huggingface.co/models?filter=bert
}





class  A				(							__snake_case						):
     __magic_name__						=		'''bert'''





     def __init__(							self						,			SCREAMING_SNAKE_CASE=30522						,			SCREAMING_SNAKE_CASE=768						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=3072						,			SCREAMING_SNAKE_CASE="gelu"						,			SCREAMING_SNAKE_CASE=0.1						,			SCREAMING_SNAKE_CASE=0.1						,			SCREAMING_SNAKE_CASE=512						,			SCREAMING_SNAKE_CASE=2						,			SCREAMING_SNAKE_CASE=0.02						,			SCREAMING_SNAKE_CASE=1e-12						,			SCREAMING_SNAKE_CASE=0						,			SCREAMING_SNAKE_CASE="absolute"						,			SCREAMING_SNAKE_CASE=True						,			SCREAMING_SNAKE_CASE=None						,			**SCREAMING_SNAKE_CASE						,			) ->				Optional[int]:






         """simple docstring"""






         super().__init__(pad_token_id=SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	)

         A       :   Optional[int]					=						vocab_size
         A       :   Optional[Any]					=						hidden_size
         A       :   List[Any]					=						num_hidden_layers
         A       :   List[str]					=						num_attention_heads
         A       :   Dict					=						hidden_act
         A       :   Optional[Any]					=						intermediate_size
         A       :   List[Any]					=						hidden_dropout_prob
         A       :   List[Any]					=						attention_probs_dropout_prob
         A       :   Optional[Any]					=						max_position_embeddings
         A       :   List[str]					=						type_vocab_size
         A       :   Dict					=						initializer_range
         A       :   str					=						layer_norm_eps
         A       :   int					=						position_embedding_type
         A       :   Dict					=						use_cache
         A       :   str					=						classifier_dropout





class  A				(							__snake_case						):





     @property
     def 				__lowerCAmelCase							(							self	) ->				Mapping[str, Mapping[int, str]]:






         """simple docstring"""






         if self.task == "multiple-choice":
             A       :   Optional[Any]					=						{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
         else:
             A       :   Optional[int]					=						{0: '''batch''', 1: '''sequence'''}
         return OrderedDict(
             [
                 ('''input_ids''', dynamic_axis),
                 ('''attention_mask''', dynamic_axis),
                 ('''token_type_ids''', dynamic_axis),
             ]	)




