

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


if TYPE_CHECKING:
			pass

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


a_      =     logging.get_logger(__name__)

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






class _UpperCamelCase				(				__A ):
			'''simple docstring'''







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

				"""simple docstring"""

				super().__init__(**a						)

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






			@classmethod
			def 				__UpperCamelCase			(      cls				:			int   ,   a				:			Union[str, os.PathLike]   ,   **a				:			List[str]						)				->							"PretrainedConfig":

				"""simple docstring"""

				cls._set_token_in_kwargs(a						)

				SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE :   int					  =							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 :   Dict					  =							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				(				__A ):
			'''simple docstring'''







			lowerCamelCase__							     ='align_vision_model'
			def __init__(      self				:			int   ,   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.001   ,   a				:			float = 0.99   ,   a				:			float = 0.2   ,   **a				:			List[Any]   ,   )				->							Optional[Any]:

				"""simple docstring"""

				super().__init__(**a						)

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






			@classmethod
			def 				__UpperCamelCase			(      cls				:			int   ,   a				:			Union[str, os.PathLike]   ,   **a				:			Dict						)				->							"PretrainedConfig":

				"""simple docstring"""

				cls._set_token_in_kwargs(a						)

				SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE :   str					  =							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				(				__A ):
			'''simple docstring'''







			lowerCamelCase__							     ='align'
			lowerCamelCase__							     =True
			def __init__(      self				:			Dict   ,   a				:			Optional[Any]=None   ,   a				:			List[str]=None   ,   a				:			List[str]=640   ,   a				:			Optional[Any]=1.0   ,   a				:			int=0.02   ,   **a				:			Optional[Any]   ,   )				->							Optional[Any]:

				"""simple docstring"""

				super().__init__(**a						)

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

				if vision_config is None:
					SCREAMING_SNAKE_CASE :   List[str]					  =							{}
					logger.info("vision_config is None. Initializing the AlignVisionConfig with default values."						)

				SCREAMING_SNAKE_CASE :   List[Any]					  =							AlignTextConfig(**a						)
				SCREAMING_SNAKE_CASE :   Optional[int]					  =							AlignVisionConfig(**a						)

				SCREAMING_SNAKE_CASE :   int					  =							projection_dim
				SCREAMING_SNAKE_CASE :   Dict					  =							temperature_init_value
				SCREAMING_SNAKE_CASE :   str					  =							initializer_range
			@classmethod
			def 				__UpperCamelCase			(      cls				:			Union[str, Any]   ,   a				:			AlignTextConfig   ,   a				:			AlignVisionConfig   ,   **a				:			Tuple						)				->							Any:

				"""simple docstring"""

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






			def 				__UpperCamelCase			(      self				:			Any						)				->							Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   str					  =							copy.deepcopy(self.__dict__						)
				SCREAMING_SNAKE_CASE :   Any					  =							self.text_config.to_dict()
				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							self.vision_config.to_dict()
				SCREAMING_SNAKE_CASE :   str					  =							self.__class__.model_type
				return output


from __future__ import annotations

def 			lowerCamelCase__			(       _a):
	SCREAMING_SNAKE_CASE :   Optional[Any]					  =							2
	SCREAMING_SNAKE_CASE :   Optional[int]					  =							[]
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(_a)
	if n > 1:
		factors.append(_a)
	return factors


if __name__ == "__main__":
			import doctest

			doctest.testmod()