
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     __UpperCamelCase (							lowerCAmelCase__       ):






     """simple docstring"""







     lowerCAmelCase_							   =			'''align_text_model'''



     def __init__(				self							:							Optional[int]     ,						_A							:							Union[str, Any]=3_0522     ,						_A							:							List[str]=768     ,						_A							:							List[Any]=12     ,						_A							:							int=12     ,						_A							:							str=3072     ,						_A							:							Optional[Any]="gelu"     ,						_A							:							Union[str, Any]=0.1     ,						_A							:							List[str]=0.1     ,						_A							:							List[str]=512     ,						_A							:							Union[str, Any]=2     ,						_A							:							Optional[int]=0.02     ,						_A							:							Optional[int]=1e-12     ,						_A							:							List[str]=0     ,						_A							:							Optional[Any]="absolute"     ,						_A							:							Tuple=True     ,						**_A							:							str     ,						):







       """simple docstring"""




       super().__init__(**_A )

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




     @classmethod
     def  UpperCAmelCase__							(				cls							:							int     ,						_A							:							Union[str, os.PathLike]     ,						**_A							:							Union[str, Any] ):







       """simple docstring"""




       cls._set_token_in_kwargs(_A )

       __SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE      :	Dict					=		cls.get_config_dict(_A     ,						**_A )

       # get the text config dict if we are loading from AlignConfig
       if config_dict.get('''model_type''' ) == "align":
         __SCREAMING_SNAKE_CASE      :	str					=		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     __UpperCamelCase (							lowerCAmelCase__       ):






     """simple docstring"""







     lowerCAmelCase_							   =			'''align_vision_model'''



     def __init__(				self							:							Dict     ,						_A							:							int = 3     ,						_A							:							int = 600     ,						_A							:							float = 2.0     ,						_A							:							float = 3.1     ,						_A							:							int = 8     ,						_A							:							List[int] = [3, 3, 5, 3, 5, 5, 3]     ,						_A							:							List[int] = [32, 16, 24, 40, 80, 112, 192]     ,						_A							:							List[int] = [16, 24, 40, 80, 112, 192, 320]     ,						_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 = 2560     ,						_A							:							str = "mean"     ,						_A							:							float = 0.02     ,						_A							:							float = 0.0_01     ,						_A							:							float = 0.99     ,						_A							:							float = 0.2     ,						**_A							:							Optional[Any]     ,						):







       """simple docstring"""




       super().__init__(**_A )

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




     @classmethod
     def  UpperCAmelCase__							(				cls							:							Any     ,						_A							:							Union[str, os.PathLike]     ,						**_A							:							Optional[Any] ):







       """simple docstring"""




       cls._set_token_in_kwargs(_A )

       __SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE      :	Union[str, Any]					=		cls.get_config_dict(_A     ,						**_A )

       # get the vision config dict if we are loading from AlignConfig
       if config_dict.get('''model_type''' ) == "align":
         __SCREAMING_SNAKE_CASE      :	List[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     __UpperCamelCase (							lowerCAmelCase__       ):






     """simple docstring"""







     lowerCAmelCase_							   =			'''align'''
     lowerCAmelCase_							   =			True



     def __init__(				self							:							str     ,						_A							:							Optional[int]=None     ,						_A							:							Optional[int]=None     ,						_A							:							Dict=640     ,						_A							:							int=1.0     ,						_A							:							Any=0.02     ,						**_A							:							int     ,						):







       """simple docstring"""




       super().__init__(**_A )

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

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

       __SCREAMING_SNAKE_CASE      :	Tuple					=		AlignTextConfig(**_A )
       __SCREAMING_SNAKE_CASE      :	int					=		AlignVisionConfig(**_A )

       __SCREAMING_SNAKE_CASE      :	Optional[int]					=		projection_dim
       __SCREAMING_SNAKE_CASE      :	str					=		temperature_init_value
       __SCREAMING_SNAKE_CASE      :	Any					=		initializer_range



     @classmethod
     def  UpperCAmelCase__							(				cls							:							Dict     ,						_A							:							AlignTextConfig     ,						_A							:							AlignVisionConfig     ,						**_A							:							str ):







       """simple docstring"""




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




     def  UpperCAmelCase__							(				self							:							str ):







       """simple docstring"""




       __SCREAMING_SNAKE_CASE      :	Tuple					=		copy.deepcopy(self.__dict__ )
       __SCREAMING_SNAKE_CASE      :	Union[str, Any]					=		self.text_config.to_dict()
       __SCREAMING_SNAKE_CASE      :	Optional[int]					=		self.vision_config.to_dict()
       __SCREAMING_SNAKE_CASE      :	int					=		self.__class__.model_type
       return output


"""simple docstring"""






import warnings

from ...utils import logging
from .image_processing_mobilevit import MobileViTImageProcessor


UpperCAmelCase        =				logging.get_logger(__name__)



class 			lowercase					( lowercase__		):






			def __init__(self  :	Dict      ,*SCREAMING_SNAKE_CASE_  :	str      ,**SCREAMING_SNAKE_CASE_  :	Optional[Any]			)       ->	None:





				"""simple docstring"""


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


