


"""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  lowerCamelCase__    (		_a     ):
      a			:  List[str]           =		"""unispeech"""
      def __init__(		self						:						List[str]   ,							A_						:						int=3_2   ,							A_						:						Tuple=7_6_8   ,							A_						:						Optional[Any]=1_2   ,							A_						:						Optional[Any]=1_2   ,							A_						:						Optional[Any]=3_0_7_2   ,							A_						:						Dict="gelu"   ,							A_						:						int=0.1   ,							A_						:						Union[str, Any]=0.1   ,							A_						:						int=0.1   ,							A_						:						Union[str, Any]=0.0   ,							A_						:						Any=0.0   ,							A_						:						int=0.1   ,							A_						:						Any=0.1   ,							A_						:						List[str]=0.02   ,							A_						:						Optional[int]=1e-5   ,							A_						:						str="group"   ,							A_						:						Optional[int]="gelu"   ,							A_						:						Any=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)   ,							A_						:						Optional[Any]=(5, 2, 2, 2, 2, 2, 2)   ,							A_						:						List[str]=(1_0, 3, 3, 3, 3, 2, 2)   ,							A_						:						int=False   ,							A_						:						int=1_2_8   ,							A_						:						Tuple=1_6   ,							A_						:						Tuple=False   ,							A_						:						List[Any]=True   ,							A_						:						Optional[int]=0.05   ,							A_						:						str=1_0   ,							A_						:						Tuple=2   ,							A_						:						Optional[Any]=0.0   ,							A_						:						Any=1_0   ,							A_						:						Dict=0   ,							A_						:						Optional[Any]=3_2_0   ,							A_						:						str=2   ,							A_						:						Optional[Any]=0.1   ,							A_						:						List[str]=1_0_0   ,							A_						:						Dict=2_5_6   ,							A_						:						Optional[int]=2_5_6   ,							A_						:						Union[str, Any]=0.1   ,							A_						:						Optional[int]="mean"   ,							A_						:						int=False   ,							A_						:						Optional[Any]=False   ,							A_						:						Dict=2_5_6   ,							A_						:						str=8_0   ,							A_						:						str=0   ,							A_						:						Optional[int]=1   ,							A_						:						Dict=2   ,							A_						:						List[str]=0.5   ,							**A_						:						Dict   ,							):






       '''simple docstring'''


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

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

       # ctc loss
       __lowercase						=						ctc_loss_reduction
       __lowercase						=						ctc_zero_infinity

       # pretraining loss
       __lowercase						=						replace_prob






      @property
      def SCREAMING_SNAKE_CASE_						(		self						:						Dict				):






       '''simple docstring'''


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




"""simple docstring"""

def lowerCAmelCase_   (					UpperCamelCase__						:			list					, UpperCamelCase__						:			int					, UpperCamelCase__						:			int = 0					, UpperCamelCase__						:			int = 0			):






 """simple docstring"""







 __lowercase						=						right or len(UpperCamelCase__			) - 1
 if left > right:
  return -1
 elif list_data[left] == key:
  return left
 elif list_data[right] == key:
  return right
 else:
  return search(UpperCamelCase__					, UpperCamelCase__					, left + 1					, right - 1			)


if __name__ == "__main__":
       import doctest

       doctest.testmod()
