






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 			SCREAMING_SNAKE_CASE      (      lowerCAmelCase       ):
     '''simple docstring'''


     UpperCamelCase_				:		int								=						'''align_text_model'''


     def __init__(					self							:						Dict       ,			UpperCAmelCase_							:						List[str]=3_0522       ,			UpperCAmelCase_							:						Dict=768       ,			UpperCAmelCase_							:						str=12       ,			UpperCAmelCase_							:						Optional[Any]=12       ,			UpperCAmelCase_							:						List[str]=3072       ,			UpperCAmelCase_							:						Dict="gelu"       ,			UpperCAmelCase_							:						int=0.1       ,			UpperCAmelCase_							:						Any=0.1       ,			UpperCAmelCase_							:						Dict=512       ,			UpperCAmelCase_							:						str=2       ,			UpperCAmelCase_							:						Dict=0.02       ,			UpperCAmelCase_							:						Optional[int]=1E-12       ,			UpperCAmelCase_							:						List[str]=0       ,			UpperCAmelCase_							:						List[Any]="absolute"       ,			UpperCAmelCase_							:						List[Any]=True       ,			**UpperCAmelCase_							:						Optional[int]       ,			):
       super().__init__(**UpperCAmelCase_   )

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






     @classmethod
     def 					_A							(					cls							:						Any       ,			UpperCAmelCase_							:						Union[str, os.PathLike]       ,			**UpperCAmelCase_							:						Union[str, Any]   ):
       cls._set_token_in_kwargs(UpperCAmelCase_   )

       SCREAMING_SNAKE_CASE    ,	SCREAMING_SNAKE_CASE							:   List[str]						    =     cls.get_config_dict(UpperCAmelCase_       ,			**UpperCAmelCase_   )

       # get the text config dict if we are loading from AlignConfig
       if config_dict.get("model_type"   ) == "align":
         SCREAMING_SNAKE_CASE							:   Optional[int]						    =     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(UpperCAmelCase_       ,			**UpperCAmelCase_   )





class 			SCREAMING_SNAKE_CASE      (      lowerCAmelCase       ):
     '''simple docstring'''


     UpperCamelCase_				:		int								=						'''align_vision_model'''


     def __init__(					self							:						Union[str, Any]       ,			UpperCAmelCase_							:						int = 3       ,			UpperCAmelCase_							:						int = 600       ,			UpperCAmelCase_							:						float = 2.0       ,			UpperCAmelCase_							:						float = 3.1       ,			UpperCAmelCase_							:						int = 8       ,			UpperCAmelCase_							:						List[int] = [3, 3, 5, 3, 5, 5, 3]       ,			UpperCAmelCase_							:						List[int] = [32, 16, 24, 40, 80, 112, 192]       ,			UpperCAmelCase_							:						List[int] = [16, 24, 40, 80, 112, 192, 320]       ,			UpperCAmelCase_							:						List[int] = []       ,			UpperCAmelCase_							:						List[int] = [1, 2, 2, 2, 1, 2, 1]       ,			UpperCAmelCase_							:						List[int] = [1, 2, 2, 3, 3, 4, 1]       ,			UpperCAmelCase_							:						List[int] = [1, 6, 6, 6, 6, 6, 6]       ,			UpperCAmelCase_							:						float = 0.25       ,			UpperCAmelCase_							:						str = "swish"       ,			UpperCAmelCase_							:						int = 2560       ,			UpperCAmelCase_							:						str = "mean"       ,			UpperCAmelCase_							:						float = 0.02       ,			UpperCAmelCase_							:						float = 0.001       ,			UpperCAmelCase_							:						float = 0.99       ,			UpperCAmelCase_							:						float = 0.2       ,			**UpperCAmelCase_							:						List[str]       ,			):
       super().__init__(**UpperCAmelCase_   )

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






     @classmethod
     def 					_A							(					cls							:						int       ,			UpperCAmelCase_							:						Union[str, os.PathLike]       ,			**UpperCAmelCase_							:						Union[str, Any]   ):
       cls._set_token_in_kwargs(UpperCAmelCase_   )

       SCREAMING_SNAKE_CASE    ,	SCREAMING_SNAKE_CASE							:   str						    =     cls.get_config_dict(UpperCAmelCase_       ,			**UpperCAmelCase_   )

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





class 			SCREAMING_SNAKE_CASE      (      lowerCAmelCase       ):
     '''simple docstring'''


     UpperCamelCase_				:		Dict								=						'''align'''
     UpperCamelCase_				:		Optional[int]								=						True


     def __init__(					self							:						str       ,			UpperCAmelCase_							:						Optional[Any]=None       ,			UpperCAmelCase_							:						str=None       ,			UpperCAmelCase_							:						Optional[int]=640       ,			UpperCAmelCase_							:						List[Any]=1.0       ,			UpperCAmelCase_							:						str=0.02       ,			**UpperCAmelCase_							:						Optional[Any]       ,			):
       super().__init__(**UpperCAmelCase_   )

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

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

       SCREAMING_SNAKE_CASE							:   List[str]						    =     AlignTextConfig(**UpperCAmelCase_   )
       SCREAMING_SNAKE_CASE							:   Union[str, Any]						    =     AlignVisionConfig(**UpperCAmelCase_   )

       SCREAMING_SNAKE_CASE							:   List[str]						    =     projection_dim
       SCREAMING_SNAKE_CASE							:   Tuple						    =     temperature_init_value
       SCREAMING_SNAKE_CASE							:   str						    =     initializer_range


     @classmethod
     def 					_A							(					cls							:						Any       ,			UpperCAmelCase_							:						AlignTextConfig       ,			UpperCAmelCase_							:						AlignVisionConfig       ,			**UpperCAmelCase_							:						List[str]   ):
       return cls(text_config=text_config.to_dict()       ,			vision_config=vision_config.to_dict()       ,			**UpperCAmelCase_   )






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













"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__A											=						{
    """configuration_x_clip""": [
        """XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """XCLIPConfig""",
        """XCLIPTextConfig""",
        """XCLIPVisionConfig""",
    ],
    """processing_x_clip""": ["""XCLIPProcessor"""],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __A											=						[
      """XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """XCLIPModel""",
      """XCLIPPreTrainedModel""",
      """XCLIPTextModel""",
      """XCLIPVisionModel""",
  ]

if TYPE_CHECKING:
  from .configuration_x_clip import (
      XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
      XCLIPConfig,
      XCLIPTextConfig,
      XCLIPVisionConfig,
  )
  from .processing_x_clip import XCLIPProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_x_clip import (
        XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
        XCLIPModel,
        XCLIPPreTrainedModel,
        XCLIPTextModel,
        XCLIPVisionModel,
    )

else:
  import sys

  __A											=						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
