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


a=  logging.get_logger(__name__)

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






class 			__lowercase		(						_lowerCamelCase						):







     """simple docstring"""






     SCREAMING_SNAKE_CASE__		   =						'''align_text_model'''







     def __init__(		self     ,			_lowerCamelCase=3_0_5_2_2     ,			_lowerCamelCase=7_6_8     ,			_lowerCamelCase=1_2     ,			_lowerCamelCase=1_2     ,			_lowerCamelCase=3_0_7_2     ,			_lowerCamelCase="gelu"     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=5_1_2     ,			_lowerCamelCase=2     ,			_lowerCamelCase=0.0_2     ,			_lowerCamelCase=1E-1_2     ,			_lowerCamelCase=0     ,			_lowerCamelCase="absolute"     ,			_lowerCamelCase=True     ,			**_lowerCamelCase     ,			):
         super().__init__(**_lowerCamelCase    )

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







     @classmethod
     def lowerCAmelCase     (		cls     ,			_lowerCamelCase     ,			**_lowerCamelCase    ):
         cls._set_token_in_kwargs(_lowerCamelCase    )

         __UpperCamelCase    ,					__UpperCamelCase	:	List[str]		    =  cls.get_config_dict(_lowerCamelCase     ,			**_lowerCamelCase    )

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






class 			__lowercase		(						_lowerCamelCase						):







     """simple docstring"""






     SCREAMING_SNAKE_CASE__		   =						'''align_vision_model'''







     def __init__(		self     ,			_lowerCamelCase = 3     ,			_lowerCamelCase = 6_0_0     ,			_lowerCamelCase = 2.0     ,			_lowerCamelCase = 3.1     ,			_lowerCamelCase = 8     ,			_lowerCamelCase = [3, 3, 5, 3, 5, 5, 3]     ,			_lowerCamelCase = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]     ,			_lowerCamelCase = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]     ,			_lowerCamelCase = []     ,			_lowerCamelCase = [1, 2, 2, 2, 1, 2, 1]     ,			_lowerCamelCase = [1, 2, 2, 3, 3, 4, 1]     ,			_lowerCamelCase = [1, 6, 6, 6, 6, 6, 6]     ,			_lowerCamelCase = 0.2_5     ,			_lowerCamelCase = "swish"     ,			_lowerCamelCase = 2_5_6_0     ,			_lowerCamelCase = "mean"     ,			_lowerCamelCase = 0.0_2     ,			_lowerCamelCase = 0.0_0_1     ,			_lowerCamelCase = 0.9_9     ,			_lowerCamelCase = 0.2     ,			**_lowerCamelCase     ,			):
         super().__init__(**_lowerCamelCase    )

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







     @classmethod
     def lowerCAmelCase     (		cls     ,			_lowerCamelCase     ,			**_lowerCamelCase    ):
         cls._set_token_in_kwargs(_lowerCamelCase    )

         __UpperCamelCase    ,					__UpperCamelCase	:	Tuple		    =  cls.get_config_dict(_lowerCamelCase     ,			**_lowerCamelCase    )

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






class 			__lowercase		(						_lowerCamelCase						):







     """simple docstring"""






     SCREAMING_SNAKE_CASE__		   =						'''align'''
     SCREAMING_SNAKE_CASE__		   =						True







     def __init__(		self     ,			_lowerCamelCase=None     ,			_lowerCamelCase=None     ,			_lowerCamelCase=6_4_0     ,			_lowerCamelCase=1.0     ,			_lowerCamelCase=0.0_2     ,			**_lowerCamelCase     ,			):
         super().__init__(**_lowerCamelCase    )

         if text_config is None:
             __UpperCamelCase	:	int		    =  {}
             logger.info('text_config is None. Initializing the AlignTextConfig with default values.'    )

         if vision_config is None:
             __UpperCamelCase	:	List[str]		    =  {}
             logger.info('vision_config is None. Initializing the AlignVisionConfig with default values.'    )

         __UpperCamelCase	:	Dict		    =  AlignTextConfig(**_lowerCamelCase    )
         __UpperCamelCase	:	List[str]		    =  AlignVisionConfig(**_lowerCamelCase    )

         __UpperCamelCase	:	str		    =  projection_dim
         __UpperCamelCase	:	Optional[int]		    =  temperature_init_value
         __UpperCamelCase	:	Any		    =  initializer_range







     @classmethod
     def lowerCAmelCase     (		cls     ,			_lowerCamelCase     ,			_lowerCamelCase     ,			**_lowerCamelCase    ):
         return cls(text_config=text_config.to_dict()     ,			vision_config=vision_config.to_dict()     ,			**_lowerCamelCase    )







     def lowerCAmelCase     (		self    ):
         __UpperCamelCase	:	Union[str, Any]		    =  copy.deepcopy(self.__dict__    )
         __UpperCamelCase	:	Union[str, Any]		    =  self.text_config.to_dict()
         __UpperCamelCase	:	Optional[int]		    =  self.vision_config.to_dict()
         __UpperCamelCase	:	str		    =  self.__class__.model_type
         return output




'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
)


a=  {}

try:
  if not is_sentencepiece_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  a=  ['''NllbTokenizer''']

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  a=  ['''NllbTokenizerFast''']


if TYPE_CHECKING:
  try:
    if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_nllb import NllbTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_nllb_fast import NllbTokenizerFast

else:
  import sys

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



