




import math

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


UpperCamelCase__         =      logging.get_logger(__name__)

UpperCamelCase__         =      {
    """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       a__   ( snake_case__				):
						_a							:   Dict =   """data2vec-audio"""






						def __init__(       self		,      _A=3_2		,      _A=7_6_8		,      _A=1_2		,      _A=1_2		,      _A=3_0_7_2		,      _A="gelu"		,      _A=0.1		,      _A=0.1		,      _A=0.1		,      _A=0.0		,      _A=0.1		,      _A=0.1		,      _A=0.02		,      _A=1E-5		,      _A="gelu"		,      _A=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)		,      _A=(5, 2, 2, 2, 2, 2, 2)		,      _A=(1_0, 3, 3, 3, 3, 2, 2)		,      _A=False		,      _A=1_6		,      _A=1_9		,      _A=5		,      _A=0.05		,      _A=1_0		,      _A=2		,      _A=0.0		,      _A=1_0		,      _A=0		,      _A="sum"		,      _A=False		,      _A=False		,      _A=2_5_6		,      _A=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)		,      _A=(5, 3, 3, 1, 1)		,      _A=(1, 2, 3, 1, 1)		,      _A=5_1_2		,      _A=0		,      _A=1		,      _A=2		,      _A=False		,      _A=3		,      _A=2		,      _A=3		,      _A=None		,      **_A		,      ):




											"""simple docstring"""



											super().__init__(**_A		,      pad_token_id=_A		,      bos_token_id=_A		,      eos_token_id=_A      )
											__lowerCAmelCase           =       hidden_size
											__lowerCAmelCase           =       feat_extract_activation
											__lowerCAmelCase           =       list(_A      )
											__lowerCAmelCase           =       list(_A      )
											__lowerCAmelCase           =       list(_A      )
											__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(_A      )
											__lowerCAmelCase           =       list(_A      )
											__lowerCAmelCase           =       list(_A      )
											__lowerCAmelCase           =       xvector_output_dim






						@property
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											return math.prod(self.conv_stride      )










from sklearn.metrics import mean_squared_error

import datasets


UpperCamelCase__         =      """\
@article{scikit-learn,
 title={Scikit-learn: Machine Learning in {P}ython},
 author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.
         and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.
         and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and
         Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},
 journal={Journal of Machine Learning Research},
 volume={12},
 pages={2825--2830},
 year={2011}
}
"""

UpperCamelCase__         =      """\
Mean Squared Error(MSE) is the average of the square of difference between the predicted
and actual values.
"""


UpperCamelCase__         =      """
Args:
    predictions: array-like of shape (n_samples,) or (n_samples, n_outputs)
        Estimated target values.
    references: array-like of shape (n_samples,) or (n_samples, n_outputs)
        Ground truth (correct) target values.
    sample_weight: array-like of shape (n_samples,), default=None
        Sample weights.
    multioutput: {\"raw_values\", \"uniform_average\"} or array-like of shape (n_outputs,), default=\"uniform_average\"
        Defines aggregating of multiple output values. Array-like value defines weights used to average errors.

        \"raw_values\" : Returns a full set of errors in case of multioutput input.

        \"uniform_average\" : Errors of all outputs are averaged with uniform weight.

    squared : bool, default=True
        If True returns MSE value, if False returns RMSE (Root Mean Squared Error) value.

Returns:
    mse : mean squared error.
Examples:

    >>> mse_metric = datasets.load_metric(\"mse\")
    >>> predictions = [2.5, 0.0, 2, 8]
    >>> references = [3, -0.5, 2, 7]
    >>> results = mse_metric.compute(predictions=predictions, references=references)
    >>> print(results)
    {'mse': 0.375}
    >>> rmse_result = mse_metric.compute(predictions=predictions, references=references, squared=False)
    >>> print(rmse_result)
    {'mse': 0.6123724356957945}

    If you're using multi-dimensional lists, then set the config as follows :

    >>> mse_metric = datasets.load_metric(\"mse\", \"multilist\")
    >>> predictions = [[0.5, 1], [-1, 1], [7, -6]]
    >>> references = [[0, 2], [-1, 2], [8, -5]]
    >>> results = mse_metric.compute(predictions=predictions, references=references)
    >>> print(results)
    {'mse': 0.7083333333333334}
    >>> results = mse_metric.compute(predictions=predictions, references=references, multioutput='raw_values')
    >>> print(results) # doctest: +NORMALIZE_WHITESPACE
    {'mse': array([0.41666667, 1. ])}
"""
@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION			,    _KWARGS_DESCRIPTION				)
class       a__   ( datasets.Metric				):






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											return datasets.MetricInfo(
											    description=_DESCRIPTION		,      citation=_CITATION		,      inputs_description=_KWARGS_DESCRIPTION		,      features=datasets.Features(self._get_feature_types()      )		,      reference_urls=[
											        "https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_error.html"
											    ]		,      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											if self.config_name == "multilist":
																return {
																    "predictions": datasets.Sequence(datasets.Value("float"      )      ),
																    "references": datasets.Sequence(datasets.Value("float"      )      ),
																}
											else:
																return {
																    "predictions": datasets.Value("float"      ),
																    "references": datasets.Value("float"      ),
																}






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A		,      _A=None		,      _A="uniform_average"		,      _A=True      ):




											"""simple docstring"""



											__lowerCAmelCase           =	mean_squared_error(
											    _A		,      _A		,      sample_weight=_A		,      multioutput=_A		,      squared=_A      )

											return {"mse": mse}




