


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


__lowerCAmelCase	: str  				={
    'configuration_owlvit': [
        'OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'OwlViTConfig',
        'OwlViTOnnxConfig',
        'OwlViTTextConfig',
        'OwlViTVisionConfig',
    ],
    'processing_owlvit': ['OwlViTProcessor'],
}


try:
						if not is_vision_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						__lowerCAmelCase	: Optional[int]  				=['OwlViTFeatureExtractor']
						__lowerCAmelCase	: str  				=['OwlViTImageProcessor']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						__lowerCAmelCase	: int  				=[
						    'OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'OwlViTModel',
						    'OwlViTPreTrainedModel',
						    'OwlViTTextModel',
						    'OwlViTVisionModel',
						    'OwlViTForObjectDetection',
						]

if TYPE_CHECKING:
						from .configuration_owlvit import (
						    OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    OwlViTConfig,
						    OwlViTOnnxConfig,
						    OwlViTTextConfig,
						    OwlViTVisionConfig,
						)
						from .processing_owlvit import OwlViTProcessor

						try:
												if not is_vision_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_owlvit import OwlViTFeatureExtractor
												from .image_processing_owlvit import OwlViTImageProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_owlvit import (
												    OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    OwlViTForObjectDetection,
												    OwlViTModel,
												    OwlViTPreTrainedModel,
												    OwlViTTextModel,
												    OwlViTVisionModel,
												)

else:
						import sys

						__lowerCAmelCase	: Optional[int]  				=_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




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

import datasets


__lowerCAmelCase	: Optional[Any]  				='\\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	: Any  				='\\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	: Optional[Any]  				=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        _lowercase      (			datasets.Metric       ):






				'''simple docstring'''



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