





import math

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


_snake_case           =			logging.get_logger(__name__)

_snake_case           =			{
    """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json""",
    # See all Data2VecAudio models at https://huggingface.co/models?filter=data2vec-audio
}





class  lowerCAmelCase							(       __a ):
  __lowerCamelCase		=      """data2vec-audio"""







  def __init__(      self  :Optional[int]   ,							_lowercase  :int=32   ,							_lowercase  :str=7_68   ,							_lowercase  :Any=12   ,							_lowercase  :List[Any]=12   ,							_lowercase  :Optional[Any]=30_72   ,							_lowercase  :Optional[Any]="gelu"   ,							_lowercase  :int=0.1   ,							_lowercase  :Optional[Any]=0.1   ,							_lowercase  :Any=0.1   ,							_lowercase  :Any=0.0   ,							_lowercase  :Union[str, Any]=0.1   ,							_lowercase  :Dict=0.1   ,							_lowercase  :List[Any]=0.02   ,							_lowercase  :Dict=1e-5   ,							_lowercase  :Tuple="gelu"   ,							_lowercase  :str=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)   ,							_lowercase  :List[str]=(5, 2, 2, 2, 2, 2, 2)   ,							_lowercase  :Any=(10, 3, 3, 3, 3, 2, 2)   ,							_lowercase  :Optional[int]=False   ,							_lowercase  :Union[str, Any]=16   ,							_lowercase  :List[str]=19   ,							_lowercase  :Optional[Any]=5   ,							_lowercase  :int=0.05   ,							_lowercase  :List[Any]=10   ,							_lowercase  :Optional[int]=2   ,							_lowercase  :Optional[Any]=0.0   ,							_lowercase  :List[Any]=10   ,							_lowercase  :str=0   ,							_lowercase  :Any="sum"   ,							_lowercase  :List[str]=False   ,							_lowercase  :int=False   ,							_lowercase  :Any=2_56   ,							_lowercase  :List[str]=(5_12, 5_12, 5_12, 5_12, 15_00)   ,							_lowercase  :Union[str, Any]=(5, 3, 3, 1, 1)   ,							_lowercase  :Union[str, Any]=(1, 2, 3, 1, 1)   ,							_lowercase  :Tuple=5_12   ,							_lowercase  :Optional[Any]=0   ,							_lowercase  :Optional[int]=1   ,							_lowercase  :Dict=2   ,							_lowercase  :Any=False   ,							_lowercase  :List[Any]=3   ,							_lowercase  :Optional[int]=2   ,							_lowercase  :List[Any]=3   ,							_lowercase  :int=None   ,							**_lowercase  :List[str]   ,							):






     '''simple docstring'''





     super().__init__(**a__   ,							pad_token_id=a__   ,							bos_token_id=a__   ,							eos_token_id=a__ )
     lowercase__			       =  hidden_size
     lowercase__			       =  feat_extract_activation
     lowercase__			       =  list(a__ )
     lowercase__			       =  list(a__ )
     lowercase__			       =  list(a__ )
     lowercase__			       =  conv_bias
     lowercase__			       =  num_conv_pos_embeddings
     lowercase__			       =  num_conv_pos_embedding_groups
     lowercase__			       =  conv_pos_kernel_size
     lowercase__			       =  len(self.conv_dim )
     lowercase__			       =  num_hidden_layers
     lowercase__			       =  intermediate_size
     lowercase__			       =  hidden_act
     lowercase__			       =  num_attention_heads
     lowercase__			       =  hidden_dropout
     lowercase__			       =  attention_dropout
     lowercase__			       =  activation_dropout
     lowercase__			       =  feat_proj_dropout
     lowercase__			       =  final_dropout
     lowercase__			       =  layerdrop
     lowercase__			       =  layer_norm_eps
     lowercase__			       =  initializer_range
     lowercase__			       =  vocab_size
     lowercase__			       =  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
     lowercase__			       =  mask_time_prob
     lowercase__			       =  mask_time_length
     lowercase__			       =  mask_time_min_masks
     lowercase__			       =  mask_feature_prob
     lowercase__			       =  mask_feature_length
     lowercase__			       =  mask_feature_min_masks

     # ctc loss
     lowercase__			       =  ctc_loss_reduction
     lowercase__			       =  ctc_zero_infinity

     # adapter
     lowercase__			       =  add_adapter
     lowercase__			       =  adapter_kernel_size
     lowercase__			       =  adapter_stride
     lowercase__			       =  num_adapter_layers
     lowercase__			       =  output_hidden_size or hidden_size

     # SequenceClassification-specific parameter. Feel free to ignore for other classes.
     lowercase__			       =  classifier_proj_size

     # XVector-specific parameters. Feel free to ignore for other classes.
     lowercase__			       =  list(a__ )
     lowercase__			       =  list(a__ )
     lowercase__			       =  list(a__ )
     lowercase__			       =  xvector_output_dim







  @property
  def   UpperCAmelCase					(      self  :Optional[int] ):






     '''simple docstring'''





     return math.prod(self.conv_stride )













from abc import ABC, abstractmethod
from typing import Optional, Union

from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit
from ..utils.typing import NestedDataStructureLike, PathLike





class  lowerCAmelCase							(       lowercase_ ):







  def __init__(      self  :str   ,							_lowercase  :Optional[NestedDataStructureLike[PathLike]] = None   ,							_lowercase  :Optional[NamedSplit] = None   ,							_lowercase  :Optional[Features] = None   ,							_lowercase  :str = None   ,							_lowercase  :bool = False   ,							_lowercase  :bool = False   ,							_lowercase  :Optional[int] = None   ,							**_lowercase  :Tuple   ,							):






     '''simple docstring'''





     lowercase__			       =  path_or_paths
     lowercase__			       =  split if split or isinstance(_lowercase   ,							_lowercase ) else "train"
     lowercase__			       =  features
     lowercase__			       =  cache_dir
     lowercase__			       =  keep_in_memory
     lowercase__			       =  streaming
     lowercase__			       =  num_proc
     lowercase__			       =  kwargs







  @abstractmethod
  def   UpperCAmelCase					(      self  :Any ):






     '''simple docstring'''





     pass





class  lowerCAmelCase							(       lowercase_ ):







  def __init__(      self  :List[Any]   ,							_lowercase  :Optional[Features] = None   ,							_lowercase  :str = None   ,							_lowercase  :bool = False   ,							_lowercase  :bool = False   ,							_lowercase  :Optional[int] = None   ,							**_lowercase  :Optional[int]   ,							):






     '''simple docstring'''





     lowercase__			       =  features
     lowercase__			       =  cache_dir
     lowercase__			       =  keep_in_memory
     lowercase__			       =  streaming
     lowercase__			       =  num_proc
     lowercase__			       =  kwargs







  @abstractmethod
  def   UpperCAmelCase					(      self  :int ):






     '''simple docstring'''





     pass






