






"""simple docstring"""





import functools
import operator

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


_SCREAMING_SNAKE_CASE					:				Dict					    =						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE					:				Dict					    =						{
    '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      a						(					__snake_case		):
    SCREAMING_SNAKE_CASE						:     Tuple						= """wav2vec2"""






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

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

      # ctc loss
      lowerCamelCase_         =						ctc_loss_reduction
      lowerCamelCase_         =						ctc_zero_infinity

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

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

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






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








"""simple docstring"""






def      lowerCamelCase       (     _UpperCamelCase		:      float       ,			_UpperCamelCase		:      float       ,			_UpperCamelCase		:      int							)		->       float:

							'''simple docstring'''



							if principal <= 0:
														raise Exception("""Principal borrowed must be > 0"""							)
							if rate_per_annum < 0:
														raise Exception("""Rate of interest must be >= 0"""							)
							if years_to_repay <= 0 or not isinstance(_UpperCamelCase       ,			_UpperCamelCase							):
														raise Exception("""Years to repay must be an integer > 0"""							)

							# Yearly rate is divided by 12 to get monthly rate
							__UpperCAmelCase   :						List[Any]      							=					rate_per_annum / 1_2

							# Years to repay is multiplied by 12 to get number of payments as payment is monthly
							__UpperCAmelCase   :						Optional[int]      							=					years_to_repay * 1_2

							return (
							    principal
							    * rate_per_month
							    * (1 + rate_per_month) ** number_of_payments
							    / ((1 + rate_per_month) ** number_of_payments - 1)
							)


if __name__ == "__main__":
							import doctest

							doctest.testmod()
