



"""simple docstring"""


import functools
import operator

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


snake_case_         = logging.get_logger(__name__)

snake_case_         = {
    '''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    A_    (  UpperCamelCase_       ):



						"""simple docstring"""
						__UpperCamelCase	       =							"""hubert"""






						def __init__(      self				:List[Any]     ,						lowercase_				:int=32     ,						lowercase_				:Union[str, Any]=7_68     ,						lowercase_				:List[Any]=12     ,						lowercase_				:List[str]=12     ,						lowercase_				:Any=30_72     ,						lowercase_				:Union[str, Any]="gelu"     ,						lowercase_				:Optional[int]=0.1     ,						lowercase_				:Dict=0.1     ,						lowercase_				:Tuple=0.1     ,						lowercase_				:Dict=True     ,						lowercase_				:Any=0.0     ,						lowercase_				:Any=0.1     ,						lowercase_				:Any=0.1     ,						lowercase_				:Dict=0.02     ,						lowercase_				:Optional[int]=1E-5     ,						lowercase_				:Optional[int]="group"     ,						lowercase_				:Optional[Any]="gelu"     ,						lowercase_				:List[str]=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)     ,						lowercase_				:Optional[int]=(5, 2, 2, 2, 2, 2, 2)     ,						lowercase_				:int=(10, 3, 3, 3, 3, 2, 2)     ,						lowercase_				:Dict=False     ,						lowercase_				:str=1_28     ,						lowercase_				:Union[str, Any]=16     ,						lowercase_				:Union[str, Any]=False     ,						lowercase_				:Dict=True     ,						lowercase_				:int=0.05     ,						lowercase_				:Tuple=10     ,						lowercase_				:List[str]=2     ,						lowercase_				:Optional[Any]=0.0     ,						lowercase_				:Any=10     ,						lowercase_				:Any=0     ,						lowercase_				:Tuple="sum"     ,						lowercase_				:Dict=False     ,						lowercase_				:str=False     ,						lowercase_				:Dict=2_56     ,						lowercase_				:str=0     ,						lowercase_				:Optional[Any]=1     ,						lowercase_				:str=2     ,						**lowercase_				:str     ,						)       ->    str:
												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_layer_norm
												UpperCAmelCase    =				feat_proj_dropout
												UpperCAmelCase    =				final_dropout
												UpperCAmelCase    =				layerdrop
												UpperCAmelCase    =				layer_norm_eps
												UpperCAmelCase    =				initializer_range
												UpperCAmelCase    =				vocab_size
												UpperCAmelCase    =				do_stable_layer_norm
												UpperCAmelCase    =				use_weighted_layer_sum
												UpperCAmelCase    =				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
												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

												# ctc loss
												UpperCAmelCase    =				ctc_loss_reduction
												UpperCAmelCase    =				ctc_zero_infinity






						@property
						def 			UpperCAmelCase__  (      self				:List[Any]      )       ->    Optional[Any]:
												return functools.reduce(operator.mul     ,						self.conv_stride     ,						1      )










"""simple docstring"""


from math import exp

def 				_lowerCAmelCase   (     lowercase_		):
						return 8 * x - 2 * exp(-x		)

def 				_lowerCAmelCase   (     lowercase_	,			lowercase_	,			lowercase_		):
						UpperCAmelCase    =				lower_bound
						UpperCAmelCase    =				upper_bound
						for _ in range(0	,			lowercase_		):
												UpperCAmelCase   ,					UpperCAmelCase    =				xa, xa - (f(lowercase_		) * (xa - xa)) / (f(lowercase_		) - f(lowercase_		))
						return xa


if __name__ == "__main__":
				print(f'''Example: {secant_method(1, 3, 2)}''')





