



'''simple docstring'''






import functools
import operator

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


UpperCamelCase__:   str								=			logging.get_logger(__name__)

UpperCamelCase__:   Tuple								=			{
    "microsoft/unispeech-sat-base-100h-libri-ft": (
        "https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json"
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}

class 				SCREAMING_SNAKE_CASE(							A__			):







	"""simple docstring"""






	lowerCamelCase__			 =       """unispeech-sat"""







	def __init__(						self			:     str		,			__snake_case			:     List[str]=32		,			__snake_case			:     List[str]=768		,			__snake_case			:     str=12		,			__snake_case			:     int=12		,			__snake_case			:     Union[str, Any]=3072		,			__snake_case			:     List[Any]="gelu"		,			__snake_case			:     Union[str, Any]=0.1		,			__snake_case			:     Union[str, Any]=0.1		,			__snake_case			:     Dict=0.1		,			__snake_case			:     List[Any]=0.0		,			__snake_case			:     Any=0.0		,			__snake_case			:     Any=0.1		,			__snake_case			:     List[str]=0.1		,			__snake_case			:     Optional[Any]=0.02		,			__snake_case			:     Dict=1E-5		,			__snake_case			:     int="group"		,			__snake_case			:     Any="gelu"		,			__snake_case			:     Dict=(512, 512, 512, 512, 512, 512, 512)		,			__snake_case			:     str=(5, 2, 2, 2, 2, 2, 2)		,			__snake_case			:     Tuple=(10, 3, 3, 3, 3, 2, 2)		,			__snake_case			:     Optional[int]=False		,			__snake_case			:     List[str]=128		,			__snake_case			:     Any=16		,			__snake_case			:     List[str]=False		,			__snake_case			:     List[str]=True		,			__snake_case			:     Union[str, Any]=0.05		,			__snake_case			:     Tuple=10		,			__snake_case			:     Optional[Any]=2		,			__snake_case			:     Dict=0.0		,			__snake_case			:     int=10		,			__snake_case			:     Tuple=0		,			__snake_case			:     Dict=320		,			__snake_case			:     List[Any]=2		,			__snake_case			:     int=0.1		,			__snake_case			:     str=100		,			__snake_case			:     List[Any]=256		,			__snake_case			:     str=256		,			__snake_case			:     Tuple=0.1		,			__snake_case			:     int="mean"		,			__snake_case			:     List[str]=False		,			__snake_case			:     Optional[Any]=False		,			__snake_case			:     str=256		,			__snake_case			:     Tuple=(512, 512, 512, 512, 1500)		,			__snake_case			:     Union[str, Any]=(5, 3, 3, 1, 1)		,			__snake_case			:     Dict=(1, 2, 3, 1, 1)		,			__snake_case			:     int=512		,			__snake_case			:     Dict=0		,			__snake_case			:     Optional[int]=1		,			__snake_case			:     int=2		,			__snake_case			:     List[Any]=504		,			**__snake_case			:     Dict		,			)			->		Optional[int]:
								super().__init__(**__snake_case		,			pad_token_id=__snake_case		,			bos_token_id=__snake_case		,			eos_token_id=__snake_case		)
								UpperCAmelCase :       Tuple 							=		hidden_size
								UpperCAmelCase :       Optional[Any] 							=		feat_extract_norm
								UpperCAmelCase :       int 							=		feat_extract_activation
								UpperCAmelCase :       Optional[int] 							=		list(__snake_case		)
								UpperCAmelCase :       List[str] 							=		list(__snake_case		)
								UpperCAmelCase :       List[str] 							=		list(__snake_case		)
								UpperCAmelCase :       Tuple 							=		conv_bias
								UpperCAmelCase :       Union[str, Any] 							=		num_conv_pos_embeddings
								UpperCAmelCase :       Optional[Any] 							=		num_conv_pos_embedding_groups
								UpperCAmelCase :       Tuple 							=		len(self.conv_dim		)
								UpperCAmelCase :       Optional[Any] 							=		num_hidden_layers
								UpperCAmelCase :       Optional[Any] 							=		intermediate_size
								UpperCAmelCase :       Tuple 							=		hidden_act
								UpperCAmelCase :       Union[str, Any] 							=		num_attention_heads
								UpperCAmelCase :       Dict 							=		hidden_dropout
								UpperCAmelCase :       Optional[Any] 							=		attention_dropout
								UpperCAmelCase :       Optional[int] 							=		activation_dropout
								UpperCAmelCase :       Any 							=		feat_proj_dropout
								UpperCAmelCase :       Optional[Any] 							=		final_dropout
								UpperCAmelCase :       int 							=		layerdrop
								UpperCAmelCase :       str 							=		layer_norm_eps
								UpperCAmelCase :       Dict 							=		initializer_range
								UpperCAmelCase :       Any 							=		vocab_size
								UpperCAmelCase :       str 							=		num_clusters
								UpperCAmelCase :       Tuple 							=		do_stable_layer_norm
								UpperCAmelCase :       Any 							=		use_weighted_layer_sum

								if (
								    (len(self.conv_stride		) != self.num_feat_extract_layers)
								    or (len(self.conv_kernel		) != self.num_feat_extract_layers)
								    or (len(self.conv_dim		) != self.num_feat_extract_layers)
								):
															raise ValueError(
															    '''Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =='''
															    ''' `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ='''
															    F""" {len(self.conv_dim		)}`, `len(config.conv_stride) = {len(self.conv_stride		)}`,"""
															    F""" `len(config.conv_kernel) = {len(self.conv_kernel		)}`."""		)

								# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
								UpperCAmelCase :       Dict 							=		apply_spec_augment
								UpperCAmelCase :       Optional[int] 							=		mask_time_prob
								UpperCAmelCase :       Union[str, Any] 							=		mask_time_length
								UpperCAmelCase :       Tuple 							=		mask_time_min_masks
								UpperCAmelCase :       Tuple 							=		mask_feature_prob
								UpperCAmelCase :       Optional[Any] 							=		mask_feature_length
								UpperCAmelCase :       List[str] 							=		mask_feature_min_masks

								# parameters for pretraining with codevector quantized representations
								UpperCAmelCase :       List[str] 							=		num_codevectors_per_group
								UpperCAmelCase :       List[Any] 							=		num_codevector_groups
								UpperCAmelCase :       Tuple 							=		contrastive_logits_temperature
								UpperCAmelCase :       Union[str, Any] 							=		feat_quantizer_dropout
								UpperCAmelCase :       Any 							=		num_negatives
								UpperCAmelCase :       int 							=		codevector_dim
								UpperCAmelCase :       Union[str, Any] 							=		proj_codevector_dim
								UpperCAmelCase :       Union[str, Any] 							=		diversity_loss_weight

								# ctc loss
								UpperCAmelCase :       Tuple 							=		ctc_loss_reduction
								UpperCAmelCase :       List[Any] 							=		ctc_zero_infinity

								# SequenceClassification-specific parameter. Feel free to ignore for other classes.
								UpperCAmelCase :       str 							=		classifier_proj_size

								# XVector-specific parameters. Feel free to ignore for other classes.
								UpperCAmelCase :       Tuple 							=		list(__snake_case		)
								UpperCAmelCase :       List[str] 							=		list(__snake_case		)
								UpperCAmelCase :       List[Any] 							=		list(__snake_case		)
								UpperCAmelCase :       Optional[Any] 							=		xvector_output_dim







	@property
	def      A	(						self			:     Dict		)			->		int:
								return functools.reduce(operator.mul		,			self.conv_stride		,			1		)






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


__UpperCamelCase		:       Any									=     logging.get_logger(__name__)

__UpperCamelCase		:       Optional[int]									=     {
    'facebook/nllb-moe-54B': 'https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json',
}





class 					lowercase__						(   UpperCamelCase_):
						UpperCamelCase_     =		"""nllb-moe"""
						UpperCamelCase_     =		["""past_key_values"""]
						UpperCamelCase_     =		{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}


						def __init__(       self	:				List[str]    ,		UpperCamelCase__	:				List[str]=12_8112    ,		UpperCamelCase__	:				str=1024    ,		UpperCamelCase__	:				Optional[int]=12    ,		UpperCamelCase__	:				Union[str, Any]=4096    ,		UpperCamelCase__	:				Optional[Any]=16    ,		UpperCamelCase__	:				Optional[Any]=12    ,		UpperCamelCase__	:				str=4096    ,		UpperCamelCase__	:				Dict=16    ,		UpperCamelCase__	:				Any=0.05    ,		UpperCamelCase__	:				Any=0.05    ,		UpperCamelCase__	:				Optional[Any]=True    ,		UpperCamelCase__	:				Optional[Any]=True    ,		UpperCamelCase__	:				List[Any]="relu"    ,		UpperCamelCase__	:				Union[str, Any]=1024    ,		UpperCamelCase__	:				Optional[int]=0.1    ,		UpperCamelCase__	:				Any=0.1    ,		UpperCamelCase__	:				Optional[Any]=0.0    ,		UpperCamelCase__	:				str=0.02    ,		UpperCamelCase__	:				Tuple=2    ,		UpperCamelCase__	:				List[str]=True    ,		UpperCamelCase__	:				Dict=False    ,		UpperCamelCase__	:				Any="float32"    ,		UpperCamelCase__	:				List[Any]=False    ,		UpperCamelCase__	:				Tuple=128    ,		UpperCamelCase__	:				Tuple=64    ,		UpperCamelCase__	:				List[str]=4    ,		UpperCamelCase__	:				Union[str, Any]=4    ,		UpperCamelCase__	:				Dict=0.001    ,		UpperCamelCase__	:				Optional[Any]=0.001    ,		UpperCamelCase__	:				Optional[Any]="all"    ,		UpperCamelCase__	:				Tuple=False    ,		UpperCamelCase__	:				List[Any]=False    ,		UpperCamelCase__	:				List[Any]=1.0    ,		UpperCamelCase__	:				str=0.2    ,		UpperCamelCase__	:				List[Any]=1    ,		UpperCamelCase__	:				List[Any]=0    ,		UpperCamelCase__	:				Optional[int]=2    ,		UpperCamelCase__	:				Tuple=False    ,		**UpperCamelCase__	:				Union[str, Any]    ,		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:    List[str]							=							vocab_size
												SCREAMING_SNAKE_CASE							:    Dict							=							max_position_embeddings
												SCREAMING_SNAKE_CASE							:    int							=							d_model
												SCREAMING_SNAKE_CASE							:    Any							=							encoder_ffn_dim
												SCREAMING_SNAKE_CASE							:    List[Any]							=							encoder_layers
												SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							encoder_attention_heads
												SCREAMING_SNAKE_CASE							:    List[str]							=							decoder_ffn_dim
												SCREAMING_SNAKE_CASE							:    Dict							=							decoder_layers
												SCREAMING_SNAKE_CASE							:    List[Any]							=							decoder_attention_heads
												SCREAMING_SNAKE_CASE							:    List[str]							=							dropout
												SCREAMING_SNAKE_CASE							:    Any							=							attention_dropout
												SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							activation_dropout
												SCREAMING_SNAKE_CASE							:    List[Any]							=							activation_function
												SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							init_std
												SCREAMING_SNAKE_CASE							:    int							=							encoder_layerdrop
												SCREAMING_SNAKE_CASE							:    List[Any]							=							decoder_layerdrop
												SCREAMING_SNAKE_CASE							:    Any							=							use_cache
												SCREAMING_SNAKE_CASE							:    str							=							encoder_layers
												SCREAMING_SNAKE_CASE							:    List[Any]							=							scale_embedding  # scale factor will be sqrt(d_model) if True
												SCREAMING_SNAKE_CASE							:    List[str]							=							router_z_loss_coef
												SCREAMING_SNAKE_CASE							:    List[str]							=							router_aux_loss_coef
												SCREAMING_SNAKE_CASE							:    int							=							decoder_sparse_step
												SCREAMING_SNAKE_CASE							:    Optional[int]							=							encoder_sparse_step
												SCREAMING_SNAKE_CASE							:    List[str]							=							num_experts
												SCREAMING_SNAKE_CASE							:    int							=							expert_capacity
												SCREAMING_SNAKE_CASE							:    Any							=							router_bias
												if router_dtype not in ["float32", "float16", "bfloat16"]:
																		raise ValueError(f"""`router_dtype` must be one of 'float32', 'float16' or 'bfloat16', got {router_dtype}"""						)
												SCREAMING_SNAKE_CASE							:    str							=							router_dtype

												SCREAMING_SNAKE_CASE							:    List[Any]							=							router_ignore_padding_tokens
												SCREAMING_SNAKE_CASE							:    int							=							batch_prioritized_routing
												SCREAMING_SNAKE_CASE							:    str							=							second_expert_policy
												SCREAMING_SNAKE_CASE							:    Optional[Any]							=							normalize_router_prob_before_dropping
												SCREAMING_SNAKE_CASE							:    Optional[Any]							=							moe_eval_capacity_token_fraction
												SCREAMING_SNAKE_CASE							:    Optional[int]							=							moe_token_dropout
												SCREAMING_SNAKE_CASE							:    Optional[int]							=							output_router_logits
												super().__init__(
												    pad_token_id=UpperCamelCase__    ,		bos_token_id=UpperCamelCase__    ,		eos_token_id=UpperCamelCase__    ,		is_encoder_decoder=UpperCamelCase__    ,		decoder_start_token_id=UpperCamelCase__    ,		**UpperCamelCase__    ,		)





