'''simple docstring'''







import functools
import operator

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


UpperCamelCase_      	=	logging.get_logger(__name__)

UpperCamelCase_      	=	{
    """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 _SCREAMING_SNAKE_CASE(							_SCREAMING_SNAKE_CASE					):
						A_			:							Dict     		= 'sew'




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

													# ctc loss
													SCREAMING_SNAKE_CASE__     :Any						    = ctc_loss_reduction
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = ctc_zero_infinity

													# sequence classification
													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = use_weighted_layer_sum
													SCREAMING_SNAKE_CASE__     :List[Any]						    = classifier_proj_size




						@property
						def      __lowerCamelCase       (    self :       Dict      )     ->				int:
													return functools.reduce(operator.mul							,							self.conv_stride							,							1      )














from sklearn.metrics import matthews_corrcoef

import datasets


SCREAMING_SNAKE_CASE__   :      Optional[Any]				=		"""
Compute the Matthews correlation coefficient (MCC)

The Matthews correlation coefficient is used in machine learning as a
measure of the quality of binary and multiclass classifications. It takes
into account true and false positives and negatives and is generally
regarded as a balanced measure which can be used even if the classes are of
very different sizes. The MCC is in essence a correlation coefficient value
between -1 and +1. A coefficient of +1 represents a perfect prediction, 0
an average random prediction and -1 an inverse prediction.  The statistic
is also known as the phi coefficient. [source: Wikipedia]
"""

SCREAMING_SNAKE_CASE__   :      Union[str, Any]				=		"""
Args:
    predictions (list of int): Predicted labels, as returned by a model.
    references (list of int): Ground truth labels.
    sample_weight (list of int, float, or bool): Sample weights. Defaults to `None`.
Returns:
    matthews_correlation (dict containing float): Matthews correlation.
Examples:
    Example 1, a basic example with only predictions and references as inputs:
        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3])
        >>> print(round(results['matthews_correlation'], 2))
        0.54

    Example 2, the same example as above, but also including sample weights:
        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3],
        ...                                     sample_weight=[0.5, 3, 1, 1, 1, 2])
        >>> print(round(results['matthews_correlation'], 2))
        0.1

    Example 3, the same example as above, but with sample weights that cause a negative correlation:
        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3],
        ...                                     sample_weight=[0.5, 1, 0, 0, 0, 1])
        >>> print(round(results['matthews_correlation'], 2))
        -0.25
"""

SCREAMING_SNAKE_CASE__   :      int				=		"""\
@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}
}
"""
@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION      ,					_KWARGS_DESCRIPTION			)
class     lowerCamelCase_					(   datasets.Metric			):







				def       A						(    self  ):
								"""simple docstring"""
								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       A						(    self							,       __lowerCAmelCase							,       __lowerCAmelCase							,       __lowerCAmelCase=None  ):
								"""simple docstring"""
								return {
								    "matthews_correlation": float(matthews_corrcoef(__lowerCAmelCase							,       __lowerCAmelCase							,       sample_weight=__lowerCAmelCase  )  ),
								}






