'''simple docstring'''




import functools
import operator

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


__UpperCAmelCase												=logging.get_logger(__name__)

__UpperCAmelCase												={
    "asapp/sew-d-tiny-100k": "https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json",
    # See all SEW-D models at https://huggingface.co/models?filter=sew-d
}




class    a__				(       UpperCAmelCase__			):
     lowerCamelCase  :					List[Any]							="sew-d"






     def __init__(			self		:		Union[str, Any]  ,    a		:		Optional[Any]=32  ,    a		:		int=7_68  ,    a		:		Optional[int]=12  ,    a		:		Any=12  ,    a		:		str=30_72  ,    a		:		Dict=2  ,    a		:		Union[str, Any]=5_12  ,    a		:		List[Any]=2_56  ,    a		:		List[str]=True  ,    a		:		Optional[Any]=True  ,    a		:		List[str]=("p2c", "c2p")  ,    a		:		Tuple="layer_norm"  ,    a		:		List[str]="gelu_python"  ,    a		:		List[str]=0.1  ,    a		:		int=0.1  ,    a		:		Union[str, Any]=0.1  ,    a		:		int=0.0  ,    a		:		Tuple=0.1  ,    a		:		Any=0.02  ,    a		:		Optional[Any]=1e-7  ,    a		:		List[Any]=1e-5  ,    a		:		Tuple="group"  ,    a		:		int="gelu"  ,    a		:		Tuple=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)  ,    a		:		Union[str, Any]=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)  ,    a		:		List[Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)  ,    a		:		Tuple=False  ,    a		:		Union[str, Any]=1_28  ,    a		:		str=16  ,    a		:		str=True  ,    a		:		Any=0.05  ,    a		:		List[Any]=10  ,    a		:		Optional[Any]=2  ,    a		:		Union[str, Any]=0.0  ,    a		:		Optional[int]=10  ,    a		:		Dict=0  ,    a		:		Union[str, Any]="mean"  ,    a		:		List[str]=False  ,    a		:		Optional[int]=False  ,    a		:		int=2_56  ,    a		:		Tuple=0  ,    a		:		Dict=1  ,    a		:		Any=2  ,    **a		:		Tuple  ,    ):





         """simple docstring"""



         super().__init__(**a  ,    pad_token_id=a  ,    bos_token_id=a  ,    eos_token_id=a   )
         __lowerCamelCase          =  hidden_size
         __lowerCamelCase          =  feat_extract_norm
         __lowerCamelCase          =  feat_extract_activation
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  list(a   )
         __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          =  squeeze_factor
         __lowerCamelCase          =  max_position_embeddings
         __lowerCamelCase          =  position_buckets
         __lowerCamelCase          =  share_att_key
         __lowerCamelCase          =  relative_attention
         __lowerCamelCase          =  norm_rel_ebd
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  hidden_act
         __lowerCamelCase          =  num_attention_heads
         __lowerCamelCase          =  hidden_dropout
         __lowerCamelCase          =  attention_dropout
         __lowerCamelCase          =  activation_dropout
         __lowerCamelCase          =  feat_proj_dropout
         __lowerCamelCase          =  final_dropout
         __lowerCamelCase          =  layer_norm_eps
         __lowerCamelCase          =  feature_layer_norm_eps
         __lowerCamelCase          =  initializer_range
         __lowerCamelCase          =  vocab_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)`,'''
                 f"""but is `len(config.conv_dim) = {len(self.conv_dim   )}`, `len(config.conv_stride)"""
                 f"""= {len(self.conv_stride   )}`, `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

         # ctc loss
         __lowerCamelCase          =  ctc_loss_reduction
         __lowerCamelCase          =  ctc_zero_infinity

         # sequence classification
         __lowerCamelCase          =  use_weighted_layer_sum
         __lowerCamelCase          =  classifier_proj_size






     @property
     def        SCREAMING_SNAKE_CASE__       (			self		:		Dict   ):





         """simple docstring"""



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

'''simple docstring'''




def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    )     ->   float:
    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
    __lowerCamelCase          =  rate_per_annum / 12

    # Years to repay is multiplied by 12 to get number of payments as payment is monthly
    __lowerCamelCase          =  years_to_repay * 12

    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()
