


"""simple docstring"""







import functools
import operator

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


lowerCamelCase_   :   Any									=  logging.get_logger(__name__)

lowerCamelCase_   :   List[str]									=  {
    """microsoft/unispeech-large-1500h-cv""": (
        """https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json"""
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}






class       __A				(       _SCREAMING_SNAKE_CASE			):






 """simple docstring"""




 __lowerCAmelCase 					=  "unispeech"


 def __init__(		self ,    __A=32 ,    __A=768 ,    __A=12 ,    __A=12 ,    __A=3072 ,    __A="gelu" ,    __A=0.1 ,    __A=0.1 ,    __A=0.1 ,    __A=0.0 ,    __A=0.0 ,    __A=0.1 ,    __A=0.1 ,    __A=0.02 ,    __A=1E-5 ,    __A="group" ,    __A="gelu" ,    __A=(512, 512, 512, 512, 512, 512, 512) ,    __A=(5, 2, 2, 2, 2, 2, 2) ,    __A=(10, 3, 3, 3, 3, 2, 2) ,    __A=False ,    __A=128 ,    __A=16 ,    __A=False ,    __A=True ,    __A=0.05 ,    __A=10 ,    __A=2 ,    __A=0.0 ,    __A=10 ,    __A=0 ,    __A=320 ,    __A=2 ,    __A=0.1 ,    __A=100 ,    __A=256 ,    __A=256 ,    __A=0.1 ,    __A="mean" ,    __A=False ,    __A=False ,    __A=256 ,    __A=80 ,    __A=0 ,    __A=1 ,    __A=2 ,    __A=0.5 ,    **__A ,    )					->     Optional[Any]:
     super().__init__(**__A ,    pad_token_id=__A ,    bos_token_id=__A ,    eos_token_id=__A						)
     a 		=hidden_size
     a 		=feat_extract_norm
     a 		=feat_extract_activation
     a 		=list(__A						)
     a 		=list(__A						)
     a 		=list(__A						)
     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 		=num_ctc_classes
     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

     # 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

     # pretraining loss
     a 		=replace_prob





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







import numpy as np







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase			) ->	np.array:
     return 1 / (1 + np.exp(-vector			))







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase			) ->	np.array:
     return vector * sigmoid(1.7_0_2 * vector			)


if __name__ == "__main__":
 import doctest

 doctest.testmod()