






'''simple docstring'''




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


lowerCAmelCase__          =						logging.get_logger(__name__)

lowerCAmelCase__          =						{
    '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					(__lowerCamelCase   ,				__lowerCamelCase    ):
	_lowerCamelCase              =  '''nat'''

	_lowerCamelCase              =  {
	    '''num_attention_heads''': '''num_heads''',
	    '''num_hidden_layers''': '''num_layers''',
	}

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

			UpperCamelCase__				:					Tuple					=					patch_size
			UpperCamelCase__				:					Tuple					=					num_channels
			UpperCamelCase__				:					List[Any]					=					embed_dim
			UpperCamelCase__				:					Dict					=					depths
			UpperCamelCase__				:					Dict					=					len(UpperCAmelCase_)
			UpperCamelCase__				:					str					=					num_heads
			UpperCamelCase__				:					List[Any]					=					kernel_size
			UpperCamelCase__				:					Union[str, Any]					=					mlp_ratio
			UpperCamelCase__				:					List[str]					=					qkv_bias
			UpperCamelCase__				:					List[Any]					=					hidden_dropout_prob
			UpperCamelCase__				:					int					=					attention_probs_dropout_prob
			UpperCamelCase__				:					str					=					drop_path_rate
			UpperCamelCase__				:					Any					=					hidden_act
			UpperCamelCase__				:					Optional[int]					=					layer_norm_eps
			UpperCamelCase__				:					Union[str, Any]					=					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__				:					Tuple					=					int(embed_dim * 2 ** (len(UpperCAmelCase_) - 1))
			UpperCamelCase__				:					List[str]					=					layer_scale_init_value
			UpperCamelCase__				:					List[str]					=					['stem'] + [F'stage{idx}' for idx in range(1  ,					len(UpperCAmelCase_) + 1)]
			UpperCamelCase__				:					Tuple					=					get_aligned_output_features_output_indices(
			    out_features=UpperCAmelCase_  ,					out_indices=UpperCAmelCase_  ,					stage_names=self.stage_names)












'''simple docstring'''




def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_)							->     list[str]:
		return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_) - ngram_size + 1)]


if __name__ == "__main__":
		from doctest import testmod

		testmod()




