






"""simple docstring"""





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


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

UpperCamelCase_	:				int										= {
    "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      _lowercase (     _UpperCAmelCase		,  _UpperCAmelCase						):
      _a   :     List[Any]								=   '''nat'''

      _a   :     Optional[Any]								=   {
          '''num_attention_heads''': '''num_heads''',
          '''num_hidden_layers''': '''num_layers''',
      }


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





            """simple docstring"""







            super().__init__(**lowercase_						)

            __snake_case      :    List[Any]  			=patch_size
            __snake_case      :    Optional[Any]  			=num_channels
            __snake_case      :    Any  			=embed_dim
            __snake_case      :    Any  			=depths
            __snake_case      :    Dict  			=len(lowercase_						)
            __snake_case      :    Optional[Any]  			=num_heads
            __snake_case      :    Union[str, Any]  			=kernel_size
            __snake_case      :    Any  			=mlp_ratio
            __snake_case      :    List[str]  			=qkv_bias
            __snake_case      :    Dict  			=hidden_dropout_prob
            __snake_case      :    List[Any]  			=attention_probs_dropout_prob
            __snake_case      :    int  			=drop_path_rate
            __snake_case      :    Optional[int]  			=hidden_act
            __snake_case      :    List[str]  			=layer_norm_eps
            __snake_case      :    Dict  			=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
            __snake_case      :    str  			=int(embed_dim * 2 ** (len(lowercase_						) - 1)						)
            __snake_case      :    Optional[Any]  			=layer_scale_init_value
            __snake_case      :    Union[str, Any]  			=["""stem"""] + [f'''stage{idx}''' for idx in range(1							,   len(lowercase_						) + 1						)]
            __snake_case      :    int  			=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_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


UpperCamelCase_	:				str										= {"""processing_layoutxlm""": ["""LayoutXLMProcessor"""]}

try:
    if not is_sentencepiece_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    UpperCamelCase_	:				Union[str, Any]										= ["""LayoutXLMTokenizer"""]

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    UpperCamelCase_	:				Optional[int]										= ["""LayoutXLMTokenizerFast"""]

if TYPE_CHECKING:
    from .processing_layoutxlm import LayoutXLMProcessor

    try:
        if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_layoutxlm import LayoutXLMTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_layoutxlm_fast import LayoutXLMTokenizerFast

else:
    import sys

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


