




import functools
import operator

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


a													=			logging.get_logger(__name__)

a													=			{
    "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       _A				(		__lowercase     ):
		__a					    =       """unispeech-sat"""






		def __init__(    self						,		_SCREAMING_SNAKE_CASE=32						,		_SCREAMING_SNAKE_CASE=768						,		_SCREAMING_SNAKE_CASE=12						,		_SCREAMING_SNAKE_CASE=12						,		_SCREAMING_SNAKE_CASE=3072						,		_SCREAMING_SNAKE_CASE="gelu"						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=0.0						,		_SCREAMING_SNAKE_CASE=0.0						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=0.02						,		_SCREAMING_SNAKE_CASE=1e-5						,		_SCREAMING_SNAKE_CASE="group"						,		_SCREAMING_SNAKE_CASE="gelu"						,		_SCREAMING_SNAKE_CASE=(512, 512, 512, 512, 512, 512, 512)						,		_SCREAMING_SNAKE_CASE=(5, 2, 2, 2, 2, 2, 2)						,		_SCREAMING_SNAKE_CASE=(10, 3, 3, 3, 3, 2, 2)						,		_SCREAMING_SNAKE_CASE=False						,		_SCREAMING_SNAKE_CASE=128						,		_SCREAMING_SNAKE_CASE=16						,		_SCREAMING_SNAKE_CASE=False						,		_SCREAMING_SNAKE_CASE=True						,		_SCREAMING_SNAKE_CASE=0.05						,		_SCREAMING_SNAKE_CASE=10						,		_SCREAMING_SNAKE_CASE=2						,		_SCREAMING_SNAKE_CASE=0.0						,		_SCREAMING_SNAKE_CASE=10						,		_SCREAMING_SNAKE_CASE=0						,		_SCREAMING_SNAKE_CASE=320						,		_SCREAMING_SNAKE_CASE=2						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=100						,		_SCREAMING_SNAKE_CASE=256						,		_SCREAMING_SNAKE_CASE=256						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE="mean"						,		_SCREAMING_SNAKE_CASE=False						,		_SCREAMING_SNAKE_CASE=False						,		_SCREAMING_SNAKE_CASE=256						,		_SCREAMING_SNAKE_CASE=(512, 512, 512, 512, 1500)						,		_SCREAMING_SNAKE_CASE=(5, 3, 3, 1, 1)						,		_SCREAMING_SNAKE_CASE=(1, 2, 3, 1, 1)						,		_SCREAMING_SNAKE_CASE=512						,		_SCREAMING_SNAKE_CASE=0						,		_SCREAMING_SNAKE_CASE=1						,		_SCREAMING_SNAKE_CASE=2						,		_SCREAMING_SNAKE_CASE=504						,		**_SCREAMING_SNAKE_CASE						,		):
								super().__init__(**_SCREAMING_SNAKE_CASE						,		pad_token_id=_SCREAMING_SNAKE_CASE						,		bos_token_id=_SCREAMING_SNAKE_CASE						,		eos_token_id=_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			hidden_size
								_UpperCAmelCase      =			feat_extract_norm
								_UpperCAmelCase      =			feat_extract_activation
								_UpperCAmelCase      =			list(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			list(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			list(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			conv_bias
								_UpperCAmelCase      =			num_conv_pos_embeddings
								_UpperCAmelCase      =			num_conv_pos_embedding_groups
								_UpperCAmelCase      =			len(self.conv_dim			)
								_UpperCAmelCase      =			num_hidden_layers
								_UpperCAmelCase      =			intermediate_size
								_UpperCAmelCase      =			hidden_act
								_UpperCAmelCase      =			num_attention_heads
								_UpperCAmelCase      =			hidden_dropout
								_UpperCAmelCase      =			attention_dropout
								_UpperCAmelCase      =			activation_dropout
								_UpperCAmelCase      =			feat_proj_dropout
								_UpperCAmelCase      =			final_dropout
								_UpperCAmelCase      =			layerdrop
								_UpperCAmelCase      =			layer_norm_eps
								_UpperCAmelCase      =			initializer_range
								_UpperCAmelCase      =			vocab_size
								_UpperCAmelCase      =			num_clusters
								_UpperCAmelCase      =			do_stable_layer_norm
								_UpperCAmelCase      =			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      =			apply_spec_augment
								_UpperCAmelCase      =			mask_time_prob
								_UpperCAmelCase      =			mask_time_length
								_UpperCAmelCase      =			mask_time_min_masks
								_UpperCAmelCase      =			mask_feature_prob
								_UpperCAmelCase      =			mask_feature_length
								_UpperCAmelCase      =			mask_feature_min_masks

								# parameters for pretraining with codevector quantized representations
								_UpperCAmelCase      =			num_codevectors_per_group
								_UpperCAmelCase      =			num_codevector_groups
								_UpperCAmelCase      =			contrastive_logits_temperature
								_UpperCAmelCase      =			feat_quantizer_dropout
								_UpperCAmelCase      =			num_negatives
								_UpperCAmelCase      =			codevector_dim
								_UpperCAmelCase      =			proj_codevector_dim
								_UpperCAmelCase      =			diversity_loss_weight

								# ctc loss
								_UpperCAmelCase      =			ctc_loss_reduction
								_UpperCAmelCase      =			ctc_zero_infinity

								# SequenceClassification-specific parameter. Feel free to ignore for other classes.
								_UpperCAmelCase      =			classifier_proj_size

								# XVector-specific parameters. Feel free to ignore for other classes.
								_UpperCAmelCase      =			list(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			list(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			list(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			xvector_output_dim






		@property
		def 				UpperCAmelCase (    self			):
								return functools.reduce(operator.mul						,		self.conv_stride						,		1			)





import math




def        _SCREAMING_SNAKE_CASE      (		snake_case			,     snake_case       )						->				float:
						if (
						    not isinstance(snake_case			,     (int, float)       )
						    or power_factor < -1
						    or power_factor > 1
						):
												raise ValueError("""power_factor must be a valid float value between -1 and 1."""       )
						return apparent_power * power_factor




def        _SCREAMING_SNAKE_CASE      (		snake_case			,     snake_case       )						->				float:
						if (
						    not isinstance(snake_case			,     (int, float)       )
						    or power_factor < -1
						    or power_factor > 1
						):
												raise ValueError("""power_factor must be a valid float value between -1 and 1."""       )
						return apparent_power * math.sqrt(1 - power_factor**2       )


if __name__ == "__main__":
				import doctest

				doctest.testmod()