
import functools
import operator

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


UpperCamelCase__      :		Dict       							=  logging.get_logger(__name__)

UpperCamelCase__      :		List[str]       							=  {
    "asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json",
    # See all SEW models at https://huggingface.co/models?filter=sew
}

class    _a				(_lowerCamelCase):





       """simple docstring"""




       SCREAMING_SNAKE_CASE      =  'sew'






       def __init__(							self       ,							A__=32       ,							A__=7_68       ,							A__=12       ,							A__=12       ,							A__=30_72       ,							A__=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__="group"       ,							A__="gelu"       ,							A__=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)       ,							A__=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)       ,							A__=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)       ,							A__=False       ,							A__=1_28       ,							A__=16       ,							A__=True       ,							A__=0.05       ,							A__=10       ,							A__=2       ,							A__=0.0       ,							A__=10       ,							A__=0       ,							A__="mean"       ,							A__=False       ,							A__=False       ,							A__=2_56       ,							A__=0       ,							A__=1       ,							A__=2       ,							**A__       ,							)    ->			List[Any]:
          super().__init__(**A__       ,							pad_token_id=A__       ,							bos_token_id=A__       ,							eos_token_id=A__      )
          _SCREAMING_SNAKE_CASE      =				hidden_size
          _SCREAMING_SNAKE_CASE      =				feat_extract_norm
          _SCREAMING_SNAKE_CASE      =				feat_extract_activation
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				conv_bias
          _SCREAMING_SNAKE_CASE      =				num_conv_pos_embeddings
          _SCREAMING_SNAKE_CASE      =				num_conv_pos_embedding_groups
          _SCREAMING_SNAKE_CASE      =				len(self.conv_dim      )
          _SCREAMING_SNAKE_CASE      =				num_hidden_layers
          _SCREAMING_SNAKE_CASE      =				intermediate_size
          _SCREAMING_SNAKE_CASE      =				squeeze_factor
          _SCREAMING_SNAKE_CASE      =				hidden_act
          _SCREAMING_SNAKE_CASE      =				num_attention_heads
          _SCREAMING_SNAKE_CASE      =				hidden_dropout
          _SCREAMING_SNAKE_CASE      =				attention_dropout
          _SCREAMING_SNAKE_CASE      =				activation_dropout
          _SCREAMING_SNAKE_CASE      =				feat_proj_dropout
          _SCREAMING_SNAKE_CASE      =				final_dropout
          _SCREAMING_SNAKE_CASE      =				layerdrop
          _SCREAMING_SNAKE_CASE      =				layer_norm_eps
          _SCREAMING_SNAKE_CASE      =				initializer_range
          _SCREAMING_SNAKE_CASE      =				vocab_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)`,"""
                 F"but is `len(config.conv_dim) = {len(self.conv_dim      )}`, `len(config.conv_stride)"
                 F"= {len(self.conv_stride      )}`, `len(config.conv_kernel) = {len(self.conv_kernel      )}`."      )

          # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
          _SCREAMING_SNAKE_CASE      =				apply_spec_augment
          _SCREAMING_SNAKE_CASE      =				mask_time_prob
          _SCREAMING_SNAKE_CASE      =				mask_time_length
          _SCREAMING_SNAKE_CASE      =				mask_time_min_masks
          _SCREAMING_SNAKE_CASE      =				mask_feature_prob
          _SCREAMING_SNAKE_CASE      =				mask_feature_length
          _SCREAMING_SNAKE_CASE      =				mask_feature_min_masks

          # ctc loss
          _SCREAMING_SNAKE_CASE      =				ctc_loss_reduction
          _SCREAMING_SNAKE_CASE      =				ctc_zero_infinity

          # sequence classification
          _SCREAMING_SNAKE_CASE      =				use_weighted_layer_sum
          _SCREAMING_SNAKE_CASE      =				classifier_proj_size






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








'''simple docstring'''



from sklearn.metrics import matthews_corrcoef

import datasets


UpperCamelCase__      :		List[str]       							=  "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. It takes\ninto account true and false positives and negatives and is generally\nregarded as a balanced measure which can be used even if the classes are of\nvery different sizes. The MCC is in essence a correlation coefficient value\nbetween -1 and +1. A coefficient of +1 represents a perfect prediction, 0\nan average random prediction and -1 an inverse prediction.  The statistic\nis also known as the phi coefficient. [source: Wikipedia]\n"

UpperCamelCase__      :		List[Any]       							=  "\nArgs:\n    predictions (list of int): Predicted labels, as returned by a model.\n    references (list of int): Ground truth labels.\n    sample_weight (list of int, float, or bool): Sample weights. Defaults to `None`.\nReturns:\n    matthews_correlation (dict containing float): Matthews correlation.\nExamples:\n    Example 1, a basic example with only predictions and references as inputs:\n        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")\n        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],\n        ...                                     predictions=[1, 2, 2, 0, 3, 3])\n        >>> print(round(results['matthews_correlation'], 2))\n        0.54\n\n    Example 2, the same example as above, but also including sample weights:\n        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")\n        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],\n        ...                                     predictions=[1, 2, 2, 0, 3, 3],\n        ...                                     sample_weight=[0.5, 3, 1, 1, 1, 2])\n        >>> print(round(results['matthews_correlation'], 2))\n        0.1\n\n    Example 3, the same example as above, but with sample weights that cause a negative correlation:\n        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")\n        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],\n        ...                                     predictions=[1, 2, 2, 0, 3, 3],\n        ...                                     sample_weight=[0.5, 1, 0, 0, 0, 1])\n        >>> print(round(results['matthews_correlation'], 2))\n        -0.25\n"

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

@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION  ,					_KWARGS_DESCRIPTION)
class    _a				(datasets.Metric):





       """simple docstring"""




       def        UpperCamelCase				(							self      )    ->			Optional[Any]:
          return datasets.MetricInfo(
              description=_DESCRIPTION       ,							citation=_CITATION       ,							inputs_description=_KWARGS_DESCRIPTION       ,							features=datasets.Features(
                  {
                      """predictions""": datasets.Value("""int32"""      ),
                      """references""": datasets.Value("""int32"""      ),
                  }      )       ,							reference_urls=[
                  """https://scikit-learn.org/stable/modules/generated/sklearn.metrics.matthews_corrcoef.html"""
              ]       ,							)






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__=None      )    ->			List[str]:
          return {
              "matthews_correlation": float(matthews_corrcoef(A__       ,							A__       ,							sample_weight=A__      )      ),
          }






