




'''simple docstring'''





import functools
import operator

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


__UpperCAmelCase       =		logging.get_logger(__name__)

__UpperCAmelCase       =		{
    "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 		SCREAMING_SNAKE_CASE			(     _a							):




				'''simple docstring'''





				__UpperCamelCase     				=   '''unispeech'''







				def __init__(   self  ,						SCREAMING_SNAKE_CASE__=32  ,						SCREAMING_SNAKE_CASE__=7_68  ,						SCREAMING_SNAKE_CASE__=12  ,						SCREAMING_SNAKE_CASE__=12  ,						SCREAMING_SNAKE_CASE__=30_72  ,						SCREAMING_SNAKE_CASE__="gelu"  ,						SCREAMING_SNAKE_CASE__=0.1  ,						SCREAMING_SNAKE_CASE__=0.1  ,						SCREAMING_SNAKE_CASE__=0.1  ,						SCREAMING_SNAKE_CASE__=0.0  ,						SCREAMING_SNAKE_CASE__=0.0  ,						SCREAMING_SNAKE_CASE__=0.1  ,						SCREAMING_SNAKE_CASE__=0.1  ,						SCREAMING_SNAKE_CASE__=0.02  ,						SCREAMING_SNAKE_CASE__=1E-5  ,						SCREAMING_SNAKE_CASE__="group"  ,						SCREAMING_SNAKE_CASE__="gelu"  ,						SCREAMING_SNAKE_CASE__=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)  ,						SCREAMING_SNAKE_CASE__=(5, 2, 2, 2, 2, 2, 2)  ,						SCREAMING_SNAKE_CASE__=(10, 3, 3, 3, 3, 2, 2)  ,						SCREAMING_SNAKE_CASE__=False  ,						SCREAMING_SNAKE_CASE__=1_28  ,						SCREAMING_SNAKE_CASE__=16  ,						SCREAMING_SNAKE_CASE__=False  ,						SCREAMING_SNAKE_CASE__=True  ,						SCREAMING_SNAKE_CASE__=0.05  ,						SCREAMING_SNAKE_CASE__=10  ,						SCREAMING_SNAKE_CASE__=2  ,						SCREAMING_SNAKE_CASE__=0.0  ,						SCREAMING_SNAKE_CASE__=10  ,						SCREAMING_SNAKE_CASE__=0  ,						SCREAMING_SNAKE_CASE__=3_20  ,						SCREAMING_SNAKE_CASE__=2  ,						SCREAMING_SNAKE_CASE__=0.1  ,						SCREAMING_SNAKE_CASE__=1_00  ,						SCREAMING_SNAKE_CASE__=2_56  ,						SCREAMING_SNAKE_CASE__=2_56  ,						SCREAMING_SNAKE_CASE__=0.1  ,						SCREAMING_SNAKE_CASE__="mean"  ,						SCREAMING_SNAKE_CASE__=False  ,						SCREAMING_SNAKE_CASE__=False  ,						SCREAMING_SNAKE_CASE__=2_56  ,						SCREAMING_SNAKE_CASE__=80  ,						SCREAMING_SNAKE_CASE__=0  ,						SCREAMING_SNAKE_CASE__=1  ,						SCREAMING_SNAKE_CASE__=2  ,						SCREAMING_SNAKE_CASE__=0.5  ,						**SCREAMING_SNAKE_CASE__  ,						):
							'''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__				)
							snake_case:       List[Any]        =       hidden_size
							snake_case:       List[str]        =       feat_extract_norm
							snake_case:       Union[str, Any]        =       feat_extract_activation
							snake_case:       Union[str, Any]        =       list(SCREAMING_SNAKE_CASE__				)
							snake_case:       Tuple        =       list(SCREAMING_SNAKE_CASE__				)
							snake_case:       List[str]        =       list(SCREAMING_SNAKE_CASE__				)
							snake_case:       Dict        =       conv_bias
							snake_case:       Optional[int]        =       num_conv_pos_embeddings
							snake_case:       Any        =       num_conv_pos_embedding_groups
							snake_case:       Tuple        =       len(self.conv_dim				)
							snake_case:       Dict        =       num_hidden_layers
							snake_case:       Optional[int]        =       intermediate_size
							snake_case:       str        =       hidden_act
							snake_case:       Dict        =       num_attention_heads
							snake_case:       Optional[int]        =       hidden_dropout
							snake_case:       List[str]        =       attention_dropout
							snake_case:       List[Any]        =       activation_dropout
							snake_case:       List[Any]        =       feat_proj_dropout
							snake_case:       Tuple        =       final_dropout
							snake_case:       Tuple        =       layerdrop
							snake_case:       int        =       layer_norm_eps
							snake_case:       Optional[Any]        =       initializer_range
							snake_case:       Optional[Any]        =       num_ctc_classes
							snake_case:       int        =       vocab_size
							snake_case:       Optional[int]        =       do_stable_layer_norm
							snake_case:       Union[str, Any]        =       use_weighted_layer_sum
							snake_case:       int        =       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
							snake_case:       str        =       apply_spec_augment
							snake_case:       Optional[int]        =       mask_time_prob
							snake_case:       Optional[Any]        =       mask_time_length
							snake_case:       List[Any]        =       mask_time_min_masks
							snake_case:       Any        =       mask_feature_prob
							snake_case:       Any        =       mask_feature_length
							snake_case:       str        =       mask_feature_min_masks

							# parameters for pretraining with codevector quantized representations
							snake_case:       List[Any]        =       num_codevectors_per_group
							snake_case:       Dict        =       num_codevector_groups
							snake_case:       Any        =       contrastive_logits_temperature
							snake_case:       Optional[Any]        =       feat_quantizer_dropout
							snake_case:       Dict        =       num_negatives
							snake_case:       Dict        =       codevector_dim
							snake_case:       Dict        =       proj_codevector_dim
							snake_case:       List[str]        =       diversity_loss_weight

							# ctc loss
							snake_case:       Any        =       ctc_loss_reduction
							snake_case:       Union[str, Any]        =       ctc_zero_infinity

							# pretraining loss
							snake_case:       Dict        =       replace_prob







				@property
				def        _UpperCamelCase							(   self				):
							'''simple docstring'''







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







def        _snake_case   (_snake_case				:       list      ,    _snake_case				:       int      ,    _snake_case				:       int = 0      ,    _snake_case				:       int = 0)					->	int:
   _lowercase              =right or len(_snake_case) - 1
   if left > right:
      return -1
   elif list_data[left] == key:
      return left
   elif list_data[right] == key:
      return right
   else:
      return search(_snake_case      ,    _snake_case      ,    left + 1      ,    right - 1)


if __name__ == "__main__":
    import doctest

    doctest.testmod()


