



'''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


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

lowerCAmelCase:   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 				a__(   lowerCamelCase__						,					lowerCamelCase__      ):
    lowercase__					=       """swin"""

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







    def __init__( self					:    Optional[int]		,     __snake_case					:    Optional[int]=2_24		,     __snake_case					:    int=4		,     __snake_case					:    Union[str, Any]=3		,     __snake_case					:    Union[str, Any]=96		,     __snake_case					:    Any=[2, 2, 6, 2]		,     __snake_case					:    Optional[int]=[3, 6, 12, 24]		,     __snake_case					:    str=7		,     __snake_case					:    List[str]=4.0		,     __snake_case					:    Optional[int]=True		,     __snake_case					:    Optional[Any]=0.0		,     __snake_case					:    Optional[Any]=0.0		,     __snake_case					:    Union[str, Any]=0.1		,     __snake_case					:    List[str]="gelu"		,     __snake_case					:    Optional[Any]=False		,     __snake_case					:    List[str]=0.02		,     __snake_case					:    Optional[int]=1e-5		,     __snake_case					:    List[Any]=32		,     __snake_case					:    Dict=None		,     __snake_case					:    Union[str, Any]=None		,     **__snake_case					:    Dict		,     ):
      super().__init__(**__snake_case      )

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

class 				a__(   lowerCamelCase__      ):
    lowercase__					=       version.parse("""1.11"""      )







    @property
    def      lowercase_			( self					:    List[Any]      ):
      return OrderedDict(
          [
              ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
          ]      )







    @property
    def      lowercase_			( self					:    Tuple      ):
      return 1e-4




'''simple docstring'''






from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase:   Tuple					=		logging.get_logger(__name__)

lowerCAmelCase:   Any					=		{
    'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json',
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}

class 				a__(   lowerCamelCase__      ):
    lowercase__					=       """pegasus"""
    lowercase__					=       ["""past_key_values"""]
    lowercase__					=       {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}







    def __init__( self					:    Union[str, Any]		,     __snake_case					:    Tuple=5_02_65		,     __snake_case					:    List[Any]=10_24		,     __snake_case					:    Optional[Any]=12		,     __snake_case					:    Tuple=40_96		,     __snake_case					:    str=16		,     __snake_case					:    int=12		,     __snake_case					:    Tuple=40_96		,     __snake_case					:    int=16		,     __snake_case					:    Tuple=0.0		,     __snake_case					:    Any=0.0		,     __snake_case					:    Any=True		,     __snake_case					:    Optional[int]=True		,     __snake_case					:    Any="gelu"		,     __snake_case					:    str=10_24		,     __snake_case					:    Dict=0.1		,     __snake_case					:    List[Any]=0.0		,     __snake_case					:    str=0.0		,     __snake_case					:    str=0.02		,     __snake_case					:    Union[str, Any]=0		,     __snake_case					:    List[Any]=False		,     __snake_case					:    Optional[Any]=0		,     __snake_case					:    str=1		,     __snake_case					:    Any=1		,     **__snake_case					:    int		,     ):
      a		:   Optional[int]	  =	vocab_size
      a		:   List[str]	  =	max_position_embeddings
      a		:   List[Any]	  =	d_model
      a		:   Tuple	  =	encoder_ffn_dim
      a		:   List[str]	  =	encoder_layers
      a		:   str	  =	encoder_attention_heads
      a		:   str	  =	decoder_ffn_dim
      a		:   Optional[int]	  =	decoder_layers
      a		:   Optional[int]	  =	decoder_attention_heads
      a		:   Optional[int]	  =	dropout
      a		:   Any	  =	attention_dropout
      a		:   str	  =	activation_dropout
      a		:   List[Any]	  =	activation_function
      a		:   Union[str, Any]	  =	init_std
      a		:   List[Any]	  =	encoder_layerdrop
      a		:   Union[str, Any]	  =	decoder_layerdrop
      a		:   List[Any]	  =	use_cache
      a		:   Any	  =	encoder_layers
      a		:   Optional[int]	  =	scale_embedding  # scale factor will be sqrt(d_model) if True
      super().__init__(
          pad_token_id=__snake_case		,     eos_token_id=__snake_case		,     is_encoder_decoder=__snake_case		,     decoder_start_token_id=__snake_case		,     forced_eos_token_id=__snake_case		,     **__snake_case		,     )







    @property
    def      lowercase_			( self					:    int      ):
      return self.encoder_attention_heads







    @property
    def      lowercase_			( self					:    int      ):
      return self.d_model