






"""simple docstring"""







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


__a       :	Any             = logging.get_logger(__name__)

__a       :	List[Any]             = {
    'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json',
}







class        _SCREAMING_SNAKE_CASE						(  __snake_case							):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE    ='switch_transformers'
							_SCREAMING_SNAKE_CASE    =['past_key_values']
							_SCREAMING_SNAKE_CASE    ={'hidden_size': 'd_model', 'num_attention_heads': 'num_heads', 'num_hidden_layers': 'num_layers'}




							def __init__(   self:     List[str]				,		__A:     str=32128				,		__A:     Tuple=768				,		__A:     Tuple=64				,		__A:     Union[str, Any]=2048				,		__A:     List[str]=64				,		__A:     Dict=12				,		__A:     Any=3				,		__A:     Tuple=12				,		__A:     Dict=3				,		__A:     List[Any]=12				,		__A:     Optional[int]=8				,		__A:     Optional[Any]=False				,		__A:     int=0.0_1				,		__A:     List[str]="float32"				,		__A:     Optional[int]=False				,		__A:     List[Any]=32				,		__A:     Optional[Any]=128				,		__A:     Union[str, Any]=0.1				,		__A:     Tuple=1e-6				,		__A:     List[str]=0.0_0_1				,		__A:     str=0.0_0_1				,		__A:     Any=1.0				,		__A:     List[str]="relu"				,		__A:     Optional[Any]=True				,		__A:     Optional[Any]=False				,		__A:     int=True				,		__A:     Any=0				,		__A:     Any=1				,		**__A:     List[Any]				,		):

												'''simple docstring'''

												a__          =  vocab_size
												a__          =  d_model
												a__          =  d_kv
												a__          =  d_ff

												a__          =  num_sparse_encoder_layers

												a__          =  num_layers
												a__          =  (
												    num_decoder_layers if num_decoder_layers is not None else self.num_layers
												)  # default = symmetry
												a__          =  num_sparse_decoder_layers

												# This tells us, each how many encoder layer we'll have to set a sparse layer.
												if self.num_sparse_encoder_layers > 0:
																	a__          =  self.num_layers // self.num_sparse_encoder_layers
												else:
																	a__          =  self.num_layers  # HACK: this will create 0 sparse layers

												# This tells us, each how many encoder layer we'll have to set a sparse layer.
												if self.num_sparse_decoder_layers > 0:
																	a__          =  self.num_decoder_layers // self.num_sparse_decoder_layers
												else:
																	a__          =  self.num_decoder_layers  # HACK: this will create 0 sparse layers

												a__          =  num_heads
												a__          =  num_experts
												a__          =  expert_capacity
												a__          =  router_bias
												a__          =  router_jitter_noise
												if router_dtype not in ["float32", "float16", "bfloat16"]:
																	raise ValueError(F'`router_dtype` must be one of \'float32\', \'float16\' or \'bfloat16\', got {router_dtype}'    )
												a__          =  router_dtype

												a__          =  router_ignore_padding_tokens
												a__          =  relative_attention_num_buckets
												a__          =  relative_attention_max_distance

												a__          =  dropout_rate
												a__          =  layer_norm_epsilon
												a__          =  initializer_factor
												a__          =  feed_forward_proj
												a__          =  use_cache
												a__          =  add_router_probs

												a__          =  router_z_loss_coef
												a__          =  router_aux_loss_coef

												a__          =  self.feed_forward_proj.split('''-'''    )
												a__          =  act_info[-1]
												a__          =  act_info[0] == '''gated'''

												if len(__A    ) > 1 and act_info[0] != "gated" or len(__A    ) > 2:
																	raise ValueError(
																	    F'`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer.'
																	    '''Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. '''
																	    '''\'gated-gelu\' or \'relu\''''    )

												# for backwards compatibility
												if feed_forward_proj == "gated-gelu":
																	a__          =  '''gelu_new'''

												super().__init__(
												    pad_token_id=__A				,		eos_token_id=__A				,		is_encoder_decoder=__A				,		**__A				,		)










"""simple docstring"""







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


__a       :	Any             = logging.get_logger(__name__)

__a       :	Union[str, Any]             = {
    'caidas/swin2sr-classicalsr-x2-64': (
        'https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resolve/main/config.json'
    ),
}







class        _SCREAMING_SNAKE_CASE						(  __snake_case							):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE    ='swin2sr'

							_SCREAMING_SNAKE_CASE    ={
							    'hidden_size': 'embed_dim',
							    'num_attention_heads': 'num_heads',
							    'num_hidden_layers': 'num_layers',
							}




							def __init__(   self:     Union[str, Any]				,		__A:     List[Any]=64				,		__A:     int=1				,		__A:     Dict=3				,		__A:     List[Any]=180				,		__A:     int=[6, 6, 6, 6, 6, 6]				,		__A:     Tuple=[6, 6, 6, 6, 6, 6]				,		__A:     int=8				,		__A:     Optional[int]=2.0				,		__A:     Optional[int]=True				,		__A:     int=0.0				,		__A:     Any=0.0				,		__A:     Optional[Any]=0.1				,		__A:     Optional[Any]="gelu"				,		__A:     Dict=False				,		__A:     List[Any]=0.0_2				,		__A:     List[Any]=1e-5				,		__A:     List[str]=2				,		__A:     int=1.0				,		__A:     Dict="1conv"				,		__A:     Optional[Any]="pixelshuffle"				,		**__A:     Dict				,		):

												'''simple docstring'''

												super().__init__(**__A    )

												a__          =  image_size
												a__          =  patch_size
												a__          =  num_channels
												a__          =  embed_dim
												a__          =  depths
												a__          =  len(__A    )
												a__          =  num_heads
												a__          =  window_size
												a__          =  mlp_ratio
												a__          =  qkv_bias
												a__          =  hidden_dropout_prob
												a__          =  attention_probs_dropout_prob
												a__          =  drop_path_rate
												a__          =  hidden_act
												a__          =  use_absolute_embeddings
												a__          =  layer_norm_eps
												a__          =  initializer_range
												a__          =  upscale
												a__          =  img_range
												a__          =  resi_connection
												a__          =  upsampler


