


'''simple docstring'''



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

import datasets


_lowercase    :    List[Any]			     =  """\
@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}
}
"""


_lowercase    :    Any			     =  """\
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.
"""


_lowercase    :    Union[str, Any]			     =  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   a__(	self    :				List[Any]   )->  List[str]:

										"""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   a__(	self    :				Any   ,					lowerCAmelCase    :				int   ,					lowerCAmelCase    :				int   )->  Optional[int]:

										"""simple docstring"""




										UpperCAmelCase         =			0.0
										for i, j in zip(lowerCAmelCase   ,					lowerCAmelCase   ):
																n_correct += 1.0 if math_equivalence.is_equiv(lowerCAmelCase   ,					lowerCAmelCase   ) else 0.0
										UpperCAmelCase         =			n_correct / len(lowerCAmelCase   )
										return {
										    "accuracy": accuracy,
										}









'''simple docstring'''



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


_lowercase    :    Any			     =  logging.get_logger(__name__)

_lowercase    :    Dict			     =  {
    """facebook/dpr-ctx_encoder-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-question_encoder-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-reader-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-ctx_encoder-multiset-base""": (
        """https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/config.json"""
    ),
    """facebook/dpr-question_encoder-multiset-base""": (
        """https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/config.json"""
    ),
    """facebook/dpr-reader-multiset-base""": (
        """https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/config.json"""
    ),
}






class  UpperCamelCase__(     lowerCAmelCase ):
				__magic_name__       :   Optional[int]							= "dpr"




				def __init__(	self    :				Dict   ,					lowerCAmelCase    :				Any=30522   ,					lowerCAmelCase    :				List[str]=768   ,					lowerCAmelCase    :				Union[str, Any]=12   ,					lowerCAmelCase    :				Tuple=12   ,					lowerCAmelCase    :				Optional[int]=3072   ,					lowerCAmelCase    :				Optional[int]="gelu"   ,					lowerCAmelCase    :				Optional[Any]=0.1   ,					lowerCAmelCase    :				Any=0.1   ,					lowerCAmelCase    :				Optional[Any]=512   ,					lowerCAmelCase    :				List[Any]=2   ,					lowerCAmelCase    :				Tuple=0.02   ,					lowerCAmelCase    :				str=1E-12   ,					lowerCAmelCase    :				Optional[Any]=0   ,					lowerCAmelCase    :				Tuple="absolute"   ,					lowerCAmelCase    :				int = 0   ,					**lowerCAmelCase    :				Union[str, Any]   ,					)->  Optional[int]:

										"""simple docstring"""




										super().__init__(pad_token_id=lowerCAmelCase   ,					**lowerCAmelCase   )

										UpperCAmelCase         =			vocab_size
										UpperCAmelCase         =			hidden_size
										UpperCAmelCase         =			num_hidden_layers
										UpperCAmelCase         =			num_attention_heads
										UpperCAmelCase         =			hidden_act
										UpperCAmelCase         =			intermediate_size
										UpperCAmelCase         =			hidden_dropout_prob
										UpperCAmelCase         =			attention_probs_dropout_prob
										UpperCAmelCase         =			max_position_embeddings
										UpperCAmelCase         =			type_vocab_size
										UpperCAmelCase         =			initializer_range
										UpperCAmelCase         =			layer_norm_eps
										UpperCAmelCase         =			projection_dim
										UpperCAmelCase         =			position_embedding_type





