

'''simple docstring'''



import math

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


UpperCAmelCase :       Optional[Any]			   =     logging.get_logger(__name__)

UpperCAmelCase :       Tuple			   =     {
    '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					):



 """simple docstring"""



 lowerCAmelCase__  					=      "data2vec-audio"
 def __init__(		self					:       Optional[Any]					,							__SCREAMING_SNAKE_CASE					:       Dict=32					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=768					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=12					,							__SCREAMING_SNAKE_CASE					:       Any=12					,							__SCREAMING_SNAKE_CASE					:       Union[str, Any]=3_072					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]="gelu"					,							__SCREAMING_SNAKE_CASE					:       Tuple=0.1					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=0.1					,							__SCREAMING_SNAKE_CASE					:       Dict=0.1					,							__SCREAMING_SNAKE_CASE					:       str=0.0					,							__SCREAMING_SNAKE_CASE					:       List[str]=0.1					,							__SCREAMING_SNAKE_CASE					:       List[str]=0.1					,							__SCREAMING_SNAKE_CASE					:       List[str]=0.02					,							__SCREAMING_SNAKE_CASE					:       List[str]=1E-5					,							__SCREAMING_SNAKE_CASE					:       str="gelu"					,							__SCREAMING_SNAKE_CASE					:       Union[str, Any]=(512, 512, 512, 512, 512, 512, 512)					,							__SCREAMING_SNAKE_CASE					:       List[Any]=(5, 2, 2, 2, 2, 2, 2)					,							__SCREAMING_SNAKE_CASE					:       Union[str, Any]=(10, 3, 3, 3, 3, 2, 2)					,							__SCREAMING_SNAKE_CASE					:       Union[str, Any]=False					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=16					,							__SCREAMING_SNAKE_CASE					:       Union[str, Any]=19					,							__SCREAMING_SNAKE_CASE					:       Any=5					,							__SCREAMING_SNAKE_CASE					:       int=0.05					,							__SCREAMING_SNAKE_CASE					:       Dict=10					,							__SCREAMING_SNAKE_CASE					:       Dict=2					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=0.0					,							__SCREAMING_SNAKE_CASE					:       Tuple=10					,							__SCREAMING_SNAKE_CASE					:       List[str]=0					,							__SCREAMING_SNAKE_CASE					:       List[str]="sum"					,							__SCREAMING_SNAKE_CASE					:       int=False					,							__SCREAMING_SNAKE_CASE					:       Tuple=False					,							__SCREAMING_SNAKE_CASE					:       List[Any]=256					,							__SCREAMING_SNAKE_CASE					:       Dict=(512, 512, 512, 512, 1_500)					,							__SCREAMING_SNAKE_CASE					:       str=(5, 3, 3, 1, 1)					,							__SCREAMING_SNAKE_CASE					:       Optional[int]=(1, 2, 3, 1, 1)					,							__SCREAMING_SNAKE_CASE					:       Any=512					,							__SCREAMING_SNAKE_CASE					:       List[Any]=0					,							__SCREAMING_SNAKE_CASE					:       List[str]=1					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=2					,							__SCREAMING_SNAKE_CASE					:       Any=False					,							__SCREAMING_SNAKE_CASE					:       List[str]=3					,							__SCREAMING_SNAKE_CASE					:       Optional[int]=2					,							__SCREAMING_SNAKE_CASE					:       Dict=3					,							__SCREAMING_SNAKE_CASE					:       Optional[Any]=None					,							**__SCREAMING_SNAKE_CASE					:       Optional[Any]					,							)  -> str:


      """simple docstring"""




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

      # ctc loss
      __SCREAMING_SNAKE_CASE     =      ctc_loss_reduction
      __SCREAMING_SNAKE_CASE     =      ctc_zero_infinity

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

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

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


 @property
 def       UpperCAmelCase__		(		self					:       int			)  -> Any:


      """simple docstring"""




      return math.prod(self.conv_stride			)









'''simple docstring'''



from __future__ import annotations







def    a__       (  a__      ,    a__      ,    a__						):




     """simple docstring"""


     if len(a__						) == 0:
          raise ValueError("""find_max() arg is an empty sequence"""						)
     if (
         left >= len(a__						)
         or left < -len(a__						)
         or right >= len(a__						)
         or right < -len(a__						)
     ):
          raise IndexError("""list index out of range"""						)
     if left == right:
          return nums[left]
     __SCREAMING_SNAKE_CASE     =      (left + right) >> 1  # the middle
     __SCREAMING_SNAKE_CASE     =      find_max(a__      ,    a__      ,    a__						)  # find max in range[left, mid]
     __SCREAMING_SNAKE_CASE     =      find_max(a__      ,    mid + 1      ,    a__						)  # find max in range[mid + 1, right]

     return left_max if left_max >= right_max else right_max


if __name__ == "__main__":
  import doctest

  doctest.testmod(verbose=True)






