



"""simple docstring"""






import functools
import operator

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


snake_case   					=				logging.get_logger(__name__)

snake_case   					=				{
    '''facebook/wav2vec2-base-960h''': '''https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json''',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}



class     UpperCAmelCase    (	__SCREAMING_SNAKE_CASE  ):
   A__		:	Optional[int]           =  '''wav2vec2'''



   def __init__(       self    :	str							,       __lowerCamelCase    :	Union[str, Any]=3_2							,       __lowerCamelCase    :	Dict=7_6_8							,       __lowerCamelCase    :	List[str]=1_2							,       __lowerCamelCase    :	str=1_2							,       __lowerCamelCase    :	int=3_0_7_2							,       __lowerCamelCase    :	Optional[int]="gelu"							,       __lowerCamelCase    :	Dict=0.1							,       __lowerCamelCase    :	int=0.1							,       __lowerCamelCase    :	Any=0.1							,       __lowerCamelCase    :	List[Any]=0.0							,       __lowerCamelCase    :	int=0.0							,       __lowerCamelCase    :	Optional[Any]=0.1							,       __lowerCamelCase    :	Union[str, Any]=0.1							,       __lowerCamelCase    :	Dict=0.0_2							,       __lowerCamelCase    :	Union[str, Any]=1E-5							,       __lowerCamelCase    :	List[str]="group"							,       __lowerCamelCase    :	int="gelu"							,       __lowerCamelCase    :	int=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)							,       __lowerCamelCase    :	Optional[int]=(5, 2, 2, 2, 2, 2, 2)							,       __lowerCamelCase    :	Tuple=(1_0, 3, 3, 3, 3, 2, 2)							,       __lowerCamelCase    :	Optional[int]=False							,       __lowerCamelCase    :	Any=1_2_8							,       __lowerCamelCase    :	int=1_6							,       __lowerCamelCase    :	Any=False							,       __lowerCamelCase    :	Optional[Any]=True							,       __lowerCamelCase    :	str=0.0_5							,       __lowerCamelCase    :	Dict=1_0							,       __lowerCamelCase    :	Any=2							,       __lowerCamelCase    :	str=0.0							,       __lowerCamelCase    :	int=1_0							,       __lowerCamelCase    :	List[Any]=0							,       __lowerCamelCase    :	List[Any]=3_2_0							,       __lowerCamelCase    :	Optional[Any]=2							,       __lowerCamelCase    :	Dict=0.1							,       __lowerCamelCase    :	Optional[int]=1_0_0							,       __lowerCamelCase    :	List[str]=2_5_6							,       __lowerCamelCase    :	str=2_5_6							,       __lowerCamelCase    :	List[str]=0.1							,       __lowerCamelCase    :	int="sum"							,       __lowerCamelCase    :	int=False							,       __lowerCamelCase    :	str=False							,       __lowerCamelCase    :	Tuple=2_5_6							,       __lowerCamelCase    :	int=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)							,       __lowerCamelCase    :	List[str]=(5, 3, 3, 1, 1)							,       __lowerCamelCase    :	Any=(1, 2, 3, 1, 1)							,       __lowerCamelCase    :	str=5_1_2							,       __lowerCamelCase    :	Optional[int]=0							,       __lowerCamelCase    :	List[Any]=1							,       __lowerCamelCase    :	Optional[int]=2							,       __lowerCamelCase    :	Tuple=False							,       __lowerCamelCase    :	str=3							,       __lowerCamelCase    :	List[Any]=2							,       __lowerCamelCase    :	Any=3							,       __lowerCamelCase    :	List[Any]=None							,       __lowerCamelCase    :	Optional[int]=None							,       **__lowerCamelCase    :	Optional[int]							,       ):



     """simple docstring"""
     super().__init__(**__lowerCamelCase							,       pad_token_id=__lowerCamelCase							,       bos_token_id=__lowerCamelCase							,       eos_token_id=__lowerCamelCase				)
     _snake_case   	=      hidden_size
     _snake_case   	=      feat_extract_norm
     _snake_case   	=      feat_extract_activation
     _snake_case   	=      list(__lowerCamelCase				)
     _snake_case   	=      list(__lowerCamelCase				)
     _snake_case   	=      list(__lowerCamelCase				)
     _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   	=      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

     # adapter
     _snake_case   	=      add_adapter
     _snake_case   	=      adapter_kernel_size
     _snake_case   	=      adapter_stride
     _snake_case   	=      num_adapter_layers
     _snake_case   	=      output_hidden_size or hidden_size
     _snake_case   	=      adapter_attn_dim

     # 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(__lowerCamelCase				)
     _snake_case   	=      list(__lowerCamelCase				)
     _snake_case   	=      list(__lowerCamelCase				)
     _snake_case   	=      xvector_output_dim





   @property
   def    __UpperCAmelCase    (       self    :	Union[str, Any]				):



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










"""simple docstring"""






from ...configuration_utils import PretrainedConfig



class     UpperCAmelCase    (	__SCREAMING_SNAKE_CASE  ):
   A__		:	str           =  '''bert-generation'''



   def __init__(       self    :	Tuple							,       __lowerCamelCase    :	Optional[int]=5_0_3_5_8							,       __lowerCamelCase    :	List[str]=1_0_2_4							,       __lowerCamelCase    :	Optional[Any]=2_4							,       __lowerCamelCase    :	Any=1_6							,       __lowerCamelCase    :	Union[str, Any]=4_0_9_6							,       __lowerCamelCase    :	Optional[Any]="gelu"							,       __lowerCamelCase    :	str=0.1							,       __lowerCamelCase    :	List[str]=0.1							,       __lowerCamelCase    :	int=5_1_2							,       __lowerCamelCase    :	Dict=0.0_2							,       __lowerCamelCase    :	Tuple=1E-12							,       __lowerCamelCase    :	Any=0							,       __lowerCamelCase    :	Union[str, Any]=2							,       __lowerCamelCase    :	List[Any]=1							,       __lowerCamelCase    :	Optional[Any]="absolute"							,       __lowerCamelCase    :	str=True							,       **__lowerCamelCase    :	List[Any]							,       ):



     """simple docstring"""
     super().__init__(pad_token_id=__lowerCamelCase							,       bos_token_id=__lowerCamelCase							,       eos_token_id=__lowerCamelCase							,       **__lowerCamelCase				)

     _snake_case   	=      vocab_size
     _snake_case   	=      hidden_size
     _snake_case   	=      num_hidden_layers
     _snake_case   	=      num_attention_heads
     _snake_case   	=      hidden_act
     _snake_case   	=      intermediate_size
     _snake_case   	=      hidden_dropout_prob
     _snake_case   	=      attention_probs_dropout_prob
     _snake_case   	=      max_position_embeddings
     _snake_case   	=      initializer_range
     _snake_case   	=      layer_norm_eps
     _snake_case   	=      position_embedding_type
     _snake_case   	=      use_cache





