





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


lowercase_          =		logging.get_logger(__name__)
class     SCREAMING_SNAKE_CASE       (UpperCAmelCase      ,     UpperCAmelCase				):
   _UpperCamelCase   :		List[Any]			 =	'maskformer-swin'

   _UpperCamelCase   :		int			 =	{
       'num_attention_heads': 'num_heads',
       'num_hidden_layers': 'num_layers',
   }


   def __init__(   self      :    Union[str, Any]      ,					a      :    Dict=224      ,					a      :    Dict=4      ,					a      :    Dict=3      ,					a      :    Optional[Any]=96      ,					a      :    List[str]=[2, 2, 6, 2]      ,					a      :    int=[3, 6, 12, 24]      ,					a      :    Any=7      ,					a      :    Optional[int]=4.0      ,					a      :    Union[str, Any]=True      ,					a      :    Optional[int]=0.0      ,					a      :    Tuple=0.0      ,					a      :    int=0.1      ,					a      :    Tuple="gelu"      ,					a      :    Dict=False      ,					a      :    Tuple=0.02      ,					a      :    Union[str, Any]=1E-5      ,					a      :    Dict=None      ,					a      :    int=None      ,					**a      :    Optional[int]      ,					)->       List[Any]:





     """simple docstring"""







     super().__init__(**a	)

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









import warnings

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


lowercase_          =		logging.get_logger(__name__)

lowercase_          =		{
    """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/config.json""",
    """xlnet-large-cased""": """https://huggingface.co/xlnet-large-cased/resolve/main/config.json""",
}
class     SCREAMING_SNAKE_CASE       (UpperCAmelCase				):
   _UpperCamelCase   :		str			 =	'xlnet'
   _UpperCamelCase   :		Optional[Any]			 =	['mems']
   _UpperCamelCase   :		Union[str, Any]			 =	{
       'n_token': 'vocab_size',  # Backward compatibility
       'hidden_size': 'd_model',
       'num_attention_heads': 'n_head',
       'num_hidden_layers': 'n_layer',
   }


   def __init__(   self      :    str      ,					a      :    int=32_000      ,					a      :    Any=1_024      ,					a      :    Optional[Any]=24      ,					a      :    str=16      ,					a      :    int=4_096      ,					a      :    List[str]="gelu"      ,					a      :    Any=True      ,					a      :    Dict="bi"      ,					a      :    str=0.02      ,					a      :    List[str]=1E-1_2      ,					a      :    Tuple=0.1      ,					a      :    Optional[Any]=512      ,					a      :    Tuple=None      ,					a      :    Union[str, Any]=True      ,					a      :    int=False      ,					a      :    int=False      ,					a      :    Tuple=-1      ,					a      :    Any=False      ,					a      :    Tuple="last"      ,					a      :    List[str]=True      ,					a      :    Optional[Any]="tanh"      ,					a      :    List[Any]=0.1      ,					a      :    int=5      ,					a      :    List[Any]=5      ,					a      :    Optional[int]=5      ,					a      :    Dict=1      ,					a      :    Optional[Any]=2      ,					**a      :    List[Any]      ,					)->       List[str]:





     """simple docstring"""







     lowercase__           =  vocab_size
     lowercase__           =  d_model
     lowercase__           =  n_layer
     lowercase__           =  n_head
     if d_model % n_head != 0:
       raise ValueError(f"""'d_model % n_head' ({d_model % n_head}) should be equal to 0"""	)
     if "d_head" in kwargs:
       if kwargs["d_head"] != d_model // n_head:
         raise ValueError(
             f"""`d_head` ({kwargs["d_head"]}) should be equal to `d_model // n_head` ({d_model // n_head})"""	)
     lowercase__           =  d_model // n_head
     lowercase__           =  ff_activation
     lowercase__           =  d_inner
     lowercase__           =  untie_r
     lowercase__           =  attn_type

     lowercase__           =  initializer_range
     lowercase__           =  layer_norm_eps

     lowercase__           =  dropout
     lowercase__           =  mem_len
     lowercase__           =  reuse_len
     lowercase__           =  bi_data
     lowercase__           =  clamp_len
     lowercase__           =  same_length

     lowercase__           =  summary_type
     lowercase__           =  summary_use_proj
     lowercase__           =  summary_activation
     lowercase__           =  summary_last_dropout
     lowercase__           =  start_n_top
     lowercase__           =  end_n_top

     lowercase__           =  bos_token_id
     lowercase__           =  pad_token_id
     lowercase__           =  eos_token_id

     if "use_cache" in kwargs:
       warnings.warn(
           'The `use_cache` argument is deprecated and will be removed in a future version, use `use_mems_eval`'
           ' instead.'      ,					a      ,					)
       lowercase__           =  kwargs['use_cache']

     lowercase__           =  use_mems_eval
     lowercase__           =  use_mems_train
     super().__init__(pad_token_id=a      ,					bos_token_id=a      ,					eos_token_id=a      ,					**a	)


   @property
   def 	SCREAMING_SNAKE_CASE_							(   self      :    Optional[Any]	)->       List[str]:





     """simple docstring"""







     logger.info(f"""The model {self.model_type} is one of the few models that has no sequence length limit."""	)
     return -1


   @max_position_embeddings.setter
   def 	SCREAMING_SNAKE_CASE_							(   self      :    Tuple      ,					a      :    Union[str, Any]	)->       List[Any]:





     """simple docstring"""







     raise NotImplementedError(
         f"""The model {self.model_type} is one of the few models that has no sequence length limit."""	)


