






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


__UpperCamelCase       :		str							=    logging.get_logger(__name__)

__UpperCamelCase       :		Union[str, Any]							=    {
    """google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/config.json""",
}


class 	__SCREAMING_SNAKE_CASE(						__lowerCamelCase						):
							_UpperCAmelCase			     =							'switch_transformers'
							_UpperCAmelCase			     =							['past_key_values']
							_UpperCAmelCase			     =							{'hidden_size': 'd_model', 'num_attention_heads': 'num_heads', 'num_hidden_layers': 'num_layers'}
							def __init__(  self:   Union[str, Any]							,						UpperCamelCase:   Union[str, Any]=3_21_28							,						UpperCamelCase:   Dict=7_68							,						UpperCamelCase:   Any=64							,						UpperCamelCase:   Optional[Any]=20_48							,						UpperCamelCase:   List[Any]=64							,						UpperCamelCase:   Optional[Any]=12							,						UpperCamelCase:   List[Any]=3							,						UpperCamelCase:   Any=12							,						UpperCamelCase:   Optional[int]=3							,						UpperCamelCase:   List[str]=12							,						UpperCamelCase:   Optional[Any]=8							,						UpperCamelCase:   Dict=False							,						UpperCamelCase:   str=0.01							,						UpperCamelCase:   List[Any]="float32"							,						UpperCamelCase:   Union[str, Any]=False							,						UpperCamelCase:   Any=32							,						UpperCamelCase:   int=1_28							,						UpperCamelCase:   Tuple=0.1							,						UpperCamelCase:   List[str]=1e-6							,						UpperCamelCase:   Union[str, Any]=0.001							,						UpperCamelCase:   Dict=0.001							,						UpperCamelCase:   Optional[Any]=1.0							,						UpperCamelCase:   Optional[Any]="relu"							,						UpperCamelCase:   Union[str, Any]=True							,						UpperCamelCase:   str=False							,						UpperCamelCase:   Optional[Any]=True							,						UpperCamelCase:   Any=0							,						UpperCamelCase:   Union[str, Any]=1							,						**UpperCamelCase:   Optional[Any]							,						)		->		List[str]:
											snake_case__						=  vocab_size
											snake_case__						=  d_model
											snake_case__						=  d_kv
											snake_case__						=  d_ff

											snake_case__						=  num_sparse_encoder_layers

											snake_case__						=  num_layers
											snake_case__						=  (
											    num_decoder_layers if num_decoder_layers is not None else self.num_layers
											)  # default = symmetry
											snake_case__						=  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:
															snake_case__						=  self.num_layers // self.num_sparse_encoder_layers
											else:
															snake_case__						=  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:
															snake_case__						=  self.num_decoder_layers // self.num_sparse_decoder_layers
											else:
															snake_case__						=  self.num_decoder_layers  # HACK: this will create 0 sparse layers

											snake_case__						=  num_heads
											snake_case__						=  num_experts
											snake_case__						=  expert_capacity
											snake_case__						=  router_bias
											snake_case__						=  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}'''    )
											snake_case__						=  router_dtype

											snake_case__						=  router_ignore_padding_tokens
											snake_case__						=  relative_attention_num_buckets
											snake_case__						=  relative_attention_max_distance

											snake_case__						=  dropout_rate
											snake_case__						=  layer_norm_epsilon
											snake_case__						=  initializer_factor
											snake_case__						=  feed_forward_proj
											snake_case__						=  use_cache
											snake_case__						=  add_router_probs

											snake_case__						=  router_z_loss_coef
											snake_case__						=  router_aux_loss_coef

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

											if len(UpperCamelCase    ) > 1 and act_info[0] != "gated" or len(UpperCamelCase    ) > 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":
															snake_case__						=  'gelu_new'

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






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


__lowerCAmelCase					   =       logging.get_logger(__name__)

__lowerCAmelCase					   =       {
    'microsoft/biogpt': 'https://huggingface.co/microsoft/biogpt/resolve/main/config.json',
    # See all BioGPT models at https://huggingface.co/models?filter=biogpt
}





class     lowerCamelCase      (       __lowerCamelCase					):
	UpperCamelCase_  :					Union[str, Any]    		=	'biogpt'







	def __init__(     self      :Tuple   ,     lowercase      :Union[str, Any]=4_2_3_8_4   ,     lowercase      :str=1_0_2_4   ,     lowercase      :Any=2_4   ,     lowercase      :List[str]=1_6   ,     lowercase      :List[str]=4_0_9_6   ,     lowercase      :int="gelu"   ,     lowercase      :List[Any]=0.1   ,     lowercase      :int=0.1   ,     lowercase      :int=1_0_2_4   ,     lowercase      :Optional[Any]=0.02   ,     lowercase      :Union[str, Any]=1e-12   ,     lowercase      :Tuple=True   ,     lowercase      :int=True   ,     lowercase      :Optional[int]=0.0   ,     lowercase      :Any=0.0   ,     lowercase      :str=1   ,     lowercase      :Any=0   ,     lowercase      :int=2   ,     **lowercase      :Tuple   ,     )		->      Optional[int]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= vocab_size
				SCREAMING_SNAKE_CASE     						= max_position_embeddings
				SCREAMING_SNAKE_CASE     						= hidden_size
				SCREAMING_SNAKE_CASE     						= num_hidden_layers
				SCREAMING_SNAKE_CASE     						= num_attention_heads
				SCREAMING_SNAKE_CASE     						= intermediate_size
				SCREAMING_SNAKE_CASE     						= hidden_act
				SCREAMING_SNAKE_CASE     						= hidden_dropout_prob
				SCREAMING_SNAKE_CASE     						= attention_probs_dropout_prob
				SCREAMING_SNAKE_CASE     						= initializer_range
				SCREAMING_SNAKE_CASE     						= layer_norm_eps
				SCREAMING_SNAKE_CASE     						= scale_embedding
				SCREAMING_SNAKE_CASE     						= use_cache
				SCREAMING_SNAKE_CASE     						= layerdrop
				SCREAMING_SNAKE_CASE     						= activation_dropout
				super().__init__(pad_token_id=lowercase   ,     bos_token_id=lowercase   ,     eos_token_id=lowercase   ,     **lowercase			)