



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


if TYPE_CHECKING:
		pass

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


SCREAMING_SNAKE_CASE__       =      logging.get_logger(__name__)

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


class      __lowerCAmelCase     (		lowercase__      ):
					"""simple docstring"""






					A__				:		str			       =    """align_text_model"""



					def __init__(     self					:       List[Any]				,					_snake_case					:       str=3_05_22				,					_snake_case					:       Optional[int]=7_68				,					_snake_case					:       Union[str, Any]=12				,					_snake_case					:       List[str]=12				,					_snake_case					:       List[str]=30_72				,					_snake_case					:       Optional[int]="gelu"				,					_snake_case					:       Optional[Any]=0.1				,					_snake_case					:       int=0.1				,					_snake_case					:       Optional[int]=5_12				,					_snake_case					:       Tuple=2				,					_snake_case					:       str=0.02				,					_snake_case					:       str=1E-12				,					_snake_case					:       int=0				,					_snake_case					:       int="absolute"				,					_snake_case					:       Any=True				,					**_snake_case					:       List[str]				,					):






								"""simple docstring"""


								super().__init__(**__lowercase					)

								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					:       Optional[int]				,					_snake_case					:       Union[str, os.PathLike]				,					**_snake_case					:       List[str]					):






								"""simple docstring"""


								cls._set_token_in_kwargs(__lowercase					)

								A__     , A__       =    cls.get_config_dict(__lowercase				,					**__lowercase					)

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







class      __lowerCAmelCase     (		lowercase__      ):
					"""simple docstring"""






					A__				:		str			       =    """align_vision_model"""



					def __init__(     self					:       Union[str, Any]				,					_snake_case					:       int = 3				,					_snake_case					:       int = 6_00				,					_snake_case					:       float = 2.0				,					_snake_case					:       float = 3.1				,					_snake_case					:       int = 8				,					_snake_case					:       List[int] = [3, 3, 5, 3, 5, 5, 3]				,					_snake_case					:       List[int] = [32, 16, 24, 40, 80, 1_12, 1_92]				,					_snake_case					:       List[int] = [16, 24, 40, 80, 1_12, 1_92, 3_20]				,					_snake_case					:       List[int] = []				,					_snake_case					:       List[int] = [1, 2, 2, 2, 1, 2, 1]				,					_snake_case					:       List[int] = [1, 2, 2, 3, 3, 4, 1]				,					_snake_case					:       List[int] = [1, 6, 6, 6, 6, 6, 6]				,					_snake_case					:       float = 0.25				,					_snake_case					:       str = "swish"				,					_snake_case					:       int = 25_60				,					_snake_case					:       str = "mean"				,					_snake_case					:       float = 0.02				,					_snake_case					:       float = 0.001				,					_snake_case					:       float = 0.99				,					_snake_case					:       float = 0.2				,					**_snake_case					:       Union[str, Any]				,					):






								"""simple docstring"""


								super().__init__(**__lowercase					)

								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(__lowercase					) * 4



					@classmethod
					def     _a							(     cls					:       Optional[Any]				,					_snake_case					:       Union[str, os.PathLike]				,					**_snake_case					:       Dict					):






								"""simple docstring"""


								cls._set_token_in_kwargs(__lowercase					)

								A__     , A__       =    cls.get_config_dict(__lowercase				,					**__lowercase					)

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







class      __lowerCAmelCase     (		lowercase__      ):
					"""simple docstring"""






					A__				:		Union[str, Any]			       =    """align"""
					A__				:		Optional[Any]			       =    True



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






								"""simple docstring"""


								super().__init__(**__lowercase					)

								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(**__lowercase					)
								A__       =    AlignVisionConfig(**__lowercase					)

								A__       =    projection_dim
								A__       =    temperature_init_value
								A__       =    initializer_range



					@classmethod
					def     _a							(     cls					:       Tuple				,					_snake_case					:       AlignTextConfig				,					_snake_case					:       AlignVisionConfig				,					**_snake_case					:       int					):






								"""simple docstring"""


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



					def     _a							(     self					:       Optional[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









from typing import TYPE_CHECKING

from ..utils import _LazyModule


SCREAMING_SNAKE_CASE__       =      {
    '''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

							SCREAMING_SNAKE_CASE__       =      _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




