



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


lowercase__		:    Any						   =     logging.get_logger(__name__)

lowercase__		:    List[Any]						   =     {
    """kakaobrain/align-base""": """https://huggingface.co/kakaobrain/align-base/resolve/main/config.json""",
}







class 				UpperCamelCase__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""align_text_model"""



      def __init__(				self    :				int   ,      SCREAMING_SNAKE_CASE_    :				Dict=3_0_5_2_2   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=7_6_8   ,      SCREAMING_SNAKE_CASE_    :				List[str]=1_2   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=1_2   ,      SCREAMING_SNAKE_CASE_    :				int=3_0_7_2   ,      SCREAMING_SNAKE_CASE_    :				int="gelu"   ,      SCREAMING_SNAKE_CASE_    :				str=0.1   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=0.1   ,      SCREAMING_SNAKE_CASE_    :				int=5_1_2   ,      SCREAMING_SNAKE_CASE_    :				int=2   ,      SCREAMING_SNAKE_CASE_    :				int=0.02   ,      SCREAMING_SNAKE_CASE_    :				Dict=1E-12   ,      SCREAMING_SNAKE_CASE_    :				str=0   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]="absolute"   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=True   ,      **SCREAMING_SNAKE_CASE_    :				List[Any]   ,      ):
        super().__init__(**SCREAMING_SNAKE_CASE_	)

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





      @classmethod
      def 					SCREAMING_SNAKE_CASE__			(				cls    :				List[Any]   ,      SCREAMING_SNAKE_CASE_    :				Union[str, os.PathLike]   ,      **SCREAMING_SNAKE_CASE_    :				Any	):
        cls._set_token_in_kwargs(SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_       :    List[Any]								=			cls.get_config_dict(SCREAMING_SNAKE_CASE_   ,      **SCREAMING_SNAKE_CASE_	)

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







class 				UpperCamelCase__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""align_vision_model"""



      def __init__(				self    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				int = 3   ,      SCREAMING_SNAKE_CASE_    :				int = 6_0_0   ,      SCREAMING_SNAKE_CASE_    :				float = 2.0   ,      SCREAMING_SNAKE_CASE_    :				float = 3.1   ,      SCREAMING_SNAKE_CASE_    :				int = 8   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [3, 3, 5, 3, 5, 5, 3]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = []   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1, 2, 2, 2, 1, 2, 1]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1, 2, 2, 3, 3, 4, 1]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1, 6, 6, 6, 6, 6, 6]   ,      SCREAMING_SNAKE_CASE_    :				float = 0.25   ,      SCREAMING_SNAKE_CASE_    :				str = "swish"   ,      SCREAMING_SNAKE_CASE_    :				int = 2_5_6_0   ,      SCREAMING_SNAKE_CASE_    :				str = "mean"   ,      SCREAMING_SNAKE_CASE_    :				float = 0.02   ,      SCREAMING_SNAKE_CASE_    :				float = 0.0_01   ,      SCREAMING_SNAKE_CASE_    :				float = 0.99   ,      SCREAMING_SNAKE_CASE_    :				float = 0.2   ,      **SCREAMING_SNAKE_CASE_    :				Any   ,      ):
        super().__init__(**SCREAMING_SNAKE_CASE_	)

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





      @classmethod
      def 					SCREAMING_SNAKE_CASE__			(				cls    :				Optional[int]   ,      SCREAMING_SNAKE_CASE_    :				Union[str, os.PathLike]   ,      **SCREAMING_SNAKE_CASE_    :				Optional[int]	):
        cls._set_token_in_kwargs(SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_       :    List[Any]								=			cls.get_config_dict(SCREAMING_SNAKE_CASE_   ,      **SCREAMING_SNAKE_CASE_	)

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







class 				UpperCamelCase__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""align"""
      _SCREAMING_SNAKE_CASE      =					True



      def __init__(				self    :				Optional[int]   ,      SCREAMING_SNAKE_CASE_    :				Tuple=None   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=None   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=6_4_0   ,      SCREAMING_SNAKE_CASE_    :				Dict=1.0   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=0.02   ,      **SCREAMING_SNAKE_CASE_    :				List[str]   ,      ):
        super().__init__(**SCREAMING_SNAKE_CASE_	)

        if text_config is None:
          lowerCAmelCase_       :    Optional[Any]								=			{}
          logger.info('text_config is None. Initializing the AlignTextConfig with default values.'	)

        if vision_config is None:
          lowerCAmelCase_       :    int								=			{}
          logger.info('vision_config is None. Initializing the AlignVisionConfig with default values.'	)

        lowerCAmelCase_       :    str								=			AlignTextConfig(**SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Any								=			AlignVisionConfig(**SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_       :    List[Any]								=			projection_dim
        lowerCAmelCase_       :    Optional[Any]								=			temperature_init_value
        lowerCAmelCase_       :    int								=			initializer_range



      @classmethod
      def 					SCREAMING_SNAKE_CASE__			(				cls    :				str   ,      SCREAMING_SNAKE_CASE_    :				AlignTextConfig   ,      SCREAMING_SNAKE_CASE_    :				AlignVisionConfig   ,      **SCREAMING_SNAKE_CASE_    :				Tuple	):
        return cls(text_config=text_config.to_dict()   ,      vision_config=vision_config.to_dict()   ,      **SCREAMING_SNAKE_CASE_	)





      def 					SCREAMING_SNAKE_CASE__			(				self    :				int	):
        lowerCAmelCase_       :    Dict								=			copy.deepcopy(self.__dict__	)
        lowerCAmelCase_       :    str								=			self.text_config.to_dict()
        lowerCAmelCase_       :    List[str]								=			self.vision_config.to_dict()
        lowerCAmelCase_       :    Union[str, Any]								=			self.__class__.model_type
        return output










"""simple docstring"""







from diffusers.utils.testing_utils import require_onnxruntime







@require_onnxruntime
class 				UpperCamelCase__       :




      """simple docstring"""




      pass





