


import math_equivalence  # From: git+https://github.com/hendrycks/math.git

import datasets


snake_case__			 =						'''\
@article{hendrycksmath2021,
  title={Measuring Mathematical Problem Solving With the MATH Dataset},
  author={Dan Hendrycks
    and Collin Burns
    and Saurav Kadavath
    and Akul Arora
    and Steven Basart
    and Eric Tang
    and Dawn Song
    and Jacob Steinhardt},
  journal={arXiv preprint arXiv:2103.03874},
  year={2021}
}
'''


snake_case__			 =						'''\
This metric is used to assess performance on the Mathematics Aptitude Test of Heuristics (MATH) dataset.
It first canonicalizes the inputs (e.g., converting "1/2" to "\\frac{1}{2}") and then computes accuracy.
'''


snake_case__			 =						r'''
Calculates accuracy after canonicalizing inputs.

Args:
    predictions: list of predictions to score. Each prediction
        is a string that contains natural language and LaTex.
    references: list of reference for each prediction. Each
        reference is a string that contains natural language
        and LaTex.
Returns:
    accuracy: accuracy after canonicalizing inputs
        (e.g., converting "1/2" to "\\frac{1}{2}")

Examples:
    >>> metric = datasets.load_metric("competition_math")
    >>> results = metric.compute(references=["\\frac{1}{2}"], predictions=["1/2"])
    >>> print(results)
    {\'accuracy\': 1.0}
'''


@datasets.utils.file_utils.add_end_docstrings(_DESCRIPTION			,_KWARGS_DESCRIPTION)
class 					lowerCAmelCase_ (       datasets.Metric):




						def  _snake_case					(	self						:   List[str]						)      ->List[Any]:






									"""simple docstring"""






									return datasets.MetricInfo(
									    description=_DESCRIPTION   ,     citation=_CITATION   ,     inputs_description=_KWARGS_DESCRIPTION   ,     features=datasets.Features(
									        {
									            "predictions": datasets.Value("string"						),
									            "references": datasets.Value("string"						),
									        }						)   ,     homepage="https://github.com/hendrycks/math"   ,     codebase_urls=["https://github.com/hendrycks/math"]   ,     )






						def  _snake_case					(	self						:   Any   ,     __A						:   Optional[int]   ,     __A						:   Union[str, Any]						)      ->Tuple:






									"""simple docstring"""






									a__ :Optional[Any]						  =    0.0
									for i, j in zip(__A   ,     __A						):
												n_correct += 1.0 if math_equivalence.is_equiv(__A   ,     __A						) else 0.0
									a__ :Optional[int]						  =    n_correct / len(__A						)
									return {
									    "accuracy": accuracy,
									}






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


snake_case__			 =						logging.get_logger(__name__)

snake_case__			 =						{
    '''facebook/s2t-wav2vec2-large-en-de''': (
        '''https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json'''
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}


class 					lowerCAmelCase_ (       _a):
						lowerCamelCase_         =     'speech_to_text_2'
						lowerCamelCase_         =     ['past_key_values']
						lowerCamelCase_         =     {'num_attention_heads': 'decoder_attention_heads', 'hidden_size': 'd_model'}




						def __init__(	self						:   Dict   ,     __A						:   Union[str, Any]=10000   ,     __A						:   Tuple=6   ,     __A						:   Tuple=2048   ,     __A						:   Any=4   ,     __A						:   str=0.0   ,     __A						:   Tuple=True   ,     __A						:   List[Any]="relu"   ,     __A						:   Union[str, Any]=256   ,     __A						:   str=0.1   ,     __A						:   Optional[Any]=0.0   ,     __A						:   Tuple=0.0   ,     __A						:   Any=0.02   ,     __A						:   int=2   ,     __A						:   Union[str, Any]=True   ,     __A						:   Tuple=1   ,     __A						:   List[str]=0   ,     __A						:   List[str]=2   ,     __A						:   Union[str, Any]=1024   ,     **__A						:   Tuple   ,     )      ->List[str]:






									"""simple docstring"""






									a__ :Tuple						  =    vocab_size
									a__ :Dict						  =    d_model
									a__ :Optional[int]						  =    decoder_ffn_dim
									a__ :Optional[int]						  =    decoder_layers
									a__ :Optional[int]						  =    decoder_attention_heads
									a__ :Dict						  =    dropout
									a__ :Optional[Any]						  =    attention_dropout
									a__ :Any						  =    activation_dropout
									a__ :int						  =    activation_function
									a__ :Optional[int]						  =    init_std
									a__ :List[Any]						  =    decoder_layerdrop
									a__ :Optional[Any]						  =    use_cache
									a__ :List[str]						  =    decoder_layers
									a__ :int						  =    scale_embedding  # scale factor will be sqrt(d_model) if True
									a__ :Optional[int]						  =    max_target_positions

									super().__init__(
									    pad_token_id=__A   ,     bos_token_id=__A   ,     eos_token_id=__A   ,     decoder_start_token_id=__A   ,     **__A   ,     )


