


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

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


__SCREAMING_SNAKE_CASE							:    List[Any]		=    logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE							:    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      __A     (snake_case__):





							'''simple docstring'''

							__lowercase:		int							      =    """unispeech-sat"""



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



														"""simple docstring"""



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

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

														# ctc loss
														snake_case_           =		ctc_loss_reduction
														snake_case_           =		ctc_zero_infinity

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

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



							@property
							def 		lowerCAmelCase       (				self							:      Tuple       )					->List[Any]:



														"""simple docstring"""



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







"""simple docstring"""
def 						_a				(      _SCREAMING_SNAKE_CASE				)    ->				list:

							# bit count represents no. of bits in the gray code
							if bit_count < 0:
														raise ValueError("""The given input must be positive"""				)

							# get the generated string sequence
							snake_case_           =		gray_code_sequence_string(_SCREAMING_SNAKE_CASE				)
							#
							# convert them to integers
							for i in range(len(_SCREAMING_SNAKE_CASE				)				):
														snake_case_           =		int(sequence[i]				, 2				)

							return sequence







def 						_a				(      _SCREAMING_SNAKE_CASE				)    ->				list:

							# The approach is a recursive one
							# Base case achieved when either n = 0 or n=1
							if bit_count == 0:
														return ["0"]

							if bit_count == 1:
														return ["0", "1"]

							snake_case_           =		1 << bit_count  # defines the length of the sequence
							# 1<< n is equivalent to 2^n

							# recursive answer will generate answer for n-1 bits
							snake_case_           =		gray_code_sequence_string(bit_count - 1				)

							snake_case_           =		[]

							# append 0 to first half of the smaller sequence generated
							for i in range(seq_len // 2				):
														snake_case_           =		"""0""" + smaller_sequence[i]
														sequence.append(_SCREAMING_SNAKE_CASE				)

							# append 1 to second half ... start from the end of the list
							for i in reversed(range(seq_len // 2				)				):
														snake_case_           =		"""1""" + smaller_sequence[i]
														sequence.append(_SCREAMING_SNAKE_CASE				)

							return sequence


if __name__ == "__main__":
				import doctest

				doctest.testmod()



