



import functools
import operator

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


_lowercase:					Dict      =						logging.get_logger(__name__)

_lowercase:					List[Any]      =						{
    "facebook/hubert-base-ls960": "https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json",
    # See all Hubert models at https://huggingface.co/models?filter=hubert
}



class       _lowercase				(  lowerCAmelCase      ):





	"""simple docstring"""
	__A		      =				"hubert"




	def __init__(self						,			lowerCamelCase_=32						,			lowerCamelCase_=768						,			lowerCamelCase_=12						,			lowerCamelCase_=12						,			lowerCamelCase_=3072						,			lowerCamelCase_="gelu"						,			lowerCamelCase_=0.1						,			lowerCamelCase_=0.1						,			lowerCamelCase_=0.1						,			lowerCamelCase_=True						,			lowerCamelCase_=0.0						,			lowerCamelCase_=0.1						,			lowerCamelCase_=0.1						,			lowerCamelCase_=0.02						,			lowerCamelCase_=1E-5						,			lowerCamelCase_="group"						,			lowerCamelCase_="gelu"						,			lowerCamelCase_=(512, 512, 512, 512, 512, 512, 512)						,			lowerCamelCase_=(5, 2, 2, 2, 2, 2, 2)						,			lowerCamelCase_=(10, 3, 3, 3, 3, 2, 2)						,			lowerCamelCase_=False						,			lowerCamelCase_=128						,			lowerCamelCase_=16						,			lowerCamelCase_=False						,			lowerCamelCase_=True						,			lowerCamelCase_=0.05						,			lowerCamelCase_=10						,			lowerCamelCase_=2						,			lowerCamelCase_=0.0						,			lowerCamelCase_=10						,			lowerCamelCase_=0						,			lowerCamelCase_="sum"						,			lowerCamelCase_=False						,			lowerCamelCase_=False						,			lowerCamelCase_=256						,			lowerCamelCase_=0						,			lowerCamelCase_=1						,			lowerCamelCase_=2						,			**lowerCamelCase_						,			):
						"""simple docstring"""

						super().__init__(**lowerCamelCase_						,			pad_token_id=lowerCamelCase_						,			bos_token_id=lowerCamelCase_						,			eos_token_id=lowerCamelCase_						)
						a   	=  hidden_size
						a   	=  feat_extract_norm
						a   	=  feat_extract_activation
						a   	=  list(lowerCamelCase_						)
						a   	=  list(lowerCamelCase_						)
						a   	=  list(lowerCamelCase_						)
						a   	=  conv_bias
						a   	=  num_conv_pos_embeddings
						a   	=  num_conv_pos_embedding_groups
						a   	=  len(self.conv_dim						)
						a   	=  num_hidden_layers
						a   	=  intermediate_size
						a   	=  hidden_act
						a   	=  num_attention_heads
						a   	=  hidden_dropout
						a   	=  attention_dropout
						a   	=  activation_dropout
						a   	=  feat_proj_layer_norm
						a   	=  feat_proj_dropout
						a   	=  final_dropout
						a   	=  layerdrop
						a   	=  layer_norm_eps
						a   	=  initializer_range
						a   	=  vocab_size
						a   	=  do_stable_layer_norm
						a   	=  use_weighted_layer_sum
						a   	=  classifier_proj_size

						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
						a   	=  apply_spec_augment
						a   	=  mask_time_prob
						a   	=  mask_time_length
						a   	=  mask_time_min_masks
						a   	=  mask_feature_prob
						a   	=  mask_feature_length
						a   	=  mask_feature_min_masks

						# ctc loss
						a   	=  ctc_loss_reduction
						a   	=  ctc_zero_infinity




	@property
	def 	UpperCamelCase_			(self						):
						"""simple docstring"""

						return functools.reduce(operator.mul						,			self.conv_stride						,			1						)





def        a( A			:       int					,	A			:       int					,	A			:       int			)						->			float:
					"""simple docstring"""





					if common_ratio == 1:
										# Formula for sum if common ratio is 1
										return num_of_terms * first_term

					# Formula for finding sum of n terms of a GeometricProgression
					return (first_term / (1 - common_ratio)) * (1 - common_ratio**num_of_terms)
