






'''simple docstring'''



from collections.abc import Iterator, MutableMapping
from dataclasses import dataclass
from typing import Generic, TypeVar

SCREAMING_SNAKE_CASE							=						TypeVar('KEY')
SCREAMING_SNAKE_CASE							=						TypeVar('VAL')
@dataclass(frozen=__A					,							slots=__A					)
class UpperCAmelCase_       (     Generic[KEY, VAL]					):




      """simple docstring"""




      UpperCamelCase_             =      42
      UpperCamelCase_             =      42





class UpperCAmelCase_       (     _Item					):




      """simple docstring"""




      def __init__(			self      :		Dict		)	->	None:


       '''simple docstring'''

       super().__init__(UpperCAmelCase  ,   UpperCAmelCase		)






      def __bool__(			self      :		Any		)	->	bool:


       '''simple docstring'''

       return False





SCREAMING_SNAKE_CASE							=						_DeletedItem()
class UpperCAmelCase_       (     MutableMapping[KEY, VAL]					):




      """simple docstring"""




      def __init__(			self      :		str  ,   UpperCAmelCase      :		int = 8  ,   UpperCAmelCase      :		float = 0.7_5		)	->	None:


       '''simple docstring'''

       lowercase       : Dict						=initial_block_size
       lowercase       : list[_Item | None]						=[None] * initial_block_size
       assert 0.0 < capacity_factor < 1.0
       lowercase       : Tuple						=capacity_factor
       lowercase       : Union[str, Any]						=0






      def 					A__   (			self      :		List[str]  ,   UpperCAmelCase      :		KEY		)	->	int:


       '''simple docstring'''

       return hash(UpperCAmelCase		) % len(self._buckets		)






      def 					A__   (			self      :		Optional[Any]  ,   UpperCAmelCase      :		int		)	->	int:


       '''simple docstring'''

       return (ind + 1) % len(self._buckets		)






      def 					A__   (			self      :		List[Any]  ,   UpperCAmelCase      :		int  ,   UpperCAmelCase      :		KEY  ,   UpperCAmelCase      :		VAL		)	->	bool:


       '''simple docstring'''

       lowercase       : Union[str, Any]						=self._buckets[ind]
       if not stored:
        lowercase       : List[Any]						=_Item(UpperCAmelCase  ,   UpperCAmelCase		)
        self._len += 1
        return True
       elif stored.key == key:
        lowercase       : List[Any]						=_Item(UpperCAmelCase  ,   UpperCAmelCase		)
        return True
       else:
        return False






      def 					A__   (			self      :		List[Any]		)	->	bool:


       '''simple docstring'''

       lowercase       : Optional[int]						=len(self._buckets		) * self._capacity_factor
       return len(self		) >= int(UpperCAmelCase		)






      def 					A__   (			self      :		Union[str, Any]		)	->	bool:


       '''simple docstring'''

       if len(self._buckets		) <= self._initial_block_size:
        return False
       lowercase       : List[str]						=len(self._buckets		) * self._capacity_factor / 2
       return len(self		) < limit






      def 					A__   (			self      :		List[Any]  ,   UpperCAmelCase      :		int		)	->	None:


       '''simple docstring'''

       lowercase       : str						=self._buckets
       lowercase       : Tuple						=[None] * new_size
       lowercase       : Tuple						=0
       for item in old_buckets:
        if item:
         self._add_item(item.key  ,   item.val		)






      def 					A__   (			self      :		Optional[int]		)	->	None:


       '''simple docstring'''

       self._resize(len(self._buckets		) * 2		)






      def 					A__   (			self      :		List[str]		)	->	None:


       '''simple docstring'''

       self._resize(len(self._buckets		) // 2		)






      def 					A__   (			self      :		List[str]  ,   UpperCAmelCase      :		KEY		)	->	Iterator[int]:


       '''simple docstring'''

       lowercase       : int						=self._get_bucket_index(UpperCAmelCase		)
       for _ in range(len(self._buckets		)		):
        yield ind
        lowercase       : int						=self._get_next_ind(UpperCAmelCase		)






      def 					A__   (			self      :		Any  ,   UpperCAmelCase      :		KEY  ,   UpperCAmelCase      :		VAL		)	->	None:


       '''simple docstring'''

       for ind in self._iterate_buckets(UpperCAmelCase		):
        if self._try_set(UpperCAmelCase  ,   UpperCAmelCase  ,   UpperCAmelCase		):
         break






      def __setitem__(			self      :		Optional[int]  ,   UpperCAmelCase      :		KEY  ,   UpperCAmelCase      :		VAL		)	->	None:


       '''simple docstring'''

       if self._is_full():
        self._size_up()

       self._add_item(UpperCAmelCase  ,   UpperCAmelCase		)






      def __delitem__(			self      :		List[str]  ,   UpperCAmelCase      :		KEY		)	->	None:


       '''simple docstring'''

       for ind in self._iterate_buckets(UpperCAmelCase		):
        lowercase       : Optional[int]						=self._buckets[ind]
        if item is None:
         raise KeyError(UpperCAmelCase		)
        if item is _deleted:
         continue
        if item.key == key:
         lowercase       : Optional[int]						=_deleted
         self._len -= 1
         break
       if self._is_sparse():
        self._size_down()






      def __getitem__(			self      :		Any  ,   UpperCAmelCase      :		KEY		)	->	VAL:


       '''simple docstring'''

       for ind in self._iterate_buckets(UpperCAmelCase		):
        lowercase       : str						=self._buckets[ind]
        if item is None:
         break
        if item is _deleted:
         continue
        if item.key == key:
         return item.val
       raise KeyError(UpperCAmelCase		)






      def __len__(			self      :		str		)	->	int:


       '''simple docstring'''

       return self._len






      def __iter__(			self      :		Optional[Any]		)	->	Iterator[KEY]:


       '''simple docstring'''

       yield from (item.key for item in self._buckets if item)






      def __repr__(			self      :		List[Any]		)	->	str:


       '''simple docstring'''

       lowercase       : str						=''' ,'''.join(
           f'{item.key}: {item.val}' for item in self._buckets if item		)
       return f'HashMap({val_string})'










'''simple docstring'''


import math

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


_SCREAMING_SNAKE_CASE									=				logging.get_logger(__name__)

_SCREAMING_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_		(		__magic_name__		):
 __lowerCamelCase    :				List[Any]								=       "data2vec-audio"




 def __init__(						self      ,  _lowerCAmelCase=32      ,  _lowerCAmelCase=768      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=3072      ,  _lowerCAmelCase="gelu"      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.0      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.02      ,  _lowerCAmelCase=1E-5      ,  _lowerCAmelCase="gelu"      ,  _lowerCAmelCase=(512, 512, 512, 512, 512, 512, 512)      ,  _lowerCAmelCase=(5, 2, 2, 2, 2, 2, 2)      ,  _lowerCAmelCase=(10, 3, 3, 3, 3, 2, 2)      ,  _lowerCAmelCase=False      ,  _lowerCAmelCase=16      ,  _lowerCAmelCase=19      ,  _lowerCAmelCase=5      ,  _lowerCAmelCase=0.05      ,  _lowerCAmelCase=10      ,  _lowerCAmelCase=2      ,  _lowerCAmelCase=0.0      ,  _lowerCAmelCase=10      ,  _lowerCAmelCase=0      ,  _lowerCAmelCase="sum"      ,  _lowerCAmelCase=False      ,  _lowerCAmelCase=False      ,  _lowerCAmelCase=256      ,  _lowerCAmelCase=(512, 512, 512, 512, 1500)      ,  _lowerCAmelCase=(5, 3, 3, 1, 1)      ,  _lowerCAmelCase=(1, 2, 3, 1, 1)      ,  _lowerCAmelCase=512      ,  _lowerCAmelCase=0      ,  _lowerCAmelCase=1      ,  _lowerCAmelCase=2      ,  _lowerCAmelCase=False      ,  _lowerCAmelCase=3      ,  _lowerCAmelCase=2      ,  _lowerCAmelCase=3      ,  _lowerCAmelCase=None      ,  **_lowerCAmelCase      ,  )     ->				Dict:
     super().__init__(**_lowerCAmelCase      ,  pad_token_id=_lowerCAmelCase      ,  bos_token_id=_lowerCAmelCase      ,  eos_token_id=_lowerCAmelCase		)
     _lowerCAmelCase						      =   hidden_size
     _lowerCAmelCase						      =   feat_extract_activation
     _lowerCAmelCase						      =   list(_lowerCAmelCase		)
     _lowerCAmelCase						      =   list(_lowerCAmelCase		)
     _lowerCAmelCase						      =   list(_lowerCAmelCase		)
     _lowerCAmelCase						      =   conv_bias
     _lowerCAmelCase						      =   num_conv_pos_embeddings
     _lowerCAmelCase						      =   num_conv_pos_embedding_groups
     _lowerCAmelCase						      =   conv_pos_kernel_size
     _lowerCAmelCase						      =   len(self.conv_dim		)
     _lowerCAmelCase						      =   num_hidden_layers
     _lowerCAmelCase						      =   intermediate_size
     _lowerCAmelCase						      =   hidden_act
     _lowerCAmelCase						      =   num_attention_heads
     _lowerCAmelCase						      =   hidden_dropout
     _lowerCAmelCase						      =   attention_dropout
     _lowerCAmelCase						      =   activation_dropout
     _lowerCAmelCase						      =   feat_proj_dropout
     _lowerCAmelCase						      =   final_dropout
     _lowerCAmelCase						      =   layerdrop
     _lowerCAmelCase						      =   layer_norm_eps
     _lowerCAmelCase						      =   initializer_range
     _lowerCAmelCase						      =   vocab_size
     _lowerCAmelCase						      =   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						      =   mask_time_prob
     _lowerCAmelCase						      =   mask_time_length
     _lowerCAmelCase						      =   mask_time_min_masks
     _lowerCAmelCase						      =   mask_feature_prob
     _lowerCAmelCase						      =   mask_feature_length
     _lowerCAmelCase						      =   mask_feature_min_masks

     # ctc loss
     _lowerCAmelCase						      =   ctc_loss_reduction
     _lowerCAmelCase						      =   ctc_zero_infinity

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

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

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





 @property
 def 				_snake_case (						self		)     ->				str:
     return math.prod(self.conv_stride		)


