



'''simple docstring'''





import copy
import os
from typing import TYPE_CHECKING, List, Union


if TYPE_CHECKING:
  pass

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


lowercase_		       =  logging.get_logger(__name__)

lowercase_		       =  {
    "kakaobrain/align-base": "https://huggingface.co/kakaobrain/align-base/resolve/main/config.json",
}






class __A			(  A						):



 '''simple docstring'''







 __lowerCamelCase    :       str          =       'align_text_model'



 def __init__(self ,   A=30_522 ,   A=768 ,   A=12 ,   A=12 ,   A=3_072 ,   A="gelu" ,   A=0.1 ,   A=0.1 ,   A=512 ,   A=2 ,   A=0.02 ,   A=1E-12 ,   A=0 ,   A="absolute" ,   A=True ,   **A ,   )    ->     Dict:


      """simple docstring"""



      super().__init__(**A       )

      _a      =  vocab_size
      _a      =  hidden_size
      _a      =  num_hidden_layers
      _a      =  num_attention_heads
      _a      =  hidden_act
      _a      =  intermediate_size
      _a      =  hidden_dropout_prob
      _a      =  attention_probs_dropout_prob
      _a      =  max_position_embeddings
      _a      =  type_vocab_size
      _a      =  initializer_range
      _a      =  layer_norm_eps
      _a      =  position_embedding_type
      _a      =  use_cache
      _a      =  pad_token_id



 @classmethod
 def 					a__  (cls ,   A ,   **A       )    ->     "PretrainedConfig":


      """simple docstring"""



      cls._set_token_in_kwargs(A       )

      _a  ,    _a      =  cls.get_config_dict(A ,   **A       )

      # get the text config dict if we are loading from AlignConfig
      if config_dict.get('''model_type'''       ) == "align":
           _a      =  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(A ,   **A       )






class __A			(  A						):



 '''simple docstring'''







 __lowerCamelCase    :       Dict          =       'align_vision_model'



 def __init__(self ,   A = 3 ,   A = 600 ,   A = 2.0 ,   A = 3.1 ,   A = 8 ,   A = [3, 3, 5, 3, 5, 5, 3] ,   A = [32, 16, 24, 40, 80, 112, 192] ,   A = [16, 24, 40, 80, 112, 192, 320] ,   A = [] ,   A = [1, 2, 2, 2, 1, 2, 1] ,   A = [1, 2, 2, 3, 3, 4, 1] ,   A = [1, 6, 6, 6, 6, 6, 6] ,   A = 0.25 ,   A = "swish" ,   A = 2_560 ,   A = "mean" ,   A = 0.02 ,   A = 0.001 ,   A = 0.99 ,   A = 0.2 ,   **A ,   )    ->     List[Any]:


      """simple docstring"""



      super().__init__(**A       )

      _a      =  num_channels
      _a      =  image_size
      _a      =  width_coefficient
      _a      =  depth_coefficient
      _a      =  depth_divisor
      _a      =  kernel_sizes
      _a      =  in_channels
      _a      =  out_channels
      _a      =  depthwise_padding
      _a      =  strides
      _a      =  num_block_repeats
      _a      =  expand_ratios
      _a      =  squeeze_expansion_ratio
      _a      =  hidden_act
      _a      =  hidden_dim
      _a      =  pooling_type
      _a      =  initializer_range
      _a      =  batch_norm_eps
      _a      =  batch_norm_momentum
      _a      =  drop_connect_rate
      _a      =  sum(A       ) * 4



 @classmethod
 def 					a__  (cls ,   A ,   **A       )    ->     "PretrainedConfig":


      """simple docstring"""



      cls._set_token_in_kwargs(A       )

      _a  ,    _a      =  cls.get_config_dict(A ,   **A       )

      # get the vision config dict if we are loading from AlignConfig
      if config_dict.get('''model_type'''       ) == "align":
           _a      =  config_dict['''vision_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(A ,   **A       )






class __A			(  A						):



 '''simple docstring'''







 __lowerCamelCase    :       Optional[int]          =       'align'
 __lowerCamelCase    :       List[str]          =       True



 def __init__(self ,   A=None ,   A=None ,   A=640 ,   A=1.0 ,   A=0.02 ,   **A ,   )    ->     Dict:


      """simple docstring"""



      super().__init__(**A       )

      if text_config is None:
           _a      =  {}
           logger.info('''text_config is None. Initializing the AlignTextConfig with default values.'''       )

      if vision_config is None:
           _a      =  {}
           logger.info('''vision_config is None. Initializing the AlignVisionConfig with default values.'''       )

      _a      =  AlignTextConfig(**A       )
      _a      =  AlignVisionConfig(**A       )

      _a      =  projection_dim
      _a      =  temperature_init_value
      _a      =  initializer_range



 @classmethod
 def 					a__  (cls ,   A ,   A ,   **A       )    ->     Optional[int]:


      """simple docstring"""



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



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


      """simple docstring"""



      _a      =  copy.deepcopy(self.__dict__       )
      _a      =  self.text_config.to_dict()
      _a      =  self.vision_config.to_dict()
      _a      =  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_		       =  logging.get_logger(__name__)

lowercase_		       =  {
    "facebook/xmod-base": "https://huggingface.co/facebook/xmod-base/resolve/main/config.json",
    "facebook/xmod-large-prenorm": "https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json",
    "facebook/xmod-base-13-125k": "https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json",
    "facebook/xmod-base-30-125k": "https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json",
    "facebook/xmod-base-30-195k": "https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json",
    "facebook/xmod-base-60-125k": "https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json",
    "facebook/xmod-base-60-265k": "https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json",
    "facebook/xmod-base-75-125k": "https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json",
    "facebook/xmod-base-75-269k": "https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json",
}






class __A			(  A						):



 '''simple docstring'''







 __lowerCamelCase    :       Any          =       'xmod'



 def __init__(self ,   A=30_522 ,   A=768 ,   A=12 ,   A=12 ,   A=3_072 ,   A="gelu" ,   A=0.1 ,   A=0.1 ,   A=512 ,   A=2 ,   A=0.02 ,   A=1E-12 ,   A=1 ,   A=0 ,   A=2 ,   A="absolute" ,   A=True ,   A=None ,   A=False ,   A=2 ,   A=False ,   A=True ,   A=True ,   A=("en_XX",) ,   A=None ,   **A ,   )    ->     List[str]:


      """simple docstring"""



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

      _a      =  vocab_size
      _a      =  hidden_size
      _a      =  num_hidden_layers
      _a      =  num_attention_heads
      _a      =  hidden_act
      _a      =  intermediate_size
      _a      =  hidden_dropout_prob
      _a      =  attention_probs_dropout_prob
      _a      =  max_position_embeddings
      _a      =  type_vocab_size
      _a      =  initializer_range
      _a      =  layer_norm_eps
      _a      =  position_embedding_type
      _a      =  use_cache
      _a      =  classifier_dropout
      _a      =  pre_norm
      _a      =  adapter_reduction_factor
      _a      =  adapter_layer_norm
      _a      =  adapter_reuse_layer_norm
      _a      =  ln_before_adapter
      _a      =  list(A       )
      _a      =  default_language






class __A			(  A						):



 '''simple docstring'''







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


      """simple docstring"""



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



