





'''simple docstring'''


import functools
import operator

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


lowerCAmelCase_ : int	  =       logging.get_logger(__name__)

lowerCAmelCase_ : Optional[int]	  =       {
    "facebook/wav2vec2-base-960h": "https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json",
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}






class    UpperCamelCase__	(		__lowerCAmelCase  ):
	lowerCAmelCase__       :      Optional[Any]										=    '''wav2vec2'''







	def __init__(					self      : Union[str, Any]			,			lowerCamelCase      : Optional[Any]=3_2			,			lowerCamelCase      : Tuple=7_6_8			,			lowerCamelCase      : Any=1_2			,			lowerCamelCase      : List[str]=1_2			,			lowerCamelCase      : Optional[int]=3_0_7_2			,			lowerCamelCase      : List[str]="gelu"			,			lowerCamelCase      : str=0.1			,			lowerCamelCase      : List[Any]=0.1			,			lowerCamelCase      : int=0.1			,			lowerCamelCase      : Tuple=0.0			,			lowerCamelCase      : str=0.0			,			lowerCamelCase      : int=0.1			,			lowerCamelCase      : Optional[int]=0.1			,			lowerCamelCase      : int=0.02			,			lowerCamelCase      : List[str]=1e-5			,			lowerCamelCase      : Dict="group"			,			lowerCamelCase      : Dict="gelu"			,			lowerCamelCase      : Optional[int]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)			,			lowerCamelCase      : str=(5, 2, 2, 2, 2, 2, 2)			,			lowerCamelCase      : Dict=(1_0, 3, 3, 3, 3, 2, 2)			,			lowerCamelCase      : Tuple=False			,			lowerCamelCase      : Dict=1_2_8			,			lowerCamelCase      : Dict=1_6			,			lowerCamelCase      : str=False			,			lowerCamelCase      : int=True			,			lowerCamelCase      : List[Any]=0.05			,			lowerCamelCase      : Optional[int]=1_0			,			lowerCamelCase      : List[Any]=2			,			lowerCamelCase      : List[Any]=0.0			,			lowerCamelCase      : int=1_0			,			lowerCamelCase      : Optional[int]=0			,			lowerCamelCase      : Any=3_2_0			,			lowerCamelCase      : Optional[int]=2			,			lowerCamelCase      : List[str]=0.1			,			lowerCamelCase      : List[str]=1_0_0			,			lowerCamelCase      : Tuple=2_5_6			,			lowerCamelCase      : List[str]=2_5_6			,			lowerCamelCase      : List[Any]=0.1			,			lowerCamelCase      : Any="sum"			,			lowerCamelCase      : Tuple=False			,			lowerCamelCase      : str=False			,			lowerCamelCase      : List[str]=2_5_6			,			lowerCamelCase      : Any=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)			,			lowerCamelCase      : Optional[int]=(5, 3, 3, 1, 1)			,			lowerCamelCase      : Union[str, Any]=(1, 2, 3, 1, 1)			,			lowerCamelCase      : List[str]=5_1_2			,			lowerCamelCase      : List[str]=0			,			lowerCamelCase      : Union[str, Any]=1			,			lowerCamelCase      : Dict=2			,			lowerCamelCase      : Any=False			,			lowerCamelCase      : str=3			,			lowerCamelCase      : Tuple=2			,			lowerCamelCase      : str=3			,			lowerCamelCase      : Dict=None			,			lowerCamelCase      : List[str]=None			,			**lowerCamelCase      : Union[str, Any]			,			):




				'''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_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

				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

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

				# ctc loss
				a__	 =			ctc_loss_reduction
				a__	 =			ctc_zero_infinity

				# adapter
				a__	 =			add_adapter
				a__	 =			adapter_kernel_size
				a__	 =			adapter_stride
				a__	 =			num_adapter_layers
				a__	 =			output_hidden_size or hidden_size
				a__	 =			adapter_attn_dim

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

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







	@property
	def     __a (					self      : Optional[int]		):




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




"""simple docstring"""


from collections.abc import Callable
from math import pi, sqrt
from random import uniform
from statistics import mean





def      lowerCamelCase_					(   __lowerCAmelCase							)				->   List[Any]:




						'''simple docstring'''



						def is_in_circle(__lowerCAmelCase  ,       __lowerCAmelCase							) -> bool:
												lowerCamelCase__   =sqrt((x**2) + (y**2)							)
												# Our circle has a radius of 1, so a distance
												# greater than 1 would land outside the circle.
												return distance_from_centre <= 1

						# The proportion of guesses that landed in the circle
						lowerCamelCase__   =mean(
						    int(is_in_circle(uniform(-1.0  ,       1.0							)  ,       uniform(-1.0  ,       1.0							)							)							)
						    for _ in range(__lowerCAmelCase							)							)
						# The ratio of the area for circle to square is pi/4.
						lowerCamelCase__   =proportion * 4
						print(F'''The estimated value of pi is {pi_estimate}'''							)
						print(F'''The numpy value of pi is {pi}'''							)
						print(F'''The total error is {abs(pi - pi_estimate							)}'''							)





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase  ,       __lowerCAmelCase = 0.0  ,       __lowerCAmelCase = 1.0  ,       )				->   float:




						'''simple docstring'''



						return mean(
						    function_to_integrate(uniform(__lowerCAmelCase  ,       __lowerCAmelCase							)							) for _ in range(__lowerCAmelCase							)							) * (max_value - min_value)





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase = 0.0  ,       __lowerCAmelCase = 1.0							)				->   None:




						'''simple docstring'''



						def identity_function(__lowerCAmelCase							) -> float:
												return x

						lowerCamelCase__   =area_under_curve_estimator(
						    __lowerCAmelCase  ,       __lowerCAmelCase  ,       __lowerCAmelCase  ,       __lowerCAmelCase							)
						lowerCamelCase__   =(max_value * max_value - min_value * min_value) / 2

						print("******************"							)
						print(F'''Estimating area under y=x where x varies from {min_value} to {max_value}'''							)
						print(F'''Estimated value is {estimated_value}'''							)
						print(F'''Expected value is {expected_value}'''							)
						print(F'''Total error is {abs(estimated_value - expected_value							)}'''							)
						print("******************"							)





def      lowerCamelCase_					(   __lowerCAmelCase							)				->   None:




						'''simple docstring'''



						def function_to_integrate(__lowerCAmelCase							) -> float:
												return sqrt(4.0 - x * x							)

						lowerCamelCase__   =area_under_curve_estimator(
						    __lowerCAmelCase  ,       __lowerCAmelCase  ,       0.0  ,       2.0							)

						print("******************"							)
						print("Estimating pi using area_under_curve_estimator"							)
						print(F'''Estimated value is {estimated_value}'''							)
						print(F'''Expected value is {pi}'''							)
						print(F'''Total error is {abs(estimated_value - pi							)}'''							)
						print("******************"							)


if __name__ == "__main__":
	import doctest

	doctest.testmod()


