
from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowercase						:      Dict									= logging.get_logger(__name__)

lowercase						:      List[Any]									= {
    'distilbert-base-uncased': 'https://huggingface.co/distilbert-base-uncased/resolve/main/config.json',
    'distilbert-base-uncased-distilled-squad': (
        'https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/config.json'
    ),
    'distilbert-base-cased': 'https://huggingface.co/distilbert-base-cased/resolve/main/config.json',
    'distilbert-base-cased-distilled-squad': (
        'https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/config.json'
    ),
    'distilbert-base-german-cased': 'https://huggingface.co/distilbert-base-german-cased/resolve/main/config.json',
    'distilbert-base-multilingual-cased': (
        'https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/config.json'
    ),
    'distilbert-base-uncased-finetuned-sst-2-english': (
        'https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json'
    ),
}




class 				lowerCamelCase__							(       __lowercase):




	'''simple docstring'''




	_A			=  'distilbert'
	_A			=  {
	    'hidden_size': 'dim',
	    'num_attention_heads': 'n_heads',
	    'num_hidden_layers': 'n_layers',
	}







	def __init__(      self	:Tuple  ,     a	:Any=3_0_5_2_2  ,     a	:List[str]=5_1_2  ,     a	:Optional[Any]=False  ,     a	:int=6  ,     a	:Any=1_2  ,     a	:Optional[Any]=7_6_8  ,     a	:Optional[int]=4 * 7_6_8  ,     a	:Tuple=0.1  ,     a	:int=0.1  ,     a	:Union[str, Any]="gelu"  ,     a	:List[Any]=0.02  ,     a	:Any=0.1  ,     a	:List[str]=0.2  ,     a	:List[Any]=0  ,     **a	:List[Any]  ,     )	->				Tuple:
								__UpperCamelCase			:     Any         =      vocab_size
								__UpperCamelCase			:     List[str]         =      max_position_embeddings
								__UpperCamelCase			:     Tuple         =      sinusoidal_pos_embds
								__UpperCamelCase			:     Union[str, Any]         =      n_layers
								__UpperCamelCase			:     Tuple         =      n_heads
								__UpperCamelCase			:     int         =      dim
								__UpperCamelCase			:     Union[str, Any]         =      hidden_dim
								__UpperCamelCase			:     List[str]         =      dropout
								__UpperCamelCase			:     Dict         =      attention_dropout
								__UpperCamelCase			:     Any         =      activation
								__UpperCamelCase			:     Union[str, Any]         =      initializer_range
								__UpperCamelCase			:     Optional[Any]         =      qa_dropout
								__UpperCamelCase			:     Tuple         =      seq_classif_dropout
								super().__init__(**a  ,     pad_token_id=a		)




class 				lowerCamelCase__							(       __lowercase):




	'''simple docstring'''




	@property
	def      _lowerCamelCase       (      self	:Optional[int]		)	->				Mapping[str, Mapping[int, str]]:
								if self.task == "multiple-choice":
															__UpperCamelCase			:     Tuple         =      {0: "batch", 1: "choice", 2: "sequence"}
								else:
															__UpperCamelCase			:     Dict         =      {0: "batch", 1: "sequence"}
								return OrderedDict(
								    [
								        ("input_ids", dynamic_axis),
								        ("attention_mask", dynamic_axis),
								    ]		)

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


lowercase						:      Optional[Any]									= logging.get_logger(__name__)

lowercase						:      List[str]									= {
    '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'''




	_A			=  'nat'

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







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

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