


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


if TYPE_CHECKING:
     pass

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


snake_case    :   Dict	    =					logging.get_logger(__name__)

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







class 		_snake_case  (				_snake_case							):
 SCREAMING_SNAKE_CASE__				=	'align_text_model'




 def __init__(		self ,  _lowerCamelCase=3_0522 ,  _lowerCamelCase=768 ,  _lowerCamelCase=12 ,  _lowerCamelCase=12 ,  _lowerCamelCase=3072 ,  _lowerCamelCase="gelu" ,  _lowerCamelCase=0.1 ,  _lowerCamelCase=0.1 ,  _lowerCamelCase=512 ,  _lowerCamelCase=2 ,  _lowerCamelCase=0.02 ,  _lowerCamelCase=1e-12 ,  _lowerCamelCase=0 ,  _lowerCamelCase="absolute" ,  _lowerCamelCase=True ,  **_lowerCamelCase ,  ):
       super().__init__(**_lowerCamelCase   )

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




 @classmethod
 def 	SCREAMING_SNAKE_CASE__    (		cls ,  _lowerCamelCase ,  **_lowerCamelCase   ):
       cls._set_token_in_kwargs(_lowerCamelCase   )

       a							,    a						:Dict										=	cls.get_config_dict(_lowerCamelCase ,  **_lowerCamelCase   )

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







class 		_snake_case  (				_snake_case							):
 SCREAMING_SNAKE_CASE__				=	'align_vision_model'




 def __init__(		self ,  _lowerCamelCase = 3 ,  _lowerCamelCase = 600 ,  _lowerCamelCase = 2.0 ,  _lowerCamelCase = 3.1 ,  _lowerCamelCase = 8 ,  _lowerCamelCase = [3, 3, 5, 3, 5, 5, 3] ,  _lowerCamelCase = [32, 16, 24, 40, 80, 112, 192] ,  _lowerCamelCase = [16, 24, 40, 80, 112, 192, 320] ,  _lowerCamelCase = [] ,  _lowerCamelCase = [1, 2, 2, 2, 1, 2, 1] ,  _lowerCamelCase = [1, 2, 2, 3, 3, 4, 1] ,  _lowerCamelCase = [1, 6, 6, 6, 6, 6, 6] ,  _lowerCamelCase = 0.25 ,  _lowerCamelCase = "swish" ,  _lowerCamelCase = 2560 ,  _lowerCamelCase = "mean" ,  _lowerCamelCase = 0.02 ,  _lowerCamelCase = 0.001 ,  _lowerCamelCase = 0.99 ,  _lowerCamelCase = 0.2 ,  **_lowerCamelCase ,  ):
       super().__init__(**_lowerCamelCase   )

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




 @classmethod
 def 	SCREAMING_SNAKE_CASE__    (		cls ,  _lowerCamelCase ,  **_lowerCamelCase   ):
       cls._set_token_in_kwargs(_lowerCamelCase   )

       a							,    a						:List[str]										=	cls.get_config_dict(_lowerCamelCase ,  **_lowerCamelCase   )

       # 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(_lowerCamelCase ,  **_lowerCamelCase   )







class 		_snake_case  (				_snake_case							):
 SCREAMING_SNAKE_CASE__				=	'align'
 SCREAMING_SNAKE_CASE__				=	True




 def __init__(		self ,  _lowerCamelCase=None ,  _lowerCamelCase=None ,  _lowerCamelCase=640 ,  _lowerCamelCase=1.0 ,  _lowerCamelCase=0.02 ,  **_lowerCamelCase ,  ):
       super().__init__(**_lowerCamelCase   )

       if text_config is None:
             a						:Union[str, Any]										=	{}
             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(**_lowerCamelCase   )
       a						:Tuple										=	AlignVisionConfig(**_lowerCamelCase   )

       a						:Tuple										=	projection_dim
       a						:Optional[int]										=	temperature_init_value
       a						:Optional[Any]										=	initializer_range




 @classmethod
 def 	SCREAMING_SNAKE_CASE__    (		cls ,  _lowerCamelCase ,  _lowerCamelCase ,  **_lowerCamelCase   ):
       return cls(text_config=text_config.to_dict() ,  vision_config=vision_config.to_dict() ,  **_lowerCamelCase   )




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









from typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


snake_case    :   Any	    =					{'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']}


try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     snake_case    :   Union[str, Any]	    =					[
         '''VAN_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''VanForImageClassification''',
         '''VanModel''',
         '''VanPreTrainedModel''',
     ]

if TYPE_CHECKING:
     from .configuration_van import VAN_PRETRAINED_CONFIG_ARCHIVE_MAP, VanConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_van import (
              VAN_PRETRAINED_MODEL_ARCHIVE_LIST,
              VanForImageClassification,
              VanModel,
              VanPreTrainedModel,
          )

else:
     import sys

     snake_case    :   Optional[Any]	    =					_LazyModule(__name__, globals()['''__file__'''], _import_structure)





