




'''simple docstring'''





import numpy as np





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    _a				:							Tuple							       =      np.array(UpperCAmelCase_						)
    _a				:							List[Any]							       =      np.array(UpperCAmelCase_						)

    _a				:							str							       =      abs(predict - actual						)
    _a				:							Union[str, Any]							       =      difference.mean()

    return score





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    _a				:							Optional[int]							       =      np.array(UpperCAmelCase_						)
    _a				:							Tuple							       =      np.array(UpperCAmelCase_						)

    _a				:							List[Any]							       =      predict - actual
    _a				:							Any							       =      np.square(UpperCAmelCase_						)

    _a				:							Any							       =      square_diff.mean()
    return score





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    _a				:							Tuple							       =      np.array(UpperCAmelCase_						)
    _a				:							int							       =      np.array(UpperCAmelCase_						)

    _a				:							Dict							       =      predict - actual
    _a				:							Dict							       =      np.square(UpperCAmelCase_						)
    _a				:							Optional[int]							       =      square_diff.mean()
    _a				:							int							       =      np.sqrt(UpperCAmelCase_						)
    return score





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    _a				:							Union[str, Any]							       =      np.array(UpperCAmelCase_						)
    _a				:							Optional[int]							       =      np.array(UpperCAmelCase_						)

    _a				:							Dict							       =      np.log(predict + 1						)
    _a				:							Dict							       =      np.log(actual + 1						)

    _a				:							int							       =      log_predict - log_actual
    _a				:							Union[str, Any]							       =      np.square(UpperCAmelCase_						)
    _a				:							Dict							       =      square_diff.mean()

    _a				:							int							       =      np.sqrt(UpperCAmelCase_						)

    return score





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    _a				:							List[str]							       =      np.array(UpperCAmelCase_						)
    _a				:							List[Any]							       =      np.array(UpperCAmelCase_						)

    _a				:							List[Any]							       =      predict - actual
    _a				:							Optional[int]							       =      np.sum(UpperCAmelCase_						) / len(UpperCAmelCase_						)
    _a				:							str							       =      np.sum(UpperCAmelCase_						) / len(UpperCAmelCase_						)
    # print(numerator, denumerator)
    _a				:							str							       =      float(UpperCAmelCase_						) / denumerator * 100

    return score





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    return np.mean(np.array(UpperCAmelCase_						) == np.array(UpperCAmelCase_						)						)








'''simple docstring'''





import functools
import operator

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


a		:	Dict       =      logging.get_logger(__name__)

a		:	Optional[int]       =      {
    '''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      UpperCamelCase       (	snake_case__       ):
  a     :int          =					'hubert'



  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=True		,     __lowerCAmelCase=0.0		,     __lowerCAmelCase=0.1		,     __lowerCAmelCase=0.1		,     __lowerCAmelCase=0.02		,     __lowerCAmelCase=1e-5		,     __lowerCAmelCase="group"		,     __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=128		,     __lowerCAmelCase=16		,     __lowerCAmelCase=False		,     __lowerCAmelCase=True		,     __lowerCAmelCase=0.05		,     __lowerCAmelCase=10		,     __lowerCAmelCase=2		,     __lowerCAmelCase=0.0		,     __lowerCAmelCase=10		,     __lowerCAmelCase=0		,     __lowerCAmelCase="sum"		,     __lowerCAmelCase=False		,     __lowerCAmelCase=False		,     __lowerCAmelCase=256		,     __lowerCAmelCase=0		,     __lowerCAmelCase=1		,     __lowerCAmelCase=2		,     **__lowerCAmelCase		,     ):







      '''simple docstring'''


      super().__init__(**__lowerCAmelCase		,     pad_token_id=__lowerCAmelCase		,     bos_token_id=__lowerCAmelCase		,     eos_token_id=__lowerCAmelCase )
      _a				:							List[Any]							       =      hidden_size
      _a				:							Union[str, Any]							       =      feat_extract_norm
      _a				:							Any							       =      feat_extract_activation
      _a				:							Tuple							       =      list(__lowerCAmelCase )
      _a				:							List[Any]							       =      list(__lowerCAmelCase )
      _a				:							Any							       =      list(__lowerCAmelCase )
      _a				:							Optional[int]							       =      conv_bias
      _a				:							Tuple							       =      num_conv_pos_embeddings
      _a				:							Optional[int]							       =      num_conv_pos_embedding_groups
      _a				:							Tuple							       =      len(self.conv_dim )
      _a				:							int							       =      num_hidden_layers
      _a				:							Optional[Any]							       =      intermediate_size
      _a				:							Dict							       =      hidden_act
      _a				:							Tuple							       =      num_attention_heads
      _a				:							Tuple							       =      hidden_dropout
      _a				:							str							       =      attention_dropout
      _a				:							Union[str, Any]							       =      activation_dropout
      _a				:							int							       =      feat_proj_layer_norm
      _a				:							List[Any]							       =      feat_proj_dropout
      _a				:							Any							       =      final_dropout
      _a				:							Dict							       =      layerdrop
      _a				:							List[str]							       =      layer_norm_eps
      _a				:							Any							       =      initializer_range
      _a				:							List[str]							       =      vocab_size
      _a				:							int							       =      do_stable_layer_norm
      _a				:							str							       =      use_weighted_layer_sum
      _a				:							Optional[Any]							       =      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
      _a				:							str							       =      apply_spec_augment
      _a				:							List[Any]							       =      mask_time_prob
      _a				:							List[Any]							       =      mask_time_length
      _a				:							List[Any]							       =      mask_time_min_masks
      _a				:							Union[str, Any]							       =      mask_feature_prob
      _a				:							str							       =      mask_feature_length
      _a				:							Any							       =      mask_feature_min_masks

      # ctc loss
      _a				:							Tuple							       =      ctc_loss_reduction
      _a				:							Optional[int]							       =      ctc_zero_infinity



  @property
  def     a_							(			self ):







      '''simple docstring'''


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


