



"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__SCREAMING_SNAKE_CASE	:    List[str]     				=   logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE	:    List[str]     				=   {
    'shi-labs/nat-mini-in1k-224': 'https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json',
    # See all Nat models at https://huggingface.co/models?filter=nat
}


class 				lowerCamelCase_( _SCREAMING_SNAKE_CASE,					_SCREAMING_SNAKE_CASE     ):





					'''simple docstring'''



					lowercase__ :							Optional[int]              =			'nat'

					lowercase__ :							Union[str, Any]              =			{
					    'num_attention_heads': 'num_heads',
					    'num_hidden_layers': 'num_layers',
					}

					def __init__(     self					,							lowerCamelCase__=4					,							lowerCamelCase__=3					,							lowerCamelCase__=6_4					,							lowerCamelCase__=[3, 4, 6, 5]					,							lowerCamelCase__=[2, 4, 8, 1_6]					,							lowerCamelCase__=7					,							lowerCamelCase__=3.0					,							lowerCamelCase__=True					,							lowerCamelCase__=0.0					,							lowerCamelCase__=0.0					,							lowerCamelCase__=0.1					,							lowerCamelCase__="gelu"					,							lowerCamelCase__=0.0_2					,							lowerCamelCase__=1e-5					,							lowerCamelCase__=0.0					,							lowerCamelCase__=None					,							lowerCamelCase__=None					,							**lowerCamelCase__					,							):
									super().__init__(**_lowerCAmelCase )

									_lowerCamelCase   	=					patch_size
									_lowerCamelCase   	=					num_channels
									_lowerCamelCase   	=					embed_dim
									_lowerCamelCase   	=					depths
									_lowerCamelCase   	=					len(_lowerCAmelCase )
									_lowerCamelCase   	=					num_heads
									_lowerCamelCase   	=					kernel_size
									_lowerCamelCase   	=					mlp_ratio
									_lowerCamelCase   	=					qkv_bias
									_lowerCamelCase   	=					hidden_dropout_prob
									_lowerCamelCase   	=					attention_probs_dropout_prob
									_lowerCamelCase   	=					drop_path_rate
									_lowerCamelCase   	=					hidden_act
									_lowerCamelCase   	=					layer_norm_eps
									_lowerCamelCase   	=					initializer_range
									# we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
									# this indicates the channel dimension after the last stage of the model
									_lowerCamelCase   	=					int(embed_dim * 2 ** (len(_lowerCAmelCase ) - 1) )
									_lowerCamelCase   	=					layer_scale_init_value
									_lowerCamelCase   	=					['''stem'''] + [F"""stage{idx}""" for idx in range(1					,							len(_lowerCAmelCase ) + 1 )]
									_lowerCamelCase	,  _lowerCamelCase   	=					get_aligned_output_features_output_indices(
									    out_features=_lowerCAmelCase					,							out_indices=_lowerCAmelCase					,							stage_names=self.stage_names )






from typing import TYPE_CHECKING

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


if is_sentencepiece_available():
   from ..ta.tokenization_ta import TaTokenizer
else:
   from ...utils.dummy_sentencepiece_objects import TaTokenizer

lowerCamelCase__					:  List[Any]      							=				TaTokenizer

if is_tokenizers_available():
   from ..ta.tokenization_ta_fast import TaTokenizerFast
else:
   from ...utils.dummy_tokenizers_objects import TaTokenizerFast

lowerCamelCase__					:  Union[str, Any]      							=				TaTokenizerFast

lowerCamelCase__					:  Dict      							=				{'configuration_mt5': ['MT5Config', 'MT5OnnxConfig']}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__					:  Tuple      							=				[
       'MT5EncoderModel',
       'MT5ForConditionalGeneration',
       'MT5ForQuestionAnswering',
       'MT5Model',
       'MT5PreTrainedModel',
       'MT5Stack',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__					:  Tuple      							=				['TFMT5EncoderModel', 'TFMT5ForConditionalGeneration', 'TFMT5Model']

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__					:  Tuple      							=				['FlaxMT5EncoderModel', 'FlaxMT5ForConditionalGeneration', 'FlaxMT5Model']


if TYPE_CHECKING:
   from .configuration_mta import MTaConfig, MTaOnnxConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_mta import (
          MTaEncoderModel,
          MTaForConditionalGeneration,
          MTaForQuestionAnswering,
          MTaModel,
          MTaPreTrainedModel,
          MTaStack,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_mta import TFMTaEncoderModel, TFMTaForConditionalGeneration, TFMTaModel

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_flax_mta import FlaxMTaEncoderModel, FlaxMTaForConditionalGeneration, FlaxMTaModel

else:
   import sys

   lowerCamelCase__					:  int      							=				_LazyModule(
       __name__,
       globals()['__file__'],
       _import_structure,
       extra_objects={'MT5Tokenizer': MTaTokenizer, 'MT5TokenizerFast': MTaTokenizerFast},
       module_spec=__spec__,
   )