






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


_UpperCamelCase       :					Optional[Any]									=		logging.get_logger(__name__)

_UpperCamelCase       :					Optional[Any]									=		{
    'kakaobrain/align-base': 'https://huggingface.co/kakaobrain/align-base/resolve/main/config.json',
}






class 		snake_case						(						UpperCAmelCase ):
    __magic_name__					  =  '''align_text_model'''





    def __init__(							self			:      List[str]       ,	A			:      Optional[Any]=3_0_5_2_2       ,	A			:      List[str]=7_6_8       ,	A			:      Tuple=1_2       ,	A			:      Dict=1_2       ,	A			:      Dict=3_0_7_2       ,	A			:      Union[str, Any]="gelu"       ,	A			:      Dict=0.1       ,	A			:      Union[str, Any]=0.1       ,	A			:      str=5_1_2       ,	A			:      Union[str, Any]=2       ,	A			:      Dict=0.02       ,	A			:      str=1E-12       ,	A			:      Union[str, Any]=0       ,	A			:      Union[str, Any]="absolute"       ,	A			:      Optional[int]=True       ,	**A			:      Optional[Any]       ,	):


      '''simple docstring'''




      super().__init__(**A    )

      a  :    Any       =     vocab_size
      a  :    Tuple       =     hidden_size
      a  :    Tuple       =     num_hidden_layers
      a  :    List[str]       =     num_attention_heads
      a  :    Optional[int]       =     hidden_act
      a  :    Union[str, Any]       =     intermediate_size
      a  :    Tuple       =     hidden_dropout_prob
      a  :    Tuple       =     attention_probs_dropout_prob
      a  :    Tuple       =     max_position_embeddings
      a  :    int       =     type_vocab_size
      a  :    Dict       =     initializer_range
      a  :    int       =     layer_norm_eps
      a  :    List[str]       =     position_embedding_type
      a  :    Any       =     use_cache
      a  :    str       =     pad_token_id





    @classmethod
    def        lowerCamelCase__   (							cls			:      Any       ,	A			:      Union[str, os.PathLike]       ,	**A			:      List[Any]    ):


      '''simple docstring'''




      cls._set_token_in_kwargs(A    )

      a,  a  :    Any       =     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  :    int       =     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 		snake_case						(						UpperCAmelCase ):
    __magic_name__					  =  '''align_vision_model'''





    def __init__(							self			:      Optional[int]       ,	A			:      int = 3       ,	A			:      int = 6_0_0       ,	A			:      float = 2.0       ,	A			:      float = 3.1       ,	A			:      int = 8       ,	A			:      List[int] = [3, 3, 5, 3, 5, 5, 3]       ,	A			:      List[int] = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]       ,	A			:      List[int] = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]       ,	A			:      List[int] = []       ,	A			:      List[int] = [1, 2, 2, 2, 1, 2, 1]       ,	A			:      List[int] = [1, 2, 2, 3, 3, 4, 1]       ,	A			:      List[int] = [1, 6, 6, 6, 6, 6, 6]       ,	A			:      float = 0.25       ,	A			:      str = "swish"       ,	A			:      int = 2_5_6_0       ,	A			:      str = "mean"       ,	A			:      float = 0.02       ,	A			:      float = 0.0_01       ,	A			:      float = 0.99       ,	A			:      float = 0.2       ,	**A			:      Any       ,	):


      '''simple docstring'''




      super().__init__(**A    )

      a  :    List[Any]       =     num_channels
      a  :    Union[str, Any]       =     image_size
      a  :    Optional[int]       =     width_coefficient
      a  :    int       =     depth_coefficient
      a  :    Optional[Any]       =     depth_divisor
      a  :    Dict       =     kernel_sizes
      a  :    Union[str, Any]       =     in_channels
      a  :    List[str]       =     out_channels
      a  :    List[str]       =     depthwise_padding
      a  :    List[str]       =     strides
      a  :    Any       =     num_block_repeats
      a  :    Optional[Any]       =     expand_ratios
      a  :    str       =     squeeze_expansion_ratio
      a  :    str       =     hidden_act
      a  :    Any       =     hidden_dim
      a  :    Any       =     pooling_type
      a  :    Any       =     initializer_range
      a  :    Tuple       =     batch_norm_eps
      a  :    Any       =     batch_norm_momentum
      a  :    Optional[int]       =     drop_connect_rate
      a  :    Any       =     sum(A    ) * 4





    @classmethod
    def        lowerCamelCase__   (							cls			:      List[str]       ,	A			:      Union[str, os.PathLike]       ,	**A			:      Union[str, Any]    ):


      '''simple docstring'''




      cls._set_token_in_kwargs(A    )

      a,  a  :    int       =     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  :    Any       =     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 		snake_case						(						UpperCAmelCase ):
    __magic_name__					  =  '''align'''
    __magic_name__					  =  True





    def __init__(							self			:      Optional[Any]       ,	A			:      str=None       ,	A			:      str=None       ,	A			:      Tuple=6_4_0       ,	A			:      Optional[Any]=1.0       ,	A			:      Optional[int]=0.02       ,	**A			:      Tuple       ,	):


      '''simple docstring'''




      super().__init__(**A    )

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

      if vision_config is None:
        a  :    Optional[Any]       =     {}
        logger.info('vision_config is None. Initializing the AlignVisionConfig with default values.'    )

      a  :    Optional[Any]       =     AlignTextConfig(**A    )
      a  :    Any       =     AlignVisionConfig(**A    )

      a  :    List[str]       =     projection_dim
      a  :    Dict       =     temperature_init_value
      a  :    Tuple       =     initializer_range





    @classmethod
    def        lowerCamelCase__   (							cls			:      Tuple       ,	A			:      AlignTextConfig       ,	A			:      AlignVisionConfig       ,	**A			:      Union[str, Any]    ):


      '''simple docstring'''




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





    def        lowerCamelCase__   (							self			:      str    ):


      '''simple docstring'''




      a  :    str       =     copy.deepcopy(self.__dict__    )
      a  :    str       =     self.text_config.to_dict()
      a  :    int       =     self.vision_config.to_dict()
      a  :    int       =     self.__class__.model_type
      return output












"""simple docstring"""


import warnings

from ...utils import logging
from .image_processing_yolos import YolosImageProcessor


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






class 		snake_case						(						UpperCAmelCase ):





    def __init__(							self			:      Dict       ,	*A			:      Union[str, Any]       ,	**A			:      List[str]    ):


      '''simple docstring'''




      warnings.warn(
          'The class YolosFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'
          ' use YolosImageProcessor instead.'       ,	A       ,	)
      super().__init__(*A       ,	**A    )




