



"""simple docstring"""







import functools
import operator

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


lowercase__		:    Dict				   =     logging.get_logger(__name__)

lowercase__		:    Union[str, 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__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""wav2vec2"""



      def __init__(				self    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=3_2   ,      SCREAMING_SNAKE_CASE_    :				Dict=7_6_8   ,      SCREAMING_SNAKE_CASE_    :				Dict=1_2   ,      SCREAMING_SNAKE_CASE_    :				Tuple=1_2   ,      SCREAMING_SNAKE_CASE_    :				Tuple=3_0_7_2   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]="gelu"   ,      SCREAMING_SNAKE_CASE_    :				str=0.1   ,      SCREAMING_SNAKE_CASE_    :				Any=0.1   ,      SCREAMING_SNAKE_CASE_    :				Any=0.1   ,      SCREAMING_SNAKE_CASE_    :				Dict=0.0   ,      SCREAMING_SNAKE_CASE_    :				Tuple=0.0   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=0.1   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=0.1   ,      SCREAMING_SNAKE_CASE_    :				int=0.02   ,      SCREAMING_SNAKE_CASE_    :				Tuple=1E-5   ,      SCREAMING_SNAKE_CASE_    :				List[Any]="group"   ,      SCREAMING_SNAKE_CASE_    :				List[Any]="gelu"   ,      SCREAMING_SNAKE_CASE_    :				Tuple=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)   ,      SCREAMING_SNAKE_CASE_    :				Any=(5, 2, 2, 2, 2, 2, 2)   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=(1_0, 3, 3, 3, 3, 2, 2)   ,      SCREAMING_SNAKE_CASE_    :				Any=False   ,      SCREAMING_SNAKE_CASE_    :				List[str]=1_2_8   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=1_6   ,      SCREAMING_SNAKE_CASE_    :				Any=False   ,      SCREAMING_SNAKE_CASE_    :				str=True   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=0.05   ,      SCREAMING_SNAKE_CASE_    :				Dict=1_0   ,      SCREAMING_SNAKE_CASE_    :				Any=2   ,      SCREAMING_SNAKE_CASE_    :				str=0.0   ,      SCREAMING_SNAKE_CASE_    :				Tuple=1_0   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=0   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=3_2_0   ,      SCREAMING_SNAKE_CASE_    :				str=2   ,      SCREAMING_SNAKE_CASE_    :				str=0.1   ,      SCREAMING_SNAKE_CASE_    :				List[str]=1_0_0   ,      SCREAMING_SNAKE_CASE_    :				Dict=2_5_6   ,      SCREAMING_SNAKE_CASE_    :				str=2_5_6   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=0.1   ,      SCREAMING_SNAKE_CASE_    :				Tuple="sum"   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=False   ,      SCREAMING_SNAKE_CASE_    :				Any=False   ,      SCREAMING_SNAKE_CASE_    :				str=2_5_6   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)   ,      SCREAMING_SNAKE_CASE_    :				str=(5, 3, 3, 1, 1)   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=(1, 2, 3, 1, 1)   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=5_1_2   ,      SCREAMING_SNAKE_CASE_    :				int=0   ,      SCREAMING_SNAKE_CASE_    :				Any=1   ,      SCREAMING_SNAKE_CASE_    :				List[str]=2   ,      SCREAMING_SNAKE_CASE_    :				Any=False   ,      SCREAMING_SNAKE_CASE_    :				List[str]=3   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=2   ,      SCREAMING_SNAKE_CASE_    :				str=3   ,      SCREAMING_SNAKE_CASE_    :				str=None   ,      SCREAMING_SNAKE_CASE_    :				str=None   ,      **SCREAMING_SNAKE_CASE_    :				Dict   ,      ):
        super().__init__(**SCREAMING_SNAKE_CASE_   ,      pad_token_id=SCREAMING_SNAKE_CASE_   ,      bos_token_id=SCREAMING_SNAKE_CASE_   ,      eos_token_id=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Dict								=			hidden_size
        lowerCAmelCase_       :    Optional[int]								=			feat_extract_norm
        lowerCAmelCase_       :    Any								=			feat_extract_activation
        lowerCAmelCase_       :    Dict								=			list(SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    List[Any]								=			list(SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Tuple								=			list(SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Optional[Any]								=			conv_bias
        lowerCAmelCase_       :    List[str]								=			num_conv_pos_embeddings
        lowerCAmelCase_       :    Optional[Any]								=			num_conv_pos_embedding_groups
        lowerCAmelCase_       :    List[str]								=			len(self.conv_dim	)
        lowerCAmelCase_       :    Tuple								=			num_hidden_layers
        lowerCAmelCase_       :    Any								=			intermediate_size
        lowerCAmelCase_       :    Optional[int]								=			hidden_act
        lowerCAmelCase_       :    List[Any]								=			num_attention_heads
        lowerCAmelCase_       :    Optional[Any]								=			hidden_dropout
        lowerCAmelCase_       :    Union[str, Any]								=			attention_dropout
        lowerCAmelCase_       :    Optional[Any]								=			activation_dropout
        lowerCAmelCase_       :    Tuple								=			feat_proj_dropout
        lowerCAmelCase_       :    str								=			final_dropout
        lowerCAmelCase_       :    Tuple								=			layerdrop
        lowerCAmelCase_       :    Dict								=			layer_norm_eps
        lowerCAmelCase_       :    Any								=			initializer_range
        lowerCAmelCase_       :    str								=			vocab_size
        lowerCAmelCase_       :    str								=			do_stable_layer_norm
        lowerCAmelCase_       :    List[Any]								=			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
        lowerCAmelCase_       :    Tuple								=			apply_spec_augment
        lowerCAmelCase_       :    Optional[int]								=			mask_time_prob
        lowerCAmelCase_       :    List[str]								=			mask_time_length
        lowerCAmelCase_       :    int								=			mask_time_min_masks
        lowerCAmelCase_       :    Union[str, Any]								=			mask_feature_prob
        lowerCAmelCase_       :    int								=			mask_feature_length
        lowerCAmelCase_       :    Tuple								=			mask_feature_min_masks

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

        # ctc loss
        lowerCAmelCase_       :    Dict								=			ctc_loss_reduction
        lowerCAmelCase_       :    Optional[Any]								=			ctc_zero_infinity

        # adapter
        lowerCAmelCase_       :    int								=			add_adapter
        lowerCAmelCase_       :    Any								=			adapter_kernel_size
        lowerCAmelCase_       :    List[str]								=			adapter_stride
        lowerCAmelCase_       :    List[str]								=			num_adapter_layers
        lowerCAmelCase_       :    Tuple								=			output_hidden_size or hidden_size
        lowerCAmelCase_       :    Dict								=			adapter_attn_dim

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

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





      @property
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[int]	):
        return functools.reduce(operator.mul   ,      self.conv_stride   ,      1	)










"""simple docstring"""







import baseaa

def     UpperCamelCase_   (   lowerCAmelCase__				:    str						)						->       bytes:

  """simple docstring"""




  return baseaa.aaaencode(string.encode('utf-8'						)						)

def     UpperCamelCase_   (   lowerCAmelCase__				:    bytes						)						->       str:

  """simple docstring"""




  return baseaa.aaadecode(lowerCAmelCase__						).decode('utf-8'						)


if __name__ == "__main__":
     import doctest

     doctest.testmod()





