import functools
import operator

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


UpperCamelCase    				=		logging.get_logger(__name__)

UpperCamelCase    				=		{
    '''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_			(						__A			):
   __A      :						int   =							"hubert"






   def __init__( self							:	int      ,		lowercase_							:	Union[str, Any]=32      ,		lowercase_							:	List[Any]=7_68      ,		lowercase_							:	Dict=12      ,		lowercase_							:	Optional[int]=12      ,		lowercase_							:	Any=30_72      ,		lowercase_							:	int="gelu"      ,		lowercase_							:	Optional[Any]=0.1      ,		lowercase_							:	str=0.1      ,		lowercase_							:	Dict=0.1      ,		lowercase_							:	Dict=True      ,		lowercase_							:	int=0.0      ,		lowercase_							:	List[Any]=0.1      ,		lowercase_							:	Tuple=0.1      ,		lowercase_							:	int=0.02      ,		lowercase_							:	int=1E-5      ,		lowercase_							:	int="group"      ,		lowercase_							:	Optional[int]="gelu"      ,		lowercase_							:	Dict=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)      ,		lowercase_							:	Union[str, Any]=(5, 2, 2, 2, 2, 2, 2)      ,		lowercase_							:	Optional[int]=(10, 3, 3, 3, 3, 2, 2)      ,		lowercase_							:	str=False      ,		lowercase_							:	List[str]=1_28      ,		lowercase_							:	int=16      ,		lowercase_							:	Optional[int]=False      ,		lowercase_							:	Optional[int]=True      ,		lowercase_							:	str=0.05      ,		lowercase_							:	Any=10      ,		lowercase_							:	Optional[int]=2      ,		lowercase_							:	Union[str, Any]=0.0      ,		lowercase_							:	Dict=10      ,		lowercase_							:	List[str]=0      ,		lowercase_							:	Union[str, Any]="sum"      ,		lowercase_							:	Optional[int]=False      ,		lowercase_							:	Dict=False      ,		lowercase_							:	Optional[int]=2_56      ,		lowercase_							:	Optional[int]=0      ,		lowercase_							:	List[str]=1      ,		lowercase_							:	List[str]=2      ,		**lowercase_							:	int      ,		)   ->		Union[str, Any]:
       super().__init__(**lowercase_      ,		pad_token_id=lowercase_      ,		bos_token_id=lowercase_      ,		eos_token_id=lowercase_    )
       lowercase__					:  Optional[int]          =							hidden_size
       lowercase__					:  Optional[int]          =							feat_extract_norm
       lowercase__					:  Any          =							feat_extract_activation
       lowercase__					:  List[Any]          =							list(lowercase_    )
       lowercase__					:  int          =							list(lowercase_    )
       lowercase__					:  Union[str, Any]          =							list(lowercase_    )
       lowercase__					:  Union[str, Any]          =							conv_bias
       lowercase__					:  Tuple          =							num_conv_pos_embeddings
       lowercase__					:  List[Any]          =							num_conv_pos_embedding_groups
       lowercase__					:  List[Any]          =							len(self.conv_dim    )
       lowercase__					:  Any          =							num_hidden_layers
       lowercase__					:  Tuple          =							intermediate_size
       lowercase__					:  int          =							hidden_act
       lowercase__					:  Optional[int]          =							num_attention_heads
       lowercase__					:  List[str]          =							hidden_dropout
       lowercase__					:  Optional[Any]          =							attention_dropout
       lowercase__					:  Optional[int]          =							activation_dropout
       lowercase__					:  List[str]          =							feat_proj_layer_norm
       lowercase__					:  int          =							feat_proj_dropout
       lowercase__					:  Union[str, Any]          =							final_dropout
       lowercase__					:  Union[str, Any]          =							layerdrop
       lowercase__					:  Optional[Any]          =							layer_norm_eps
       lowercase__					:  str          =							initializer_range
       lowercase__					:  List[str]          =							vocab_size
       lowercase__					:  Dict          =							do_stable_layer_norm
       lowercase__					:  Dict          =							use_weighted_layer_sum
       lowercase__					:  Optional[int]          =							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__					:  str          =							apply_spec_augment
       lowercase__					:  List[Any]          =							mask_time_prob
       lowercase__					:  Dict          =							mask_time_length
       lowercase__					:  List[str]          =							mask_time_min_masks
       lowercase__					:  Any          =							mask_feature_prob
       lowercase__					:  Optional[int]          =							mask_feature_length
       lowercase__					:  Optional[Any]          =							mask_feature_min_masks

       # ctc loss
       lowercase__					:  Optional[Any]          =							ctc_loss_reduction
       lowercase__					:  List[Any]          =							ctc_zero_infinity







   @property
   def  __UpperCamelCase	( self							:	List[str]    )   ->		Optional[int]:
       return functools.reduce(operator.mul      ,		self.conv_stride      ,		1    )




def      lowercase_							(     _lowerCamelCase				:			str):
    lowercase__					:  Union[str, Any]          =							0
    for plain_chr in plain_text:
        lowercase__					:  Union[str, Any]          =							(
            ord(_lowerCamelCase) + (hash_value << 6) + (hash_value << 16) - hash_value
        )
    return hash_value



