



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


SCREAMING_SNAKE_CASE     				=						logging.get_logger(__name__)

SCREAMING_SNAKE_CASE     				=						{
    "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      (						lowercase__,     lowercase__  ):







					'''simple docstring'''







					lowerCAmelCase_				:    str									=  'nat'

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



					def __init__(			self    ,	lowerCAmelCase=4    ,	lowerCAmelCase=3    ,	lowerCAmelCase=64    ,	lowerCAmelCase=[3, 4, 6, 5]    ,	lowerCAmelCase=[2, 4, 8, 16]    ,	lowerCAmelCase=7    ,	lowerCAmelCase=3.0    ,	lowerCAmelCase=True    ,	lowerCAmelCase=0.0    ,	lowerCAmelCase=0.0    ,	lowerCAmelCase=0.1    ,	lowerCAmelCase="gelu"    ,	lowerCAmelCase=0.02    ,	lowerCAmelCase=1e-5    ,	lowerCAmelCase=0.0    ,	lowerCAmelCase=None    ,	lowerCAmelCase=None    ,	**lowerCAmelCase    ,	):
							super().__init__(**lowerCAmelCase     )

							UpperCAmelCase_						=				patch_size
							UpperCAmelCase_						=				num_channels
							UpperCAmelCase_						=				embed_dim
							UpperCAmelCase_						=				depths
							UpperCAmelCase_						=				len(lowerCAmelCase     )
							UpperCAmelCase_						=				num_heads
							UpperCAmelCase_						=				kernel_size
							UpperCAmelCase_						=				mlp_ratio
							UpperCAmelCase_						=				qkv_bias
							UpperCAmelCase_						=				hidden_dropout_prob
							UpperCAmelCase_						=				attention_probs_dropout_prob
							UpperCAmelCase_						=				drop_path_rate
							UpperCAmelCase_						=				hidden_act
							UpperCAmelCase_						=				layer_norm_eps
							UpperCAmelCase_						=				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
							UpperCAmelCase_						=				int(embed_dim * 2 ** (len(lowerCAmelCase     ) - 1)     )
							UpperCAmelCase_						=				layer_scale_init_value
							UpperCAmelCase_						=				["stem"] + [f'''stage{idx}''' for idx in range(1    ,	len(lowerCAmelCase     ) + 1     )]
							UpperCAmelCase_					,						UpperCAmelCase_						=				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_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


SCREAMING_SNAKE_CASE     				=						{"configuration_xlnet": ["XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLNetConfig"]}

try:
			if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE     				=						["XLNetTokenizer"]

try:
			if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE     				=						["XLNetTokenizerFast"]

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE     				=						[
			    "XLNET_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "XLNetForMultipleChoice",
			    "XLNetForQuestionAnswering",
			    "XLNetForQuestionAnsweringSimple",
			    "XLNetForSequenceClassification",
			    "XLNetForTokenClassification",
			    "XLNetLMHeadModel",
			    "XLNetModel",
			    "XLNetPreTrainedModel",
			    "load_tf_weights_in_xlnet",
			]

try:
			if not is_tf_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE     				=						[
			    "TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "TFXLNetForMultipleChoice",
			    "TFXLNetForQuestionAnsweringSimple",
			    "TFXLNetForSequenceClassification",
			    "TFXLNetForTokenClassification",
			    "TFXLNetLMHeadModel",
			    "TFXLNetMainLayer",
			    "TFXLNetModel",
			    "TFXLNetPreTrainedModel",
			]


if TYPE_CHECKING:
			from .configuration_xlnet import XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLNetConfig

			try:
						if not is_sentencepiece_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_xlnet import XLNetTokenizer

			try:
						if not is_tokenizers_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_xlnet_fast import XLNetTokenizerFast

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_xlnet import (
						    XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
						    XLNetForMultipleChoice,
						    XLNetForQuestionAnswering,
						    XLNetForQuestionAnsweringSimple,
						    XLNetForSequenceClassification,
						    XLNetForTokenClassification,
						    XLNetLMHeadModel,
						    XLNetModel,
						    XLNetPreTrainedModel,
						    load_tf_weights_in_xlnet,
						)

			try:
						if not is_tf_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_xlnet import (
						    TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
						    TFXLNetForMultipleChoice,
						    TFXLNetForQuestionAnsweringSimple,
						    TFXLNetForSequenceClassification,
						    TFXLNetForTokenClassification,
						    TFXLNetLMHeadModel,
						    TFXLNetMainLayer,
						    TFXLNetModel,
						    TFXLNetPreTrainedModel,
						)

else:
			import sys

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

