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


__a         =   logging.get_logger(__name__)

__a         =   {
    '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				):



	"""simple docstring"""




	a     :List[Any]       	=      'nat'

	a     :List[str]       	=      {
	    'num_attention_heads': 'num_heads',
	    'num_hidden_layers': 'num_layers',
	}
	def __init__(			self    :     List[Any]			,				SCREAMING_SNAKE_CASE_    :     int=4			,				SCREAMING_SNAKE_CASE_    :     Optional[int]=3			,				SCREAMING_SNAKE_CASE_    :     int=6_4			,				SCREAMING_SNAKE_CASE_    :     Dict=[3, 4, 6, 5]			,				SCREAMING_SNAKE_CASE_    :     List[str]=[2, 4, 8, 1_6]			,				SCREAMING_SNAKE_CASE_    :     List[str]=7			,				SCREAMING_SNAKE_CASE_    :     List[Any]=3.0			,				SCREAMING_SNAKE_CASE_    :     Optional[int]=True			,				SCREAMING_SNAKE_CASE_    :     List[Any]=0.0			,				SCREAMING_SNAKE_CASE_    :     Any=0.0			,				SCREAMING_SNAKE_CASE_    :     str=0.1			,				SCREAMING_SNAKE_CASE_    :     Any="gelu"			,				SCREAMING_SNAKE_CASE_    :     Tuple=0.02			,				SCREAMING_SNAKE_CASE_    :     Optional[int]=1e-5			,				SCREAMING_SNAKE_CASE_    :     Tuple=0.0			,				SCREAMING_SNAKE_CASE_    :     str=None			,				SCREAMING_SNAKE_CASE_    :     Optional[int]=None			,				**SCREAMING_SNAKE_CASE_    :     Optional[int]			,				)			->	Optional[Any]:
					super().__init__(**SCREAMING_SNAKE_CASE_			)

					lowercase_	    =   patch_size
					lowercase_	    =   num_channels
					lowercase_	    =   embed_dim
					lowercase_	    =   depths
					lowercase_	    =   len(SCREAMING_SNAKE_CASE_			)
					lowercase_	    =   num_heads
					lowercase_	    =   kernel_size
					lowercase_	    =   mlp_ratio
					lowercase_	    =   qkv_bias
					lowercase_	    =   hidden_dropout_prob
					lowercase_	    =   attention_probs_dropout_prob
					lowercase_	    =   drop_path_rate
					lowercase_	    =   hidden_act
					lowercase_	    =   layer_norm_eps
					lowercase_	    =   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
					lowercase_	    =   int(embed_dim * 2 ** (len(SCREAMING_SNAKE_CASE_			) - 1)			)
					lowercase_	    =   layer_scale_init_value
					lowercase_	    =   ['''stem'''] + [f'''stage{idx}''' for idx in range(1			,				len(SCREAMING_SNAKE_CASE_			) + 1			)]
					lowercase_    ,      lowercase_	    =   get_aligned_output_features_output_indices(
					    out_features=SCREAMING_SNAKE_CASE_			,				out_indices=SCREAMING_SNAKE_CASE_			,				stage_names=self.stage_names			)









from typing import TYPE_CHECKING

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


lowerCamelCase		       =      {
    """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrOCRConfig"""],
    """processing_trocr""": ["""TrOCRProcessor"""],
}


try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCamelCase		       =      [
						    """TROCR_PRETRAINED_MODEL_ARCHIVE_LIST""",
						    """TrOCRForCausalLM""",
						    """TrOCRPreTrainedModel""",
						]


if TYPE_CHECKING:
						from .configuration_trocr import TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP, TrOCRConfig
						from .processing_trocr import TrOCRProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_trocr import TROCR_PRETRAINED_MODEL_ARCHIVE_LIST, TrOCRForCausalLM, TrOCRPreTrainedModel

else:
						import sys

						lowerCamelCase		       =      _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


