





"""simple docstring"""





from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowercase__				:Optional[int]				   =       logging.get_logger(__name__)

lowercase__				:List[Any]				   =       {
    'shi-labs/dinat-mini-in1k-224': 'https://huggingface.co/shi-labs/dinat-mini-in1k-224/resolve/main/config.json',
    # See all Dinat models at https://huggingface.co/models?filter=dinat
}




class 							snake_case							(			__UpperCAmelCase      ,  __UpperCAmelCase ):

      '''simple docstring'''



      _A     :       List[Any]         =       'dinat'

      _A     :       int         =       {
          'num_attention_heads': 'num_heads',
          'num_hidden_layers': 'num_layers',
      }

      def __init__(							self       :      str						,				__lowercase       :      Any=4						,				__lowercase       :      Tuple=3						,				__lowercase       :      str=64						,				__lowercase       :      Any=[3, 4, 6, 5]						,				__lowercase       :      Union[str, Any]=[2, 4, 8, 16]						,				__lowercase       :      int=7						,				__lowercase       :      Union[str, Any]=[[1, 8, 1], [1, 4, 1, 4], [1, 2, 1, 2, 1, 2], [1, 1, 1, 1, 1]]						,				__lowercase       :      Dict=3.0						,				__lowercase       :      Any=True						,				__lowercase       :      Optional[Any]=0.0						,				__lowercase       :      Tuple=0.0						,				__lowercase       :      Any=0.1						,				__lowercase       :      Tuple="gelu"						,				__lowercase       :      List[str]=0.0_2						,				__lowercase       :      int=1e-5						,				__lowercase       :      Any=0.0						,				__lowercase       :      List[str]=None						,				__lowercase       :      List[str]=None						,				**__lowercase       :      Any						,				):


        '''simple docstring'''




        super().__init__(**__lowercase )

        __UpperCAmelCase    :						Tuple       =						patch_size
        __UpperCAmelCase    :						Union[str, Any]       =						num_channels
        __UpperCAmelCase    :						Optional[Any]       =						embed_dim
        __UpperCAmelCase    :						str       =						depths
        __UpperCAmelCase    :						str       =						len(__lowercase )
        __UpperCAmelCase    :						List[Any]       =						num_heads
        __UpperCAmelCase    :						Optional[int]       =						kernel_size
        __UpperCAmelCase    :						Optional[Any]       =						dilations
        __UpperCAmelCase    :						List[str]       =						mlp_ratio
        __UpperCAmelCase    :						Any       =						qkv_bias
        __UpperCAmelCase    :						Optional[Any]       =						hidden_dropout_prob
        __UpperCAmelCase    :						Union[str, Any]       =						attention_probs_dropout_prob
        __UpperCAmelCase    :						Optional[Any]       =						drop_path_rate
        __UpperCAmelCase    :						List[Any]       =						hidden_act
        __UpperCAmelCase    :						List[Any]       =						layer_norm_eps
        __UpperCAmelCase    :						Optional[Any]       =						initializer_range
        # we set the hidden_size attribute in order to make Dinat work with VisionEncoderDecoderModel
        # this indicates the channel dimension after the last stage of the model
        __UpperCAmelCase    :						Tuple       =						int(embed_dim * 2 ** (len(__lowercase ) - 1) )
        __UpperCAmelCase    :						Union[str, Any]       =						layer_scale_init_value
        __UpperCAmelCase    :						Optional[int]       =						['''stem'''] + [f'''stage{idx}''' for idx in range(1						,				len(__lowercase ) + 1 )]
        __UpperCAmelCase       ,     __UpperCAmelCase    :						Any       =						get_aligned_output_features_output_indices(
            out_features=__lowercase						,				out_indices=__lowercase						,				stage_names=self.stage_names )






"""simple docstring"""





from typing import TYPE_CHECKING

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


lowercase__				:Tuple				   =       {
    'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'],
    'tokenization_xlm': ['XLMTokenizer'],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase__				:Optional[Any]				   =       [
      'XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
      'XLMForMultipleChoice',
      'XLMForQuestionAnswering',
      'XLMForQuestionAnsweringSimple',
      'XLMForSequenceClassification',
      'XLMForTokenClassification',
      'XLMModel',
      'XLMPreTrainedModel',
      'XLMWithLMHeadModel',
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase__				:List[Any]				   =       [
      'TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
      'TFXLMForMultipleChoice',
      'TFXLMForQuestionAnsweringSimple',
      'TFXLMForSequenceClassification',
      'TFXLMForTokenClassification',
      'TFXLMMainLayer',
      'TFXLMModel',
      'TFXLMPreTrainedModel',
      'TFXLMWithLMHeadModel',
  ]


if TYPE_CHECKING:
  from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig, XLMOnnxConfig
  from .tokenization_xlm import XLMTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_xlm import (
        XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
        XLMForMultipleChoice,
        XLMForQuestionAnswering,
        XLMForQuestionAnsweringSimple,
        XLMForSequenceClassification,
        XLMForTokenClassification,
        XLMModel,
        XLMPreTrainedModel,
        XLMWithLMHeadModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_xlm import (
        TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFXLMForMultipleChoice,
        TFXLMForQuestionAnsweringSimple,
        TFXLMForSequenceClassification,
        TFXLMForTokenClassification,
        TFXLMMainLayer,
        TFXLMModel,
        TFXLMPreTrainedModel,
        TFXLMWithLMHeadModel,
    )

else:
  import sys

  lowercase__				:List[Any]				   =       _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)