





"""simple docstring"""




import functools
import operator

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


lowerCamelCase_     :						Any						=					logging.get_logger(__name__)

lowerCamelCase_     :						Optional[Any]						=					{
    '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  (   UpperCAmelCase__		):



      '''simple docstring'''
      lowercase_      : Optional[int]	    =   """wav2vec2"""

      def __init__(     self					,      snake_case_=3_2					,      snake_case_=7_6_8					,      snake_case_=1_2					,      snake_case_=1_2					,      snake_case_=3_0_7_2					,      snake_case_="gelu"					,      snake_case_=0.1					,      snake_case_=0.1					,      snake_case_=0.1					,      snake_case_=0.0					,      snake_case_=0.0					,      snake_case_=0.1					,      snake_case_=0.1					,      snake_case_=0.02					,      snake_case_=1E-5					,      snake_case_="group"					,      snake_case_="gelu"					,      snake_case_=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)					,      snake_case_=(5, 2, 2, 2, 2, 2, 2)					,      snake_case_=(1_0, 3, 3, 3, 3, 2, 2)					,      snake_case_=False					,      snake_case_=1_2_8					,      snake_case_=1_6					,      snake_case_=False					,      snake_case_=True					,      snake_case_=0.05					,      snake_case_=1_0					,      snake_case_=2					,      snake_case_=0.0					,      snake_case_=1_0					,      snake_case_=0					,      snake_case_=3_2_0					,      snake_case_=2					,      snake_case_=0.1					,      snake_case_=1_0_0					,      snake_case_=2_5_6					,      snake_case_=2_5_6					,      snake_case_=0.1					,      snake_case_="sum"					,      snake_case_=False					,      snake_case_=False					,      snake_case_=2_5_6					,      snake_case_=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)					,      snake_case_=(5, 3, 3, 1, 1)					,      snake_case_=(1, 2, 3, 1, 1)					,      snake_case_=5_1_2					,      snake_case_=0					,      snake_case_=1					,      snake_case_=2					,      snake_case_=False					,      snake_case_=3					,      snake_case_=2					,      snake_case_=3					,      snake_case_=None					,      snake_case_=None					,      **snake_case_					,      ):

        """simple docstring"""

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

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

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

        # adapter
        A_  :       Any										=  add_adapter
        A_  :       int										=  adapter_kernel_size
        A_  :       str										=  adapter_stride
        A_  :       List[str]										=  num_adapter_layers
        A_  :       Optional[int]										=  output_hidden_size or hidden_size
        A_  :       str										=  adapter_attn_dim

        # SequenceClassification-specific parameter. Feel free to ignore for other classes.
        A_  :       Dict										=  classifier_proj_size

        # XVector-specific parameters. Feel free to ignore for other classes.
        A_  :       Optional[int]										=  list(snake_case_  )
        A_  :       Any										=  list(snake_case_  )
        A_  :       List[str]										=  list(snake_case_  )
        A_  :       List[Any]										=  xvector_output_dim

      @property
      def 					lowerCamelCase_			(     self  ):

        """simple docstring"""

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






"""simple docstring"""




from transformers import BertTokenizerFast

from .custom_tokenization import CustomTokenizer

class  _UpperCAmelCase  (   UpperCAmelCase__		):



      '''simple docstring'''
      lowercase_      : List[str]	    =   CustomTokenizer
      pass