import functools
import operator

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


a_    					=       logging.get_logger(__name__)

a_    					=       {
    '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 		_lowercase						(					snake_case_       ):
 lowercase				     =   'unispeech'

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

  """simple docstring"""





  super().__init__(**snake_case   ,      pad_token_id=snake_case   ,      bos_token_id=snake_case   ,      eos_token_id=snake_case			)
  UpperCamelCase_					:						List[str] =					hidden_size
  UpperCamelCase_					:						str =					feat_extract_norm
  UpperCamelCase_					:						int =					feat_extract_activation
  UpperCamelCase_					:						int =					list(snake_case			)
  UpperCamelCase_					:						Dict =					list(snake_case			)
  UpperCamelCase_					:						str =					list(snake_case			)
  UpperCamelCase_					:						Optional[Any] =					conv_bias
  UpperCamelCase_					:						str =					num_conv_pos_embeddings
  UpperCamelCase_					:						List[str] =					num_conv_pos_embedding_groups
  UpperCamelCase_					:						List[str] =					len(self.conv_dim			)
  UpperCamelCase_					:						str =					num_hidden_layers
  UpperCamelCase_					:						List[str] =					intermediate_size
  UpperCamelCase_					:						Dict =					hidden_act
  UpperCamelCase_					:						Any =					num_attention_heads
  UpperCamelCase_					:						int =					hidden_dropout
  UpperCamelCase_					:						Any =					attention_dropout
  UpperCamelCase_					:						Optional[int] =					activation_dropout
  UpperCamelCase_					:						int =					feat_proj_dropout
  UpperCamelCase_					:						Optional[int] =					final_dropout
  UpperCamelCase_					:						Optional[Any] =					layerdrop
  UpperCamelCase_					:						str =					layer_norm_eps
  UpperCamelCase_					:						List[str] =					initializer_range
  UpperCamelCase_					:						int =					num_ctc_classes
  UpperCamelCase_					:						str =					vocab_size
  UpperCamelCase_					:						Any =					do_stable_layer_norm
  UpperCamelCase_					:						int =					use_weighted_layer_sum
  UpperCamelCase_					:						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
  UpperCamelCase_					:						Tuple =					apply_spec_augment
  UpperCamelCase_					:						Optional[int] =					mask_time_prob
  UpperCamelCase_					:						str =					mask_time_length
  UpperCamelCase_					:						Union[str, Any] =					mask_time_min_masks
  UpperCamelCase_					:						Union[str, Any] =					mask_feature_prob
  UpperCamelCase_					:						Union[str, Any] =					mask_feature_length
  UpperCamelCase_					:						int =					mask_feature_min_masks

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

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

  # pretraining loss
  UpperCamelCase_					:						Union[str, Any] =					replace_prob


 @property
 def 						SCREAMING_SNAKE_CASE__   ( self	:							Tuple			)   ->						Optional[int]:

  """simple docstring"""





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




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


a_    					=       logging.get_logger(__name__)

a_    					=       {
    # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert
}





class 		_lowercase						(					snake_case_       ):
 lowercase				     =   'megatron-bert'

 def __init__( self	:							List[str]   ,      snake_case	:							Tuple=2_9_0_5_6   ,      snake_case	:							Dict=1_0_2_4   ,      snake_case	:							Dict=2_4   ,      snake_case	:							Union[str, Any]=1_6   ,      snake_case	:							Optional[int]=4_0_9_6   ,      snake_case	:							Optional[int]="gelu"   ,      snake_case	:							Any=0.1   ,      snake_case	:							Tuple=0.1   ,      snake_case	:							Optional[int]=5_1_2   ,      snake_case	:							List[Any]=2   ,      snake_case	:							Tuple=0.02   ,      snake_case	:							Optional[Any]=1e-12   ,      snake_case	:							str=0   ,      snake_case	:							Optional[int]="absolute"   ,      snake_case	:							Union[str, Any]=True   ,      **snake_case	:							Any   ,      )   ->						List[Any]:

  """simple docstring"""





  super().__init__(pad_token_id=snake_case   ,      **snake_case			)

  UpperCamelCase_					:						Optional[Any] =					vocab_size
  UpperCamelCase_					:						Any =					hidden_size
  UpperCamelCase_					:						Union[str, Any] =					num_hidden_layers
  UpperCamelCase_					:						List[Any] =					num_attention_heads
  UpperCamelCase_					:						str =					hidden_act
  UpperCamelCase_					:						List[str] =					intermediate_size
  UpperCamelCase_					:						List[Any] =					hidden_dropout_prob
  UpperCamelCase_					:						Any =					attention_probs_dropout_prob
  UpperCamelCase_					:						Tuple =					max_position_embeddings
  UpperCamelCase_					:						Dict =					type_vocab_size
  UpperCamelCase_					:						Optional[int] =					initializer_range
  UpperCamelCase_					:						Optional[Any] =					layer_norm_eps
  UpperCamelCase_					:						Dict =					position_embedding_type
  UpperCamelCase_					:						List[str] =					use_cache



