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


__lowerCamelCase				=			logging.get_logger(__name__)

__lowerCamelCase				=			{
    """MIT/ast-finetuned-audioset-10-10-0.4593""": (
        """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json"""
    ),
}






class     UpperCAmelCase						(		A_					):
   A__   :						List[Any]			=	"audio-spectrogram-transformer"



   def __init__(self						:   int       ,		snake_case__						:   List[Any]=7_68       ,		snake_case__						:   Optional[Any]=12       ,		snake_case__						:   Any=12       ,		snake_case__						:   List[str]=30_72       ,		snake_case__						:   List[Any]="gelu"       ,		snake_case__						:   Union[str, Any]=0.0       ,		snake_case__						:   Dict=0.0       ,		snake_case__						:   Any=0.02       ,		snake_case__						:   Optional[int]=1e-12       ,		snake_case__						:   List[Any]=16       ,		snake_case__						:   str=True       ,		snake_case__						:   Dict=10       ,		snake_case__						:   Optional[int]=10       ,		snake_case__						:   Dict=10_24       ,		snake_case__						:   Union[str, Any]=1_28       ,		**snake_case__						:   Optional[int]       ,		)						->      List[str]:


          '''simple docstring'''


          super().__init__(**snake_case__					)

          snake_case			:  List[Any]     							= hidden_size
          snake_case			:  int     							= num_hidden_layers
          snake_case			:  List[str]     							= num_attention_heads
          snake_case			:  int     							= intermediate_size
          snake_case			:  Optional[Any]     							= hidden_act
          snake_case			:  str     							= hidden_dropout_prob
          snake_case			:  List[str]     							= attention_probs_dropout_prob
          snake_case			:  Optional[int]     							= initializer_range
          snake_case			:  Dict     							= layer_norm_eps
          snake_case			:  Any     							= patch_size
          snake_case			:  Any     							= qkv_bias
          snake_case			:  List[Any]     							= frequency_stride
          snake_case			:  List[Any]     							= time_stride
          snake_case			:  List[Any]     							= max_length
          snake_case			:  Any     							= num_mel_bins







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

import datasets


__lowerCamelCase				=			"""\
@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}
}
"""


__lowerCamelCase				=			"""\
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.
"""


__lowerCamelCase				=			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     UpperCAmelCase						(		datasets.Metric					):



   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[int]					)						->      Optional[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 							_SCREAMING_SNAKE_CASE  (self						:   Optional[int]       ,		snake_case__						:   str       ,		snake_case__						:   List[Any]					)						->      Optional[Any]:


          '''simple docstring'''


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





