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


snake_case									=    logging.get_logger(__name__)

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




class    lowerCAmelCase       (     UpperCamelCase_  ):
 A_				:				int	=			"""align_text_model"""


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

  super().__init__(**a__    )

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


 @classmethod
 def    _A	(    cls  : Any			,							a__  : Union[str, os.PathLike]			,							**a__  : Union[str, Any]    ):
  '''simple docstring'''

  cls._set_token_in_kwargs(a__    )

  lowerCAmelCase__		,     lowerCAmelCase__     :   List[str]     		=	cls.get_config_dict(a__			,							**a__    )

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




class    lowerCAmelCase       (     UpperCamelCase_  ):
 A_				:				Any	=			"""align_vision_model"""


 def __init__(    self  : str			,							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__  : Tuple			,							):
  '''simple docstring'''

  super().__init__(**a__    )

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


 @classmethod
 def    _A	(    cls  : int			,							a__  : Union[str, os.PathLike]			,							**a__  : Union[str, Any]    ):
  '''simple docstring'''

  cls._set_token_in_kwargs(a__    )

  lowerCAmelCase__		,     lowerCAmelCase__     :   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":
   lowerCAmelCase__     :   Optional[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    lowerCAmelCase       (     UpperCamelCase_  ):
 A_				:				Dict	=			"""align"""
 A_				:				List[str]	=			True


 def __init__(    self  : Union[str, Any]			,							a__  : List[Any]=None			,							a__  : str=None			,							a__  : Union[str, Any]=640			,							a__  : Dict=1.0			,							a__  : Optional[int]=0.02			,							**a__  : Optional[int]			,							):
  '''simple docstring'''

  super().__init__(**a__    )

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

  if vision_config is None:
   lowerCAmelCase__     :   Union[str, Any]     		=	{}
   logger.info("vision_config is None. Initializing the AlignVisionConfig with default values."    )

  lowerCAmelCase__     :   Union[str, Any]     		=	AlignTextConfig(**a__    )
  lowerCAmelCase__     :   List[Any]     		=	AlignVisionConfig(**a__    )

  lowerCAmelCase__     :   List[Any]     		=	projection_dim
  lowerCAmelCase__     :   Optional[Any]     		=	temperature_init_value
  lowerCAmelCase__     :   Tuple     		=	initializer_range


 @classmethod
 def    _A	(    cls  : Optional[int]			,							a__  : AlignTextConfig			,							a__  : AlignVisionConfig			,							**a__  : Optional[int]    ):
  '''simple docstring'''

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


 def    _A	(    self  : str    ):
  '''simple docstring'''

  lowerCAmelCase__     :   Tuple     		=	copy.deepcopy(self.__dict__    )
  lowerCAmelCase__     :   Optional[int]     		=	self.text_config.to_dict()
  lowerCAmelCase__     :   int     		=	self.vision_config.to_dict()
  lowerCAmelCase__     :   int     		=	self.__class__.model_type
  return output







'''simple docstring'''

import warnings
from functools import wraps
from typing import Callable


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 @wraps(lowerCamelCase_			)
 def _inner_fn(*lowerCamelCase_      ,			**lowerCamelCase_			):
  warnings.warn(
      (f'''\'{fn.__name__}\' is experimental and might be subject to breaking changes in the future.''')      ,			lowerCamelCase_      ,			)
  return fn(*lowerCamelCase_      ,			**lowerCamelCase_			)

 return _inner_fn





