






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


lowerCamelCase_				: List[Any]    	=							logging.get_logger(__name__)

lowerCamelCase_				: List[Any]    	=							{
    '''kakaobrain/align-base''': '''https://huggingface.co/kakaobrain/align-base/resolve/main/config.json''',
}
class    _SCREAMING_SNAKE_CASE							(		SCREAMING_SNAKE_CASE	):


			'''simple docstring'''





			__a							:							Tuple					     =					"align_text_model"






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

									'''simple docstring'''







									super().__init__(**lowercase			)

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







			@classmethod
			def 				A      (   cls							:						Union[str, Any] ,      lowercase							:						Union[str, os.PathLike] ,      **lowercase							:						Optional[int]			)							->    "PretrainedConfig":

									'''simple docstring'''







									cls._set_token_in_kwargs(lowercase			)

									UpperCamelCase__    ,   UpperCamelCase__         = cls.get_config_dict(lowercase ,      **lowercase			)

									# get the text config dict if we are loading from AlignConfig
									if config_dict.get("""model_type"""			) == "align":
															UpperCamelCase__         = 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(lowercase ,      **lowercase			)
class    _SCREAMING_SNAKE_CASE							(		SCREAMING_SNAKE_CASE	):


			'''simple docstring'''





			__a							:							int					     =					"align_vision_model"






			def __init__(   self							:						int ,      lowercase							:						int = 3 ,      lowercase							:						int = 6_0_0 ,      lowercase							:						float = 2.0 ,      lowercase							:						float = 3.1 ,      lowercase							:						int = 8 ,      lowercase							:						List[int] = [3, 3, 5, 3, 5, 5, 3] ,      lowercase							:						List[int] = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2] ,      lowercase							:						List[int] = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0] ,      lowercase							:						List[int] = [] ,      lowercase							:						List[int] = [1, 2, 2, 2, 1, 2, 1] ,      lowercase							:						List[int] = [1, 2, 2, 3, 3, 4, 1] ,      lowercase							:						List[int] = [1, 6, 6, 6, 6, 6, 6] ,      lowercase							:						float = 0.2_5 ,      lowercase							:						str = "swish" ,      lowercase							:						int = 2_5_6_0 ,      lowercase							:						str = "mean" ,      lowercase							:						float = 0.0_2 ,      lowercase							:						float = 0.0_0_1 ,      lowercase							:						float = 0.9_9 ,      lowercase							:						float = 0.2 ,      **lowercase							:						Optional[Any] ,      )							->    int:

									'''simple docstring'''







									super().__init__(**lowercase			)

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







			@classmethod
			def 				A      (   cls							:						List[Any] ,      lowercase							:						Union[str, os.PathLike] ,      **lowercase							:						List[Any]			)							->    "PretrainedConfig":

									'''simple docstring'''







									cls._set_token_in_kwargs(lowercase			)

									UpperCamelCase__    ,   UpperCamelCase__         = cls.get_config_dict(lowercase ,      **lowercase			)

									# get the vision config dict if we are loading from AlignConfig
									if config_dict.get("""model_type"""			) == "align":
															UpperCamelCase__         = 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(lowercase ,      **lowercase			)
class    _SCREAMING_SNAKE_CASE							(		SCREAMING_SNAKE_CASE	):


			'''simple docstring'''





			__a							:							str					     =					"align"
			__a							:							List[Any]					     =					True






			def __init__(   self							:						Optional[Any] ,      lowercase							:						Optional[int]=None ,      lowercase							:						Any=None ,      lowercase							:						List[Any]=6_4_0 ,      lowercase							:						int=1.0 ,      lowercase							:						Optional[Any]=0.0_2 ,      **lowercase							:						List[Any] ,      )							->    List[Any]:

									'''simple docstring'''







									super().__init__(**lowercase			)

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

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

									UpperCamelCase__         = AlignTextConfig(**lowercase			)
									UpperCamelCase__         = AlignVisionConfig(**lowercase			)

									UpperCamelCase__         = projection_dim
									UpperCamelCase__         = temperature_init_value
									UpperCamelCase__         = initializer_range






			@classmethod
			def 				A      (   cls							:						Optional[int] ,      lowercase							:						AlignTextConfig ,      lowercase							:						AlignVisionConfig ,      **lowercase							:						str			)							->    List[str]:

									'''simple docstring'''







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







			def 				A      (   self							:						Any			)							->    Dict:

									'''simple docstring'''







									UpperCamelCase__         = copy.deepcopy(self.__dict__			)
									UpperCamelCase__         = self.text_config.to_dict()
									UpperCamelCase__         = self.vision_config.to_dict()
									UpperCamelCase__         = self.__class__.model_type
									return output








'''simple docstring'''


from typing import TYPE_CHECKING

from ..utils import _LazyModule


lowerCamelCase_				: List[Any]    	=							{
    '''config''': [
        '''EXTERNAL_DATA_FORMAT_SIZE_LIMIT''',
        '''OnnxConfig''',
        '''OnnxConfigWithPast''',
        '''OnnxSeq2SeqConfigWithPast''',
        '''PatchingSpec''',
    ],
    '''convert''': ['''export''', '''validate_model_outputs'''],
    '''features''': ['''FeaturesManager'''],
    '''utils''': ['''ParameterFormat''', '''compute_serialized_parameters_size'''],
}


if TYPE_CHECKING:
					from .config import (
					    EXTERNAL_DATA_FORMAT_SIZE_LIMIT,
					    OnnxConfig,
					    OnnxConfigWithPast,
					    OnnxSeqaSeqConfigWithPast,
					    PatchingSpec,
					)
					from .convert import export, validate_model_outputs
					from .features import FeaturesManager
					from .utils import ParameterFormat, compute_serialized_parameters_size

else:
					import sys

					lowerCamelCase_				: List[Any]    	=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
