





"""simple docstring"""
import functools
import operator

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


__UpperCamelCase     :						Dict						       =  logging.get_logger(__name__)

__UpperCamelCase     :						Union[str, Any]						       =  {
    '''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       a							(   a__  ):
 snake_case__             =       '''unispeech-sat'''



 def __init__(     self				,       _snake_case=32				,       _snake_case=7_68				,       _snake_case=12				,       _snake_case=12				,       _snake_case=30_72				,       _snake_case="gelu"				,       _snake_case=0.1				,       _snake_case=0.1				,       _snake_case=0.1				,       _snake_case=0.0				,       _snake_case=0.0				,       _snake_case=0.1				,       _snake_case=0.1				,       _snake_case=0.02				,       _snake_case=1E-5				,       _snake_case="group"				,       _snake_case="gelu"				,       _snake_case=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)				,       _snake_case=(5, 2, 2, 2, 2, 2, 2)				,       _snake_case=(10, 3, 3, 3, 3, 2, 2)				,       _snake_case=False				,       _snake_case=1_28				,       _snake_case=16				,       _snake_case=False				,       _snake_case=True				,       _snake_case=0.05				,       _snake_case=10				,       _snake_case=2				,       _snake_case=0.0				,       _snake_case=10				,       _snake_case=0				,       _snake_case=3_20				,       _snake_case=2				,       _snake_case=0.1				,       _snake_case=1_00				,       _snake_case=2_56				,       _snake_case=2_56				,       _snake_case=0.1				,       _snake_case="mean"				,       _snake_case=False				,       _snake_case=False				,       _snake_case=2_56				,       _snake_case=(5_12, 5_12, 5_12, 5_12, 15_00)				,       _snake_case=(5, 3, 3, 1, 1)				,       _snake_case=(1, 2, 3, 1, 1)				,       _snake_case=5_12				,       _snake_case=0				,       _snake_case=1				,       _snake_case=2				,       _snake_case=5_04				,       **_snake_case				,       ):







  """simple docstring"""






  super().__init__(**_snake_case				,       pad_token_id=_snake_case				,       bos_token_id=_snake_case				,       eos_token_id=_snake_case     )
  lowerCAmelCase    				= hidden_size
  lowerCAmelCase    				= feat_extract_norm
  lowerCAmelCase    				= feat_extract_activation
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= list(_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    				= num_clusters
  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

  # 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(_snake_case     )
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= xvector_output_dim



 @property
 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






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













"""simple docstring"""
from datetime import datetime

import matplotlib.pyplot as plt
import torch


def 							A						(				__snake_case: Optional[int]  )    ->		Tuple:

       """simple docstring"""





       for param in module.parameters():
              __magic_name__      				=    False


def 							A						(				)    ->		Optional[Any]:

       """simple docstring"""





       __magic_name__      				=    'cuda' if torch.cuda.is_available() else 'cpu'
       if torch.backends.mps.is_available() and torch.backends.mps.is_built():
              __magic_name__      				=    'mps'
       if device == "mps":
              print(
                  'WARNING: MPS currently doesn\'t seem to work, and messes up backpropagation without any visible torch'
                  ' errors. I recommend using CUDA on a colab notebook or CPU instead if you\'re facing inexplicable issues'
                  ' with generations.'  )
       return device


def 							A						(				__snake_case: int  )    ->		List[Any]:

       """simple docstring"""





       __magic_name__      				=    plt.imshow(__snake_case  )
       fig.axes.get_xaxis().set_visible(__snake_case  )
       fig.axes.get_yaxis().set_visible(__snake_case  )
       plt.show()






def 							A						(				)    ->		List[Any]:

       """simple docstring"""





       __magic_name__      				=    datetime.now()
       __magic_name__      				=    current_time.strftime('%H:%M:%S'  )
       return timestamp