





"""simple docstring"""







import functools
import operator

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


a__      :	Tuple       				=      logging.get_logger(__name__)

a__      :	Optional[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 __magic_name__   (       _UpperCamelCase		):
       UpperCamelCase    :						List[Any]      =	"unispeech-sat"
       def __init__(     self   ,  __magic_name__=3_2   ,  __magic_name__=7_6_8   ,  __magic_name__=1_2   ,  __magic_name__=1_2   ,  __magic_name__=3_0_7_2   ,  __magic_name__="gelu"   ,  __magic_name__=0.1   ,  __magic_name__=0.1   ,  __magic_name__=0.1   ,  __magic_name__=0.0   ,  __magic_name__=0.0   ,  __magic_name__=0.1   ,  __magic_name__=0.1   ,  __magic_name__=0.02   ,  __magic_name__=1e-5   ,  __magic_name__="group"   ,  __magic_name__="gelu"   ,  __magic_name__=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)   ,  __magic_name__=(5, 2, 2, 2, 2, 2, 2)   ,  __magic_name__=(1_0, 3, 3, 3, 3, 2, 2)   ,  __magic_name__=False   ,  __magic_name__=1_2_8   ,  __magic_name__=1_6   ,  __magic_name__=False   ,  __magic_name__=True   ,  __magic_name__=0.05   ,  __magic_name__=1_0   ,  __magic_name__=2   ,  __magic_name__=0.0   ,  __magic_name__=1_0   ,  __magic_name__=0   ,  __magic_name__=3_2_0   ,  __magic_name__=2   ,  __magic_name__=0.1   ,  __magic_name__=1_0_0   ,  __magic_name__=2_5_6   ,  __magic_name__=2_5_6   ,  __magic_name__=0.1   ,  __magic_name__="mean"   ,  __magic_name__=False   ,  __magic_name__=False   ,  __magic_name__=2_5_6   ,  __magic_name__=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)   ,  __magic_name__=(5, 3, 3, 1, 1)   ,  __magic_name__=(1, 2, 3, 1, 1)   ,  __magic_name__=5_1_2   ,  __magic_name__=0   ,  __magic_name__=1   ,  __magic_name__=2   ,  __magic_name__=5_0_4   ,  **__magic_name__   ,  ):





         """simple docstring"""


         super().__init__(**__lowerCAmelCase   ,  pad_token_id=__lowerCAmelCase   ,  bos_token_id=__lowerCAmelCase   ,  eos_token_id=__lowerCAmelCase	)
         _lowerCAmelCase	      =					hidden_size
         _lowerCAmelCase	      =					feat_extract_norm
         _lowerCAmelCase	      =					feat_extract_activation
         _lowerCAmelCase	      =					list(__lowerCAmelCase	)
         _lowerCAmelCase	      =					list(__lowerCAmelCase	)
         _lowerCAmelCase	      =					list(__lowerCAmelCase	)
         _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(__lowerCAmelCase	)
         _lowerCAmelCase	      =					list(__lowerCAmelCase	)
         _lowerCAmelCase	      =					list(__lowerCAmelCase	)
         _lowerCAmelCase	      =					xvector_output_dim
       @property
       def 		_lowerCamelCase   (     self	):





         """simple docstring"""


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











def   __lowercase       (			snake_case			):







				"""simple docstring"""






				return "".join([hex(snake_case			)[2:].zfill(2			).upper() for byte in list(snake_case			)]			)

def   __lowercase       (			snake_case			):







				"""simple docstring"""






				if (len(snake_case			) % 2) != 0:
								raise ValueError(
								    '''Base16 encoded data is invalid:
Data does not have an even number of hex digits.'''			)
				# Check the character set - the standard base16 alphabet
				# is uppercase according to RFC3548 section 6
				if not set(snake_case			) <= set('''0123456789ABCDEF'''			):
								raise ValueError(
								    '''Base16 encoded data is invalid:
Data is not uppercase hex or it contains invalid characters.'''			)
				# For every two hexadecimal digits (= a byte), turn it into an integer.
				# Then, string the result together into bytes, and return it.
				return bytes(int(data[i] + data[i + 1],	1_6			) for i in range(0,	len(snake_case			),	2			)			)


if __name__ == "__main__":
					import doctest

					doctest.testmod()






