






import functools
import operator

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


lowerCamelCase					    =	logging.get_logger(__name__)

lowerCamelCase					    =	{
    '''facebook/hubert-base-ls960''': '''https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json''',
    # See all Hubert models at https://huggingface.co/models?filter=hubert
}

class        snake_case_				(							lowercase_   ):







   """simple docstring"""



   __lowerCAmelCase  =    """hubert"""

   def __init__(     self:						Optional[Any] ,							snake_case__:						Optional[int]=32 ,							snake_case__:						Tuple=768 ,							snake_case__:						str=12 ,							snake_case__:						Dict=12 ,							snake_case__:						str=3_072 ,							snake_case__:						Dict="gelu" ,							snake_case__:						List[Any]=0.1 ,							snake_case__:						int=0.1 ,							snake_case__:						Union[str, Any]=0.1 ,							snake_case__:						Tuple=True ,							snake_case__:						int=0.0 ,							snake_case__:						Dict=0.1 ,							snake_case__:						Optional[int]=0.1 ,							snake_case__:						Optional[int]=0.02 ,							snake_case__:						List[str]=1E-5 ,							snake_case__:						Union[str, Any]="group" ,							snake_case__:						Union[str, Any]="gelu" ,							snake_case__:						List[str]=(512, 512, 512, 512, 512, 512, 512) ,							snake_case__:						Tuple=(5, 2, 2, 2, 2, 2, 2) ,							snake_case__:						Tuple=(10, 3, 3, 3, 3, 2, 2) ,							snake_case__:						Any=False ,							snake_case__:						Union[str, Any]=128 ,							snake_case__:						str=16 ,							snake_case__:						Optional[Any]=False ,							snake_case__:						int=True ,							snake_case__:						Optional[Any]=0.05 ,							snake_case__:						int=10 ,							snake_case__:						List[str]=2 ,							snake_case__:						str=0.0 ,							snake_case__:						List[str]=10 ,							snake_case__:						int=0 ,							snake_case__:						Optional[Any]="sum" ,							snake_case__:						Tuple=False ,							snake_case__:						Optional[Any]=False ,							snake_case__:						List[str]=256 ,							snake_case__:						int=0 ,							snake_case__:						int=1 ,							snake_case__:						Optional[Any]=2 ,							**snake_case__:						int ,							)	->		List[str]:


       """simple docstring"""



       super().__init__(**snake_case__ ,							pad_token_id=snake_case__ ,							bos_token_id=snake_case__ ,							eos_token_id=snake_case__						)
       _lowercase     			=						hidden_size
       _lowercase     			=						feat_extract_norm
       _lowercase     			=						feat_extract_activation
       _lowercase     			=						list(snake_case__						)
       _lowercase     			=						list(snake_case__						)
       _lowercase     			=						list(snake_case__						)
       _lowercase     			=						conv_bias
       _lowercase     			=						num_conv_pos_embeddings
       _lowercase     			=						num_conv_pos_embedding_groups
       _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_layer_norm
       _lowercase     			=						feat_proj_dropout
       _lowercase     			=						final_dropout
       _lowercase     			=						layerdrop
       _lowercase     			=						layer_norm_eps
       _lowercase     			=						initializer_range
       _lowercase     			=						vocab_size
       _lowercase     			=						do_stable_layer_norm
       _lowercase     			=						use_weighted_layer_sum
       _lowercase     			=						classifier_proj_size

       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     			=						apply_spec_augment
       _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

   @property
   def       SCREAMING_SNAKE_CASE__					(     self:						int						)	->		Union[str, Any]:


       """simple docstring"""



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








from __future__ import annotations

from enum import Enum, unique
from typing import TypeVar

# Create a generic variable that can be 'Enum', or any subclass.
lowerCamelCase					    =	TypeVar('''T''', bound='''Enum''')

@unique
class        snake_case_				(							lowercase_   ):







   """simple docstring"""



   __lowerCAmelCase  =    80
   __lowerCAmelCase  =    70
   __lowerCAmelCase  =    60
   __lowerCAmelCase  =    50
   __lowerCAmelCase  =    40
   __lowerCAmelCase  =    30
   __lowerCAmelCase  =    20
   __lowerCAmelCase  =    10






@unique
class        snake_case_				(							lowercase_   ):







   """simple docstring"""



   __lowerCAmelCase  =    24
   __lowerCAmelCase  =    21
   __lowerCAmelCase  =    18
   __lowerCAmelCase  =    15
   __lowerCAmelCase  =    12
   __lowerCAmelCase  =    9
   __lowerCAmelCase  =    6
   __lowerCAmelCase  =    3
   __lowerCAmelCase  =    2
   __lowerCAmelCase  =    1
   __lowerCAmelCase  =    -1
   __lowerCAmelCase  =    -2
   __lowerCAmelCase  =    -3
   __lowerCAmelCase  =    -6
   __lowerCAmelCase  =    -9
   __lowerCAmelCase  =    -12
   __lowerCAmelCase  =    -15
   __lowerCAmelCase  =    -18
   __lowerCAmelCase  =    -21
   __lowerCAmelCase  =    -24

   @classmethod
   def       SCREAMING_SNAKE_CASE__					(     cls:						type[T]						)	->		dict:


       """simple docstring"""



       return {unit.name: unit.value for unit in cls if unit.value > 0}

   @classmethod
   def       SCREAMING_SNAKE_CASE__					(     cls:						type[T]						)	->		dict:


       """simple docstring"""



       return {unit.name: unit.value for unit in cls if unit.value < 0}






def 							UpperCAmelCase   ( _lowercase   ):


    '''simple docstring'''



    _lowercase     			=						SIUnit.get_positive() if value > 0 else SIUnit.get_negative()
    for name_prefix, value_prefix in prefixes.items():
        _lowercase     			=						value / (10**value_prefix)
        if numerical_part > 1:
            return f'''{numerical_part!s} {name_prefix}'''
    return str(_lowercase   )
def 							UpperCAmelCase   ( _lowercase   ):


    '''simple docstring'''



    for prefix in BinaryUnit:
        _lowercase     			=						value / (2**prefix.value)
        if numerical_part > 1:
            return f'''{numerical_part!s} {prefix.name}'''
    return str(_lowercase   )


if __name__ == "__main__":
   import doctest

   doctest.testmod()
