




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


if TYPE_CHECKING:
  pass

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


_lowerCamelCase      :						Any							=  logging.get_logger(__name__)

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


class 							UpperCamelCase_       (					UpperCAmelCase__	):

    '''simple docstring'''






    UpperCAmelCase__				    = '''align_text_model'''


    def __init__(     self :      Optional[int]   ,					UpperCAmelCase__ :      List[Any]=30_522   ,					UpperCAmelCase__ :      Optional[Any]=768   ,					UpperCAmelCase__ :      List[str]=12   ,					UpperCAmelCase__ :      Optional[int]=12   ,					UpperCAmelCase__ :      Optional[Any]=3_072   ,					UpperCAmelCase__ :      Union[str, Any]="gelu"   ,					UpperCAmelCase__ :      Any=0.1   ,					UpperCAmelCase__ :      Union[str, Any]=0.1   ,					UpperCAmelCase__ :      Any=512   ,					UpperCAmelCase__ :      Tuple=2   ,					UpperCAmelCase__ :      List[Any]=0.02   ,					UpperCAmelCase__ :      Optional[int]=1e-12   ,					UpperCAmelCase__ :      str=0   ,					UpperCAmelCase__ :      Optional[int]="absolute"   ,					UpperCAmelCase__ :      Union[str, Any]=True   ,					**UpperCAmelCase__ :      Optional[Any]   ,					)		->Union[str, Any]:





           '''simple docstring'''

           super().__init__(**UpperCAmelCase__)

           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 			SCREAMING_SNAKE_CASE				(     cls :      Any   ,					UpperCAmelCase__ :      Union[str, os.PathLike]   ,					**UpperCAmelCase__ :      Optional[Any])		->"PretrainedConfig":





           '''simple docstring'''

           cls._set_token_in_kwargs(UpperCAmelCase__)

           A__					,				A__ 					=       cls.get_config_dict(UpperCAmelCase__   ,					**UpperCAmelCase__)

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


class 							UpperCamelCase_       (					UpperCAmelCase__	):

    '''simple docstring'''






    UpperCAmelCase__				    = '''align_vision_model'''


    def __init__(     self :      int   ,					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 = 2_560   ,					UpperCAmelCase__ :      str = "mean"   ,					UpperCAmelCase__ :      float = 0.02   ,					UpperCAmelCase__ :      float = 0.001   ,					UpperCAmelCase__ :      float = 0.99   ,					UpperCAmelCase__ :      float = 0.2   ,					**UpperCAmelCase__ :      int   ,					)		->Union[str, Any]:





           '''simple docstring'''

           super().__init__(**UpperCAmelCase__)

           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(UpperCAmelCase__) * 4





    @classmethod
    def 			SCREAMING_SNAKE_CASE				(     cls :      Optional[Any]   ,					UpperCAmelCase__ :      Union[str, os.PathLike]   ,					**UpperCAmelCase__ :      Dict)		->"PretrainedConfig":





           '''simple docstring'''

           cls._set_token_in_kwargs(UpperCAmelCase__)

           A__					,				A__ 					=       cls.get_config_dict(UpperCAmelCase__   ,					**UpperCAmelCase__)

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


class 							UpperCamelCase_       (					UpperCAmelCase__	):

    '''simple docstring'''






    UpperCAmelCase__				    = '''align'''
    UpperCAmelCase__				    = True


    def __init__(     self :      Union[str, Any]   ,					UpperCAmelCase__ :      Optional[Any]=None   ,					UpperCAmelCase__ :      Optional[Any]=None   ,					UpperCAmelCase__ :      List[Any]=640   ,					UpperCAmelCase__ :      List[Any]=1.0   ,					UpperCAmelCase__ :      Dict=0.02   ,					**UpperCAmelCase__ :      Any   ,					)		->Dict:





           '''simple docstring'''

           super().__init__(**UpperCAmelCase__)

           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(**UpperCAmelCase__)
           A__ 					=       AlignVisionConfig(**UpperCAmelCase__)

           A__ 					=       projection_dim
           A__ 					=       temperature_init_value
           A__ 					=       initializer_range


    @classmethod
    def 			SCREAMING_SNAKE_CASE				(     cls :      Dict   ,					UpperCAmelCase__ :      AlignTextConfig   ,					UpperCAmelCase__ :      AlignVisionConfig   ,					**UpperCAmelCase__ :      Tuple)		->Tuple:





           '''simple docstring'''

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





    def 			SCREAMING_SNAKE_CASE				(     self :      Any)		->Optional[int]:





           '''simple docstring'''

           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 typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowercase				 =					{
    '''configuration_mctct''': ['''MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MCTCTConfig'''],
    '''feature_extraction_mctct''': ['''MCTCTFeatureExtractor'''],
    '''processing_mctct''': ['''MCTCTProcessor'''],
}


try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase				 =					[
		    '''MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''MCTCTForCTC''',
		    '''MCTCTModel''',
		    '''MCTCTPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_mctct import MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP, MCTCTConfig
		from .feature_extraction_mctct import MCTCTFeatureExtractor
		from .processing_mctct import MCTCTProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_mctct import MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST, MCTCTForCTC, MCTCTModel, MCTCTPreTrainedModel

else:
		import sys

		_lowercase				 =					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)