




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


_SCREAMING_SNAKE_CASE			=						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE			=						{
    "kakaobrain/align-base": "https://huggingface.co/kakaobrain/align-base/resolve/main/config.json",
}
class   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""align_text_model"""



					def __init__(	self     :						List[Any]      ,       _lowercase     :						Optional[Any]=30_522      ,       _lowercase     :						List[str]=768      ,       _lowercase     :						List[Any]=12      ,       _lowercase     :						Union[str, Any]=12      ,       _lowercase     :						Union[str, Any]=3_072      ,       _lowercase     :						Any="gelu"      ,       _lowercase     :						Union[str, Any]=0.1      ,       _lowercase     :						Optional[Any]=0.1      ,       _lowercase     :						int=512      ,       _lowercase     :						List[str]=2      ,       _lowercase     :						str=0.02      ,       _lowercase     :						Any=1E-12      ,       _lowercase     :						Optional[Any]=0      ,       _lowercase     :						Any="absolute"      ,       _lowercase     :						Optional[Any]=True      ,       **_lowercase     :						Union[str, Any]      ,       )    ->							Tuple:
								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     __snake_case						(	cls     :						str      ,       _lowercase     :						Union[str, os.PathLike]      ,       **_lowercase     :						Any)    ->							"PretrainedConfig":
								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   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""align_vision_model"""



					def __init__(	self     :						Any      ,       _lowercase     :						int = 3      ,       _lowercase     :						int = 600      ,       _lowercase     :						float = 2.0      ,       _lowercase     :						float = 3.1      ,       _lowercase     :						int = 8      ,       _lowercase     :						List[int] = [3, 3, 5, 3, 5, 5, 3]      ,       _lowercase     :						List[int] = [32, 16, 24, 40, 80, 112, 192]      ,       _lowercase     :						List[int] = [16, 24, 40, 80, 112, 192, 320]      ,       _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.25      ,       _lowercase     :						str = "swish"      ,       _lowercase     :						int = 2_560      ,       _lowercase     :						str = "mean"      ,       _lowercase     :						float = 0.02      ,       _lowercase     :						float = 0.0_01      ,       _lowercase     :						float = 0.99      ,       _lowercase     :						float = 0.2      ,       **_lowercase     :						Dict      ,       )    ->							str:
								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     __snake_case						(	cls     :						Optional[int]      ,       _lowercase     :						Union[str, os.PathLike]      ,       **_lowercase     :						int)    ->							"PretrainedConfig":
								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   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""align"""
					_UpperCamelCase							=		True



					def __init__(	self     :						Any      ,       _lowercase     :						List[Any]=None      ,       _lowercase     :						str=None      ,       _lowercase     :						Any=640      ,       _lowercase     :						Any=1.0      ,       _lowercase     :						Optional[Any]=0.02      ,       **_lowercase     :						Optional[int]      ,       )    ->							Dict:
								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     __snake_case						(	cls     :						int      ,       _lowercase     :						AlignTextConfig      ,       _lowercase     :						AlignVisionConfig      ,       **_lowercase     :						Optional[int])    ->							Any:
								return cls(text_config=text_config.to_dict()      ,       vision_config=vision_config.to_dict()      ,       **_lowercase)



					def     __snake_case						(	self     :						Optional[Any])    ->							List[Any]:
								A_									= copy.deepcopy(self.__dict__)
								A_									= self.text_config.to_dict()
								A_									= self.vision_config.to_dict()
								A_									= self.__class__.model_type
								return output










'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging


_SCREAMING_SNAKE_CASE			=						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE			=						{"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"}
class   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""openai-gpt"""
					_UpperCamelCase							=		{
					    """max_position_embeddings""": """n_positions""",
					    """hidden_size""": """n_embd""",
					    """num_attention_heads""": """n_head""",
					    """num_hidden_layers""": """n_layer""",
					}



					def __init__(	self     :						Any      ,       _lowercase     :						List[Any]=40_478      ,       _lowercase     :						Tuple=512      ,       _lowercase     :						Dict=768      ,       _lowercase     :						List[str]=12      ,       _lowercase     :						Optional[int]=12      ,       _lowercase     :						Tuple="gelu"      ,       _lowercase     :						int=0.1      ,       _lowercase     :						Tuple=0.1      ,       _lowercase     :						Any=0.1      ,       _lowercase     :						List[str]=1E-5      ,       _lowercase     :						str=0.02      ,       _lowercase     :						Optional[Any]="cls_index"      ,       _lowercase     :						int=True      ,       _lowercase     :						str=None      ,       _lowercase     :						Tuple=True      ,       _lowercase     :						List[Any]=0.1      ,       **_lowercase     :						int      ,       )    ->							Optional[int]:
								A_									= vocab_size
								A_									= n_positions
								A_									= n_embd
								A_									= n_layer
								A_									= n_head
								A_									= afn
								A_									= resid_pdrop
								A_									= embd_pdrop
								A_									= attn_pdrop
								A_									= layer_norm_epsilon
								A_									= initializer_range
								A_									= summary_type
								A_									= summary_use_proj
								A_									= summary_activation
								A_									= summary_first_dropout
								A_									= summary_proj_to_labels
								super().__init__(**_lowercase)




