





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 						SCREAMING_SNAKE_CASE__							(			A__    ):
      A_		:							List[str]				=       'wav2vec2'


      def __init__(self			: List[str]							,     a__			: Union[str, Any]=32							,     a__			: Any=768							,     a__			: List[str]=12							,     a__			: Dict=12							,     a__			: str=3072							,     a__			: str="gelu"							,     a__			: Optional[Any]=0.1							,     a__			: List[Any]=0.1							,     a__			: Any=0.1							,     a__			: List[str]=0.0							,     a__			: str=0.0							,     a__			: List[str]=0.1							,     a__			: int=0.1							,     a__			: Union[str, Any]=0.0_2							,     a__			: List[Any]=1E-5							,     a__			: int="group"							,     a__			: Tuple="gelu"							,     a__			: int=(512, 512, 512, 512, 512, 512, 512)							,     a__			: Dict=(5, 2, 2, 2, 2, 2, 2)							,     a__			: List[Any]=(10, 3, 3, 3, 3, 2, 2)							,     a__			: Optional[Any]=False							,     a__			: List[str]=128							,     a__			: Tuple=16							,     a__			: Any=False							,     a__			: Union[str, Any]=True							,     a__			: List[Any]=0.0_5							,     a__			: List[str]=10							,     a__			: Optional[int]=2							,     a__			: int=0.0							,     a__			: Dict=10							,     a__			: List[Any]=0							,     a__			: int=320							,     a__			: Any=2							,     a__			: Dict=0.1							,     a__			: Any=100							,     a__			: List[Any]=256							,     a__			: Any=256							,     a__			: str=0.1							,     a__			: int="sum"							,     a__			: int=False							,     a__			: str=False							,     a__			: Dict=256							,     a__			: Optional[Any]=(512, 512, 512, 512, 1500)							,     a__			: Any=(5, 3, 3, 1, 1)							,     a__			: Dict=(1, 2, 3, 1, 1)							,     a__			: Optional[Any]=512							,     a__			: int=0							,     a__			: Tuple=1							,     a__			: int=2							,     a__			: int=False							,     a__			: int=3							,     a__			: Optional[int]=2							,     a__			: Any=3							,     a__			: Optional[Any]=None							,     a__			: List[Any]=None							,     **a__			: List[Any]							,     ):





         """simple docstring"""



         super().__init__(**__UpperCAmelCase							,     pad_token_id=__UpperCAmelCase							,     bos_token_id=__UpperCAmelCase							,     eos_token_id=__UpperCAmelCase )
         __snake_case							=  hidden_size
         __snake_case							=  feat_extract_norm
         __snake_case							=  feat_extract_activation
         __snake_case							=  list(__UpperCAmelCase )
         __snake_case							=  list(__UpperCAmelCase )
         __snake_case							=  list(__UpperCAmelCase )
         __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(__UpperCAmelCase )
         __snake_case							=  list(__UpperCAmelCase )
         __snake_case							=  list(__UpperCAmelCase )
         __snake_case							=  xvector_output_dim


      @property
      def   a					(self			: Optional[Any] ):





         """simple docstring"""



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




"""simple docstring"""




A_				:      Any           =			"0.21.0"

from .accelerator import Accelerator
from .big_modeling import (
    cpu_offload,
    cpu_offload_with_hook,
    disk_offload,
    dispatch_model,
    init_empty_weights,
    init_on_device,
    load_checkpoint_and_dispatch,
)
from .data_loader import skip_first_batches
from .launchers import debug_launcher, notebook_launcher
from .state import PartialState
from .utils import (
    DeepSpeedPlugin,
    DistributedDataParallelKwargs,
    DistributedType,
    FullyShardedDataParallelPlugin,
    GradScalerKwargs,
    InitProcessGroupKwargs,
    find_executable_batch_size,
    infer_auto_device_map,
    is_rich_available,
    load_checkpoint_in_model,
    synchronize_rng_states,
)


if is_rich_available():
						from .utils import rich


