



import functools
import operator

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


__snake_case						:Dict      		=     logging.get_logger(__name__)

__snake_case						:Union[str, Any]      		=     {
    '''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       (	__UpperCAmelCase    ):
       UpperCamelCase__  :    Optional[int]											=						'''unispeech'''



       def __init__(		self							:     Optional[int]     ,		__SCREAMING_SNAKE_CASE							:     Optional[int]=32     ,		__SCREAMING_SNAKE_CASE							:     Union[str, Any]=768     ,		__SCREAMING_SNAKE_CASE							:     Any=12     ,		__SCREAMING_SNAKE_CASE							:     Any=12     ,		__SCREAMING_SNAKE_CASE							:     Optional[int]=3_072     ,		__SCREAMING_SNAKE_CASE							:     int="gelu"     ,		__SCREAMING_SNAKE_CASE							:     int=0.1     ,		__SCREAMING_SNAKE_CASE							:     Dict=0.1     ,		__SCREAMING_SNAKE_CASE							:     Dict=0.1     ,		__SCREAMING_SNAKE_CASE							:     List[str]=0.0     ,		__SCREAMING_SNAKE_CASE							:     Union[str, Any]=0.0     ,		__SCREAMING_SNAKE_CASE							:     Union[str, Any]=0.1     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]=0.1     ,		__SCREAMING_SNAKE_CASE							:     Optional[int]=0.02     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]=1E-5     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]="group"     ,		__SCREAMING_SNAKE_CASE							:     List[str]="gelu"     ,		__SCREAMING_SNAKE_CASE							:     List[Any]=(512, 512, 512, 512, 512, 512, 512)     ,		__SCREAMING_SNAKE_CASE							:     List[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							:     Union[str, Any]=128     ,		__SCREAMING_SNAKE_CASE							:     List[Any]=16     ,		__SCREAMING_SNAKE_CASE							:     Tuple=False     ,		__SCREAMING_SNAKE_CASE							:     List[Any]=True     ,		__SCREAMING_SNAKE_CASE							:     int=0.05     ,		__SCREAMING_SNAKE_CASE							:     Any=10     ,		__SCREAMING_SNAKE_CASE							:     List[str]=2     ,		__SCREAMING_SNAKE_CASE							:     Any=0.0     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]=10     ,		__SCREAMING_SNAKE_CASE							:     str=0     ,		__SCREAMING_SNAKE_CASE							:     Any=320     ,		__SCREAMING_SNAKE_CASE							:     Optional[int]=2     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]=0.1     ,		__SCREAMING_SNAKE_CASE							:     Tuple=100     ,		__SCREAMING_SNAKE_CASE							:     List[str]=256     ,		__SCREAMING_SNAKE_CASE							:     Tuple=256     ,		__SCREAMING_SNAKE_CASE							:     List[Any]=0.1     ,		__SCREAMING_SNAKE_CASE							:     str="mean"     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]=False     ,		__SCREAMING_SNAKE_CASE							:     Dict=False     ,		__SCREAMING_SNAKE_CASE							:     Tuple=256     ,		__SCREAMING_SNAKE_CASE							:     Tuple=80     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]=0     ,		__SCREAMING_SNAKE_CASE							:     Union[str, Any]=1     ,		__SCREAMING_SNAKE_CASE							:     Dict=2     ,		__SCREAMING_SNAKE_CASE							:     str=0.5     ,		**__SCREAMING_SNAKE_CASE							:     str     ,		):


           '''simple docstring'''

           super().__init__(**__SCREAMING_SNAKE_CASE     ,		pad_token_id=__SCREAMING_SNAKE_CASE     ,		bos_token_id=__SCREAMING_SNAKE_CASE     ,		eos_token_id=__SCREAMING_SNAKE_CASE)
           __a						       =				hidden_size
           __a						       =				feat_extract_norm
           __a						       =				feat_extract_activation
           __a						       =				list(__SCREAMING_SNAKE_CASE)
           __a						       =				list(__SCREAMING_SNAKE_CASE)
           __a						       =				list(__SCREAMING_SNAKE_CASE)
           __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 		_lowerCamelCase			(		self							:     Optional[Any]):


           '''simple docstring'''

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










'''simple docstring'''





from collections.abc import Generator
from math import sin




def lowerCAmelCase  (__A):



     """simple docstring"""



     if len(__A) != 32:
          raise ValueError('''Input must be of length 32''')

     _a      =  b''''''
     for i in [3, 2, 1, 0]:
          little_endian += string_aa[8 * i : 8 * i + 8]
     return little_endian




def lowerCAmelCase  (__A):



     """simple docstring"""



     if i < 0:
          raise ValueError('''Input must be non-negative''')

     _a      =  format(__A  ,	'''08x''')[-8:]
     _a      =  b''''''
     for i in [3, 2, 1, 0]:
          little_endian_hex += hex_rep[2 * i : 2 * i + 2].encode('''utf-8''')
     return little_endian_hex




def lowerCAmelCase  (__A):



     """simple docstring"""



     _a      =  b''''''
     for char in message:
          bit_string += format(__A  ,	'''08b''').encode('''utf-8''')
     _a      =  format(len(__A)  ,	'''064b''').encode('''utf-8''')

     # Pad bit_string to a multiple of 512 chars
     bit_string += b"1"
     while len(__A) % 512 != 448:
          bit_string += b"0"
     bit_string += to_little_endian(start_len[32:]) + to_little_endian(start_len[:32])

     return bit_string




def lowerCAmelCase  (__A):



     """simple docstring"""



     if len(__A) % 512 != 0:
          raise ValueError('''Input must have length that\'s a multiple of 512''')

     for pos in range(0  ,	len(__A)  ,	512):
          _a      =  bit_string[pos : pos + 512]
          _a      =  []
          for i in range(0  ,	512  ,	32):
               block_words.append(int(to_little_endian(block[i : i + 32])  ,	2))
          yield block_words




def lowerCAmelCase  (__A):



     """simple docstring"""



     if i < 0:
          raise ValueError('''Input must be non-negative''')

     _a      =  format(__A  ,	'''032b''')
     _a      =  ''''''
     for c in i_str:
          new_str += "1" if c == "0" else "0"
     return int(__A  ,	2)




def lowerCAmelCase  (__A  ,	__A):



     """simple docstring"""



     return (a + b) % 2**32




def lowerCAmelCase  (__A  ,	__A):



     """simple docstring"""



     if i < 0:
          raise ValueError('''Input must be non-negative''')
     if shift < 0:
          raise ValueError('''Shift must be non-negative''')
     return ((i << shift) ^ (i >> (32 - shift))) % 2**32




def lowerCAmelCase  (__A):



     """simple docstring"""



     _a      =  preprocess(__A)

     _a      =  [int(2**32 * abs(sin(i + 1))) for i in range(64)]

     # Starting states
     _a      =  0x67_452_301
     _a      =  0xEF_CDA_B89
     _a      =  0x98_BAD_CFE
     _a      =  0x10_325_476

     _a      =  [
         7,
         12,
         17,
         22,
         7,
         12,
         17,
         22,
         7,
         12,
         17,
         22,
         7,
         12,
         17,
         22,
         5,
         9,
         14,
         20,
         5,
         9,
         14,
         20,
         5,
         9,
         14,
         20,
         5,
         9,
         14,
         20,
         4,
         11,
         16,
         23,
         4,
         11,
         16,
         23,
         4,
         11,
         16,
         23,
         4,
         11,
         16,
         23,
         6,
         10,
         15,
         21,
         6,
         10,
         15,
         21,
         6,
         10,
         15,
         21,
         6,
         10,
         15,
         21,
     ]

     # Process bit string in chunks, each with 16 32-char words
     for block_words in get_block_words(__A):
          _a      =  aa
          _a      =  ba
          _a      =  ca
          _a      =  da

          # Hash current chunk
          for i in range(64):
               if i <= 15:
                    # f = (b & c) | (not_32(b) & d)     # Alternate definition for f
                    _a      =  d ^ (b & (c ^ d))
                    _a      =  i
               elif i <= 31:
                    # f = (d & b) | (not_32(d) & c)     # Alternate definition for f
                    _a      =  c ^ (d & (b ^ c))
                    _a      =  (5 * i + 1) % 16
               elif i <= 47:
                    _a      =  b ^ c ^ d
                    _a      =  (3 * i + 5) % 16
               else:
                    _a      =  c ^ (b | not_aa(__A))
                    _a      =  (7 * i) % 16
               _a      =  (f + a + added_consts[i] + block_words[g]) % 2**32
               _a      =  d
               _a      =  c
               _a      =  b
               _a      =  sum_aa(__A  ,	left_rotate_aa(__A  ,	shift_amounts[i]))

          # Add hashed chunk to running total
          _a      =  sum_aa(__A  ,	__A)
          _a      =  sum_aa(__A  ,	__A)
          _a      =  sum_aa(__A  ,	__A)
          _a      =  sum_aa(__A  ,	__A)

     _a      =  reformat_hex(__A) + reformat_hex(__A) + reformat_hex(__A) + reformat_hex(__A)
     return digest


if __name__ == "__main__":
  import doctest

  doctest.testmod()



