
"""simple docstring"""

from collections import OrderedDict
from typing import Mapping

from packaging import version

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


UpperCamelCase     :    Dict       =			logging.get_logger(__name__)

UpperCamelCase     :    Dict       =			{
    "microsoft/swin-tiny-patch4-window7-224": (
        "https://huggingface.co/microsoft/swin-tiny-patch4-window7-224/resolve/main/config.json"
    ),
    # See all Swin models at https://huggingface.co/models?filter=swin
}

class __lowerCAmelCase		(				__SCREAMING_SNAKE_CASE      ,  __SCREAMING_SNAKE_CASE      ):
     lowercase						       =						"swin"

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





     def __init__(     self     ,					__UpperCAmelCase=224     ,					__UpperCAmelCase=4     ,					__UpperCAmelCase=3     ,					__UpperCAmelCase=96     ,					__UpperCAmelCase=[2, 2, 6, 2]     ,					__UpperCAmelCase=[3, 6, 12, 24]     ,					__UpperCAmelCase=7     ,					__UpperCAmelCase=4.0     ,					__UpperCAmelCase=True     ,					__UpperCAmelCase=0.0     ,					__UpperCAmelCase=0.0     ,					__UpperCAmelCase=0.1     ,					__UpperCAmelCase="gelu"     ,					__UpperCAmelCase=False     ,					__UpperCAmelCase=0.0_2     ,					__UpperCAmelCase=1E-5     ,					__UpperCAmelCase=32     ,					__UpperCAmelCase=None     ,					__UpperCAmelCase=None     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      super().__init__(**__UpperCAmelCase				)

      __UpperCamelCase      =	image_size
      __UpperCamelCase      =	patch_size
      __UpperCamelCase      =	num_channels
      __UpperCamelCase      =	embed_dim
      __UpperCamelCase      =	depths
      __UpperCamelCase      =	len(__UpperCAmelCase				)
      __UpperCamelCase      =	num_heads
      __UpperCamelCase      =	window_size
      __UpperCamelCase      =	mlp_ratio
      __UpperCamelCase      =	qkv_bias
      __UpperCamelCase      =	hidden_dropout_prob
      __UpperCamelCase      =	attention_probs_dropout_prob
      __UpperCamelCase      =	drop_path_rate
      __UpperCamelCase      =	hidden_act
      __UpperCamelCase      =	use_absolute_embeddings
      __UpperCamelCase      =	layer_norm_eps
      __UpperCamelCase      =	initializer_range
      __UpperCamelCase      =	encoder_stride
      # we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
      # this indicates the channel dimension after the last stage of the model
      __UpperCamelCase      =	int(embed_dim * 2 ** (len(__UpperCAmelCase				) - 1)				)
      __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				)


class __lowerCAmelCase		(				__SCREAMING_SNAKE_CASE      ):
     lowercase						       =						version.parse("1.11"      )





     @property
     def 						UpperCAmelCase (     self				):

      '''simple docstring'''




      return OrderedDict(
          [
              ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
          ]				)







     @property
     def 						UpperCAmelCase (     self				):

      '''simple docstring'''




      return 1E-4





"""simple docstring"""

from collections import OrderedDict
from typing import Mapping

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


UpperCamelCase     :    Union[str, Any]       =			logging.get_logger(__name__)

UpperCamelCase     :    int       =			{
    "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		(				__SCREAMING_SNAKE_CASE      ):
     lowercase						       =						"distilbert"
     lowercase						       =						{
         "hidden_size": "dim",
         "num_attention_heads": "n_heads",
         "num_hidden_layers": "n_layers",
     }





     def __init__(     self     ,					__UpperCAmelCase=3_0522     ,					__UpperCAmelCase=512     ,					__UpperCAmelCase=False     ,					__UpperCAmelCase=6     ,					__UpperCAmelCase=12     ,					__UpperCAmelCase=768     ,					__UpperCAmelCase=4 * 768     ,					__UpperCAmelCase=0.1     ,					__UpperCAmelCase=0.1     ,					__UpperCAmelCase="gelu"     ,					__UpperCAmelCase=0.0_2     ,					__UpperCAmelCase=0.1     ,					__UpperCAmelCase=0.2     ,					__UpperCAmelCase=0     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      __UpperCamelCase      =	vocab_size
      __UpperCamelCase      =	max_position_embeddings
      __UpperCamelCase      =	sinusoidal_pos_embds
      __UpperCamelCase      =	n_layers
      __UpperCamelCase      =	n_heads
      __UpperCamelCase      =	dim
      __UpperCamelCase      =	hidden_dim
      __UpperCamelCase      =	dropout
      __UpperCamelCase      =	attention_dropout
      __UpperCamelCase      =	activation
      __UpperCamelCase      =	initializer_range
      __UpperCamelCase      =	qa_dropout
      __UpperCamelCase      =	seq_classif_dropout
      super().__init__(**__UpperCAmelCase     ,					pad_token_id=__UpperCAmelCase				)


class __lowerCAmelCase		(				__SCREAMING_SNAKE_CASE      ):





     @property
     def 						UpperCAmelCase (     self				):

      '''simple docstring'''




      if self.task == "multiple-choice":
       __UpperCamelCase      =	{0: 'batch', 1: 'choice', 2: 'sequence'}
      else:
       __UpperCamelCase      =	{0: 'batch', 1: 'sequence'}
      return OrderedDict(
          [
              ('input_ids', dynamic_axis),
              ('attention_mask', dynamic_axis),
          ]				)



