






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 __lowerCamelCase (      snake_case__     ,       snake_case__):





	"""simple docstring"""






	UpperCamelCase__								=      "nat"

	UpperCamelCase__								=      {
	    "num_attention_heads": "num_heads",
	    "num_hidden_layers": "num_layers",
	}

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







							super().__init__(**UpperCAmelCase    )

							_UpperCAmelCase									=			patch_size
							_UpperCAmelCase									=			num_channels
							_UpperCAmelCase									=			embed_dim
							_UpperCAmelCase									=			depths
							_UpperCAmelCase									=			len(UpperCAmelCase    )
							_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(UpperCAmelCase    ) - 1)    )
							_UpperCAmelCase									=			layer_scale_init_value
							_UpperCAmelCase									=			['stem'] + [F"""stage{idx}""" for idx in range(1       ,    len(UpperCAmelCase    ) + 1    )]
							_UpperCAmelCase					, _UpperCAmelCase									=			get_aligned_output_features_output_indices(
							    out_features=UpperCAmelCase       ,    out_indices=UpperCAmelCase       ,    stage_names=self.stage_names    )







from ...utils import is_torch_available, is_transformers_available


if is_transformers_available() and is_torch_available():
    from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline


