

'''simple docstring'''



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


SCREAMING_SNAKE_CASE_     = logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_     = {
    "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json",
    "tiiuae/falcon-7b": "https://huggingface.co/tiiuae/falcon-7b/resolve/main/config.json",
}

class       SCREAMING_SNAKE_CASE       (				_SCREAMING_SNAKE_CASE       ):






      '''simple docstring'''






      SCREAMING_SNAKE_CASE__			:					Optional[int]     =					"""falcon"""
      SCREAMING_SNAKE_CASE__			:					Union[str, Any]     =					["""past_key_values"""]




      def __init__(       self			:		int  ,       snake_case			:		Optional[int]=65024  ,       snake_case			:		Dict=4544  ,       snake_case			:		Union[str, Any]=32  ,       snake_case			:		Any=71  ,       snake_case			:		List[Any]=1e-5  ,       snake_case			:		Any=0.02  ,       snake_case			:		Optional[int]=True  ,       snake_case			:		Dict=0.0  ,       snake_case			:		str=0.0  ,       snake_case			:		Optional[Any]=None  ,       snake_case			:		List[Any]=False  ,       snake_case			:		Optional[int]=False  ,       snake_case			:		str=True  ,       snake_case			:		int=True  ,       snake_case			:		int=False  ,       snake_case			:		Tuple=11  ,       snake_case			:		Optional[Any]=11  ,       **snake_case			:		Any  ,       ):



          """simple docstring"""





          _snake_case			:			List[str]				       =		vocab_size
          # Backward compatibility with n_embed kwarg
          _snake_case			:			Optional[int]				       =		kwargs.pop('n_embed'  ,       lowerCAmelCase_ )
          _snake_case			:			List[Any]				       =		hidden_size if n_embed is None else n_embed
          _snake_case			:			Any				       =		num_hidden_layers
          _snake_case			:			Optional[Any]				       =		num_attention_heads
          _snake_case			:			Union[str, Any]				       =		layer_norm_epsilon
          _snake_case			:			Tuple				       =		initializer_range
          _snake_case			:			int				       =		use_cache
          _snake_case			:			Dict				       =		hidden_dropout
          _snake_case			:			int				       =		attention_dropout

          _snake_case			:			Optional[int]				       =		bos_token_id
          _snake_case			:			Any				       =		eos_token_id
          _snake_case			:			Any				       =		num_attention_heads if num_kv_heads is None else num_kv_heads
          _snake_case			:			List[Any]				       =		alibi
          _snake_case			:			int				       =		new_decoder_architecture
          _snake_case			:			Dict				       =		multi_query  # Ignored when new_decoder_architecture is True
          _snake_case			:			str				       =		parallel_attn
          _snake_case			:			Any				       =		bias

          super().__init__(bos_token_id=lowerCAmelCase_  ,       eos_token_id=lowerCAmelCase_  ,       **lowerCAmelCase_ )




      @property
      def 						__UpperCAmelCase      (       self			:		List[Any] ):



          """simple docstring"""





          return self.hidden_size // self.num_attention_heads




      @property
      def 						__UpperCAmelCase      (       self			:		Optional[int] ):



          """simple docstring"""





          return not self.alibi











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

import datasets


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


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


_lowerCAmelCase       =				r"\nCalculates accuracy after canonicalizing inputs.\n\nArgs:\n    predictions: list of predictions to score. Each prediction\n        is a string that contains natural language and LaTex.\n    references: list of reference for each prediction. Each\n        reference is a string that contains natural language\n        and LaTex.\nReturns:\n    accuracy: accuracy after canonicalizing inputs\n        (e.g., converting \"1/2\" to \"\\frac{1}{2}\")\n\nExamples:\n    >>> metric = datasets.load_metric(\"competition_math\")\n    >>> results = metric.compute(references=[\"\\frac{1}{2}\"], predictions=[\"1/2\"])\n    >>> print(results)\n    {'accuracy': 1.0}\n"



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





	"""simple docstring"""




	def  lowerCamelCase(self				):
		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  lowerCamelCase(self  ,  lowerCAmelCase_  ,  lowerCAmelCase_				):
		A_		:    Optional[Any]						     = 0.0
		for i, j in zip(lowerCAmelCase_  ,  lowerCAmelCase_				):
			n_correct += 1.0 if math_equivalence.is_equiv(lowerCAmelCase_  ,  lowerCAmelCase_				) else 0.0
		A_		:    List[str]						     = n_correct / len(lowerCAmelCase_				)
		return {
		    "accuracy": accuracy,
		}

