





import functools
import operator

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


SCREAMING_SNAKE_CASE_		     = logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_		     = {
    """microsoft/unispeech-sat-base-100h-libri-ft""": (
        """https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json"""
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}

class 	UpperCamelCase__				(   lowerCAmelCase_     ):



     '''simple docstring'''

     __snake_case					:			Union[str, Any]				=    "unispeech-sat"






     def __init__(							self		:					Tuple		,lowerCamelCase__		:					Dict=32		,lowerCamelCase__		:					Any=768		,lowerCamelCase__		:					Dict=12		,lowerCamelCase__		:					Union[str, Any]=12		,lowerCamelCase__		:					str=3072		,lowerCamelCase__		:					Optional[Any]="gelu"		,lowerCamelCase__		:					Optional[int]=0.1		,lowerCamelCase__		:					Optional[Any]=0.1		,lowerCamelCase__		:					Dict=0.1		,lowerCamelCase__		:					Optional[int]=0.0		,lowerCamelCase__		:					Dict=0.0		,lowerCamelCase__		:					Tuple=0.1		,lowerCamelCase__		:					List[str]=0.1		,lowerCamelCase__		:					List[Any]=0.02		,lowerCamelCase__		:					str=1e-5		,lowerCamelCase__		:					List[Any]="group"		,lowerCamelCase__		:					int="gelu"		,lowerCamelCase__		:					Optional[int]=(512, 512, 512, 512, 512, 512, 512)		,lowerCamelCase__		:					Any=(5, 2, 2, 2, 2, 2, 2)		,lowerCamelCase__		:					int=(10, 3, 3, 3, 3, 2, 2)		,lowerCamelCase__		:					Tuple=False		,lowerCamelCase__		:					Optional[Any]=128		,lowerCamelCase__		:					Dict=16		,lowerCamelCase__		:					Optional[int]=False		,lowerCamelCase__		:					List[Any]=True		,lowerCamelCase__		:					Any=0.05		,lowerCamelCase__		:					Any=10		,lowerCamelCase__		:					Any=2		,lowerCamelCase__		:					List[str]=0.0		,lowerCamelCase__		:					str=10		,lowerCamelCase__		:					List[Any]=0		,lowerCamelCase__		:					Optional[Any]=320		,lowerCamelCase__		:					List[Any]=2		,lowerCamelCase__		:					List[str]=0.1		,lowerCamelCase__		:					Optional[Any]=100		,lowerCamelCase__		:					Dict=256		,lowerCamelCase__		:					List[Any]=256		,lowerCamelCase__		:					Any=0.1		,lowerCamelCase__		:					Union[str, Any]="mean"		,lowerCamelCase__		:					Dict=False		,lowerCamelCase__		:					Optional[Any]=False		,lowerCamelCase__		:					Optional[Any]=256		,lowerCamelCase__		:					List[str]=(512, 512, 512, 512, 1500)		,lowerCamelCase__		:					Union[str, Any]=(5, 3, 3, 1, 1)		,lowerCamelCase__		:					Union[str, Any]=(1, 2, 3, 1, 1)		,lowerCamelCase__		:					int=512		,lowerCamelCase__		:					Union[str, Any]=0		,lowerCamelCase__		:					Optional[Any]=1		,lowerCamelCase__		:					Dict=2		,lowerCamelCase__		:					int=504		,**lowerCamelCase__		:					List[str]		,)  ->	int:




           '''simple docstring'''


           super().__init__(**lowerCamelCase__		,pad_token_id=lowerCamelCase__		,bos_token_id=lowerCamelCase__		,eos_token_id=lowerCamelCase__ )
           SCREAMING_SNAKE_CASE	=		hidden_size
           SCREAMING_SNAKE_CASE	=		feat_extract_norm
           SCREAMING_SNAKE_CASE	=		feat_extract_activation
           SCREAMING_SNAKE_CASE	=		list(lowerCamelCase__ )
           SCREAMING_SNAKE_CASE	=		list(lowerCamelCase__ )
           SCREAMING_SNAKE_CASE	=		list(lowerCamelCase__ )
           SCREAMING_SNAKE_CASE	=		conv_bias
           SCREAMING_SNAKE_CASE	=		num_conv_pos_embeddings
           SCREAMING_SNAKE_CASE	=		num_conv_pos_embedding_groups
           SCREAMING_SNAKE_CASE	=		len(self.conv_dim )
           SCREAMING_SNAKE_CASE	=		num_hidden_layers
           SCREAMING_SNAKE_CASE	=		intermediate_size
           SCREAMING_SNAKE_CASE	=		hidden_act
           SCREAMING_SNAKE_CASE	=		num_attention_heads
           SCREAMING_SNAKE_CASE	=		hidden_dropout
           SCREAMING_SNAKE_CASE	=		attention_dropout
           SCREAMING_SNAKE_CASE	=		activation_dropout
           SCREAMING_SNAKE_CASE	=		feat_proj_dropout
           SCREAMING_SNAKE_CASE	=		final_dropout
           SCREAMING_SNAKE_CASE	=		layerdrop
           SCREAMING_SNAKE_CASE	=		layer_norm_eps
           SCREAMING_SNAKE_CASE	=		initializer_range
           SCREAMING_SNAKE_CASE	=		vocab_size
           SCREAMING_SNAKE_CASE	=		num_clusters
           SCREAMING_SNAKE_CASE	=		do_stable_layer_norm
           SCREAMING_SNAKE_CASE	=		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
           SCREAMING_SNAKE_CASE	=		apply_spec_augment
           SCREAMING_SNAKE_CASE	=		mask_time_prob
           SCREAMING_SNAKE_CASE	=		mask_time_length
           SCREAMING_SNAKE_CASE	=		mask_time_min_masks
           SCREAMING_SNAKE_CASE	=		mask_feature_prob
           SCREAMING_SNAKE_CASE	=		mask_feature_length
           SCREAMING_SNAKE_CASE	=		mask_feature_min_masks

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

           # ctc loss
           SCREAMING_SNAKE_CASE	=		ctc_loss_reduction
           SCREAMING_SNAKE_CASE	=		ctc_zero_infinity

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

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






     @property
     def        SCREAMING_SNAKE_CASE__						(							self		:					Any )  ->	Union[str, Any]:




           '''simple docstring'''


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









def      __lowercase     (   _SCREAMING_SNAKE_CASE				,		_SCREAMING_SNAKE_CASE			)				->     float:


      '''simple docstring'''


      _validate_point(_SCREAMING_SNAKE_CASE			)
      _validate_point(_SCREAMING_SNAKE_CASE			)
      if len(_SCREAMING_SNAKE_CASE			) != len(_SCREAMING_SNAKE_CASE			):
            raise ValueError("""Both points must be in the same n-dimensional space"""			)

      return float(sum(abs(a - b			) for a, b in zip(_SCREAMING_SNAKE_CASE				,		_SCREAMING_SNAKE_CASE			)			)			)



def      __lowercase     (   _SCREAMING_SNAKE_CASE			)				->     None:


      '''simple docstring'''


      if point:
            if isinstance(_SCREAMING_SNAKE_CASE				,		_SCREAMING_SNAKE_CASE			):
                  for item in point:
                        if not isinstance(_SCREAMING_SNAKE_CASE				,		(int, float)			):
                              SCREAMING_SNAKE_CASE	=		(
                                  """Expected a list of numbers as input, found """
                                  F"""{type(_SCREAMING_SNAKE_CASE			).__name__}"""
                              )
                              raise TypeError(_SCREAMING_SNAKE_CASE			)
            else:
                  SCREAMING_SNAKE_CASE	=		F"""Expected a list of numbers as input, found {type(_SCREAMING_SNAKE_CASE			).__name__}"""
                  raise TypeError(_SCREAMING_SNAKE_CASE			)
      else:
            raise ValueError("""Missing an input"""			)



def      __lowercase     (   _SCREAMING_SNAKE_CASE				,		_SCREAMING_SNAKE_CASE			)				->     float:


      '''simple docstring'''


      _validate_point(_SCREAMING_SNAKE_CASE			)
      _validate_point(_SCREAMING_SNAKE_CASE			)
      if len(_SCREAMING_SNAKE_CASE			) != len(_SCREAMING_SNAKE_CASE			):
            raise ValueError("""Both points must be in the same n-dimensional space"""			)

      return float(sum(abs(x - y			) for x, y in zip(_SCREAMING_SNAKE_CASE				,		_SCREAMING_SNAKE_CASE			)			)			)


if __name__ == "__main__":
      import doctest

      doctest.testmod()


