



'''simple docstring'''




import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
UpperCamelCase__       :	int    = sys.version_info >= (3, 10)


def 				lowerCAmelCase_   (	_lowerCamelCase:   Tuple=None       ,      _lowerCamelCase:   Union[str, Any]=None					):
		return field(default_factory=lambda: default       ,      metadata=UpperCAmelCase__					)






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		Union[str, Any]			    =		42
			_A      :		str			    =		42
			_A      :		Optional[Any]			    =		42
			_A      :		int			    =		42






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		Tuple			    =		42
			_A      :		Tuple			    =		field(default='''toto'''    ,					metadata={'''help''': '''help message'''}    )






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		Dict			    =		False
			_A      :		Optional[Any]			    =		True
			_A      :		List[Any]			    =		None






class 						_UpperCamelCase  (							_UpperCAmelCase    ):


			'''simple docstring'''

			_A      :		List[Any]			    =		'''titi'''
			_A      :		Tuple			    =		'''toto'''






class 						_UpperCamelCase  (							_UpperCAmelCase    ):


			'''simple docstring'''

			_A      :		Dict			    =		'''titi'''
			_A      :		str			    =		'''toto'''
			_A      :		Optional[int]			    =		42






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		List[Any]			    =		'''toto'''

			def UpperCamelCase__					(							self     : int						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		BasicEnum(self.foo						)






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		Tuple			    =		'''toto'''

			def UpperCamelCase__					(							self     : int						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		MixedTypeEnum(self.foo						)






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		int			    =		None
			_A      :		int			    =		field(default=_UpperCAmelCase    ,					metadata={'''help''': '''help message'''}    )
			_A      :		Any			    =		None
			_A      :		Dict			    =		list_field(default=[]    )
			_A      :		Tuple			    =		list_field(default=[]    )






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		Optional[int]			    =		list_field(default=[]    )
			_A      :		Union[str, Any]			    =		list_field(default=[1, 2, 3]    )
			_A      :		List[Any]			    =		list_field(default=['''Hallo''', '''Bonjour''', '''Hello''']    )
			_A      :		str			    =		list_field(default=[0.1, 0.2, 0.3]    )






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		Optional[int]			    =		field()
			_A      :		List[str]			    =		field()
			_A      :		Dict			    =		field()

			def UpperCamelCase__					(							self     : List[str]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		List[Any]           =		BasicEnum(self.required_enum						)






@dataclass
class 						_UpperCamelCase  :


			'''simple docstring'''

			_A      :		Union[str, Any]			    =		42
			_A      :		Tuple			    =		field()
			_A      :		Dict			    =		None
			_A      :		str			    =		field(default='''toto'''    ,					metadata={'''help''': '''help message'''}    )
			_A      :		Optional[int]			    =		list_field(default=['''Hallo''', '''Bonjour''', '''Hello''']    )


if is_python_no_less_than_3_10:






						@dataclass
						class 						_UpperCamelCase  :


									'''simple docstring'''

									_A      :		str			    =		False
									_A      :		Dict			    =		True
									_A      :		Optional[int]			    =		None






						@dataclass
						class 						_UpperCamelCase  :


									'''simple docstring'''

									_A      :		int			    =		None
									_A      :		str			    =		field(default=_UpperCAmelCase    ,					metadata={'''help''': '''help message'''}    )
									_A      :		List[str]			    =		None
									_A      :		List[Any]			    =		list_field(default=[]    )
									_A      :		Optional[int]			    =		list_field(default=[]    )






class 						_UpperCamelCase  (							unittest.TestCase    ):


			'''simple docstring'''

			def UpperCamelCase__					(							self     : Dict							,     lowerCAmelCase__     : argparse.ArgumentParser							,     lowerCAmelCase__     : argparse.ArgumentParser						):





					"""simple docstring"""






					self.assertEqual(len(a._actions						)							,     len(b._actions						)						)
					for x, y in zip(a._actions							,     b._actions						):
							__SCREAMING_SNAKE_CASE       :		List[str]           =		{k: v for k, v in vars(lowercase_						).items() if k != """container"""}
							__SCREAMING_SNAKE_CASE       :		Any           =		{k: v for k, v in vars(lowercase_						).items() if k != """container"""}

							# Choices with mixed type have custom function as "type"
							# So we need to compare results directly for equality
							if xx.get("""choices"""							,     lowercase_						) and yy.get("""choices"""							,     lowercase_						):
									for expected_choice in yy["choices"] + xx["choices"]:
											self.assertEqual(xx["""type"""](lowercase_						)							,     yy["""type"""](lowercase_						)						)
									del xx["type"], yy["type"]

							self.assertEqual(lowercase_							,     lowercase_						)

			def UpperCamelCase__					(							self     : Tuple						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		List[str]           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		str           =		argparse.ArgumentParser()
					expected.add_argument("""--foo"""							,     type=lowercase_							,     required=lowercase_						)
					expected.add_argument("""--bar"""							,     type=lowercase_							,     required=lowercase_						)
					expected.add_argument("""--baz"""							,     type=lowercase_							,     required=lowercase_						)
					expected.add_argument("""--flag"""							,     type=lowercase_							,     default=lowercase_							,     const=lowercase_							,     nargs="""?"""						)
					self.argparsersEqual(lowercase_							,     lowercase_						)

					__SCREAMING_SNAKE_CASE       :		List[str]           =		["""--foo""", """1""", """--baz""", """quux""", """--bar""", """0.5"""]
					(__SCREAMING_SNAKE_CASE						)       :		Optional[Any]           =		parser.parse_args_into_dataclasses(lowercase_							,     look_for_args_file=lowercase_						)
					self.assertFalse(example.flag						)

			def UpperCamelCase__					(							self     : Optional[int]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Any           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		str           =		argparse.ArgumentParser()
					expected.add_argument("""--foo"""							,     default=4_2							,     type=lowercase_						)
					expected.add_argument("""--baz"""							,     default="""toto"""							,     type=lowercase_							,     help="""help message"""						)
					self.argparsersEqual(lowercase_							,     lowercase_						)

			def UpperCamelCase__					(							self     : int						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		argparse.ArgumentParser()
					expected.add_argument("""--foo"""							,     type=lowercase_							,     default=lowercase_							,     const=lowercase_							,     nargs="""?"""						)
					expected.add_argument("""--baz"""							,     type=lowercase_							,     default=lowercase_							,     const=lowercase_							,     nargs="""?"""						)
					# A boolean no_* argument always has to come after its "default: True" regular counter-part
					# and its default must be set to False
					expected.add_argument("""--no_baz"""							,     action="""store_false"""							,     default=lowercase_							,     dest="""baz"""						)
					expected.add_argument("""--opt"""							,     type=lowercase_							,     default=lowercase_						)

					__SCREAMING_SNAKE_CASE       :		List[Any]           =		[WithDefaultBoolExample]
					if is_python_no_less_than_3_10:
							dataclass_types.append(lowercase_						)

					for dataclass_type in dataclass_types:
							__SCREAMING_SNAKE_CASE       :		List[str]           =		HfArgumentParser(lowercase_						)
							self.argparsersEqual(lowercase_							,     lowercase_						)

							__SCREAMING_SNAKE_CASE       :		str           =		parser.parse_args([]						)
							self.assertEqual(lowercase_							,     Namespace(foo=lowercase_							,     baz=lowercase_							,     opt=lowercase_						)						)

							__SCREAMING_SNAKE_CASE       :		Optional[Any]           =		parser.parse_args(["""--foo""", """--no_baz"""]						)
							self.assertEqual(lowercase_							,     Namespace(foo=lowercase_							,     baz=lowercase_							,     opt=lowercase_						)						)

							__SCREAMING_SNAKE_CASE       :		Optional[Any]           =		parser.parse_args(["""--foo""", """--baz"""]						)
							self.assertEqual(lowercase_							,     Namespace(foo=lowercase_							,     baz=lowercase_							,     opt=lowercase_						)						)

							__SCREAMING_SNAKE_CASE       :		Dict           =		parser.parse_args(["""--foo""", """True""", """--baz""", """True""", """--opt""", """True"""]						)
							self.assertEqual(lowercase_							,     Namespace(foo=lowercase_							,     baz=lowercase_							,     opt=lowercase_						)						)

							__SCREAMING_SNAKE_CASE       :		int           =		parser.parse_args(["""--foo""", """False""", """--baz""", """False""", """--opt""", """False"""]						)
							self.assertEqual(lowercase_							,     Namespace(foo=lowercase_							,     baz=lowercase_							,     opt=lowercase_						)						)

			def UpperCamelCase__					(							self     : Union[str, Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		str           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		Tuple           =		argparse.ArgumentParser()
					expected.add_argument(
					    """--foo"""							,     default="""toto"""							,     choices=["""titi""", """toto""", 4_2]							,     type=make_choice_type_function(["""titi""", """toto""", 4_2]						)							,     )
					self.argparsersEqual(lowercase_							,     lowercase_						)

					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		parser.parse_args([]						)
					self.assertEqual(args.foo							,     """toto"""						)
					__SCREAMING_SNAKE_CASE       :		Union[str, Any]           =		parser.parse_args_into_dataclasses([]						)[0]
					self.assertEqual(enum_ex.foo							,     MixedTypeEnum.toto						)

					__SCREAMING_SNAKE_CASE       :		int           =		parser.parse_args(["""--foo""", """titi"""]						)
					self.assertEqual(args.foo							,     """titi"""						)
					__SCREAMING_SNAKE_CASE       :		int           =		parser.parse_args_into_dataclasses(["""--foo""", """titi"""]						)[0]
					self.assertEqual(enum_ex.foo							,     MixedTypeEnum.titi						)

					__SCREAMING_SNAKE_CASE       :		List[str]           =		parser.parse_args(["""--foo""", """42"""]						)
					self.assertEqual(args.foo							,     4_2						)
					__SCREAMING_SNAKE_CASE       :		List[str]           =		parser.parse_args_into_dataclasses(["""--foo""", """42"""]						)[0]
					self.assertEqual(enum_ex.foo							,     MixedTypeEnum.fourtytwo						)

			def UpperCamelCase__					(							self     : Union[str, Any]						):





					"""simple docstring"""






					@dataclass
					class 						_UpperCamelCase  :


								'''simple docstring'''

								_A      :		Optional[Any]			    =		'''toto'''
					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		List[str]           =		argparse.ArgumentParser()
					expected.add_argument(
					    """--foo"""							,     default="""toto"""							,     choices=("""titi""", """toto""", 4_2)							,     type=make_choice_type_function(["""titi""", """toto""", 4_2]						)							,     )
					self.argparsersEqual(lowercase_							,     lowercase_						)

					__SCREAMING_SNAKE_CASE       :		List[str]           =		parser.parse_args([]						)
					self.assertEqual(args.foo							,     """toto"""						)

					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		parser.parse_args(["""--foo""", """titi"""]						)
					self.assertEqual(args.foo							,     """titi"""						)

					__SCREAMING_SNAKE_CASE       :		List[Any]           =		parser.parse_args(["""--foo""", """42"""]						)
					self.assertEqual(args.foo							,     4_2						)

			def UpperCamelCase__					(							self     : Dict						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		int           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		Dict           =		argparse.ArgumentParser()
					expected.add_argument("""--foo_int"""							,     nargs="""+"""							,     default=[]							,     type=lowercase_						)
					expected.add_argument("""--bar_int"""							,     nargs="""+"""							,     default=[1, 2, 3]							,     type=lowercase_						)
					expected.add_argument("""--foo_str"""							,     nargs="""+"""							,     default=["""Hallo""", """Bonjour""", """Hello"""]							,     type=lowercase_						)
					expected.add_argument("""--foo_float"""							,     nargs="""+"""							,     default=[0.1, 0.2, 0.3]							,     type=lowercase_						)

					self.argparsersEqual(lowercase_							,     lowercase_						)

					__SCREAMING_SNAKE_CASE       :		int           =		parser.parse_args([]						)
					self.assertEqual(
					    lowercase_							,     Namespace(foo_int=[]							,     bar_int=[1, 2, 3]							,     foo_str=["""Hallo""", """Bonjour""", """Hello"""]							,     foo_float=[0.1, 0.2, 0.3]						)							,     )

					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		parser.parse_args("""--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7""".split()						)
					self.assertEqual(lowercase_							,     Namespace(foo_int=[1]							,     bar_int=[2, 3]							,     foo_str=["""a""", """b""", """c"""]							,     foo_float=[0.1, 0.7]						)						)

			def UpperCamelCase__					(							self     : Tuple						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Tuple           =		argparse.ArgumentParser()
					expected.add_argument("""--foo"""							,     default=lowercase_							,     type=lowercase_						)
					expected.add_argument("""--bar"""							,     default=lowercase_							,     type=lowercase_							,     help="""help message"""						)
					expected.add_argument("""--baz"""							,     default=lowercase_							,     type=lowercase_						)
					expected.add_argument("""--ces"""							,     nargs="""+"""							,     default=[]							,     type=lowercase_						)
					expected.add_argument("""--des"""							,     nargs="""+"""							,     default=[]							,     type=lowercase_						)

					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		[OptionalExample]
					if is_python_no_less_than_3_10:
							dataclass_types.append(lowercase_						)

					for dataclass_type in dataclass_types:
							__SCREAMING_SNAKE_CASE       :		Tuple           =		HfArgumentParser(lowercase_						)

							self.argparsersEqual(lowercase_							,     lowercase_						)

							__SCREAMING_SNAKE_CASE       :		Union[str, Any]           =		parser.parse_args([]						)
							self.assertEqual(lowercase_							,     Namespace(foo=lowercase_							,     bar=lowercase_							,     baz=lowercase_							,     ces=[]							,     des=[]						)						)

							__SCREAMING_SNAKE_CASE       :		List[Any]           =		parser.parse_args("""--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3""".split()						)
							self.assertEqual(lowercase_							,     Namespace(foo=1_2							,     bar=3.14							,     baz="""42"""							,     ces=["""a""", """b""", """c"""]							,     des=[1, 2, 3]						)						)

			def UpperCamelCase__					(							self     : Union[str, Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Dict           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		int           =		argparse.ArgumentParser()
					expected.add_argument("""--required_list"""							,     nargs="""+"""							,     type=lowercase_							,     required=lowercase_						)
					expected.add_argument("""--required_str"""							,     type=lowercase_							,     required=lowercase_						)
					expected.add_argument(
					    """--required_enum"""							,     type=make_choice_type_function(["""titi""", """toto"""]						)							,     choices=["""titi""", """toto"""]							,     required=lowercase_							,     )
					self.argparsersEqual(lowercase_							,     lowercase_						)

			def UpperCamelCase__					(							self     : Optional[Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Dict           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		List[str]           =		argparse.ArgumentParser()
					expected.add_argument("""--foo"""							,     type=lowercase_							,     required=lowercase_						)
					expected.add_argument(
					    """--required_enum"""							,     type=make_choice_type_function(["""titi""", """toto"""]						)							,     choices=["""titi""", """toto"""]							,     required=lowercase_							,     )
					expected.add_argument("""--opt"""							,     type=lowercase_							,     default=lowercase_						)
					expected.add_argument("""--baz"""							,     default="""toto"""							,     type=lowercase_							,     help="""help message"""						)
					expected.add_argument("""--foo_str"""							,     nargs="""+"""							,     default=["""Hallo""", """Bonjour""", """Hello"""]							,     type=lowercase_						)
					self.argparsersEqual(lowercase_							,     lowercase_						)

			def UpperCamelCase__					(							self     : List[Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		str           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		{
					    """foo""": 1_2,
					    """bar""": 3.14,
					    """baz""": """42""",
					    """flag""": True,
					}

					__SCREAMING_SNAKE_CASE       :		Optional[Any]           =		parser.parse_dict(lowercase_						)[0]
					__SCREAMING_SNAKE_CASE       :		Dict           =		BasicExample(**lowercase_						)
					self.assertEqual(lowercase_							,     lowercase_						)

			def UpperCamelCase__					(							self     : Optional[Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Dict           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		Optional[int]           =		{
					    """foo""": 1_2,
					    """bar""": 3.14,
					    """baz""": """42""",
					    """flag""": True,
					    """extra""": 4_2,
					}

					self.assertRaises(lowercase_							,     parser.parse_dict							,     lowercase_							,     allow_extra_keys=lowercase_						)

			def UpperCamelCase__					(							self     : Any						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		List[Any]           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		int           =		{
					    """foo""": 1_2,
					    """bar""": 3.14,
					    """baz""": """42""",
					    """flag""": True,
					}
					with tempfile.TemporaryDirectory() as tmp_dir:
							__SCREAMING_SNAKE_CASE       :		Optional[int]           =		os.path.join(lowercase_							,     """temp_json"""						)
							os.mkdir(lowercase_						)
							with open(temp_local_path + """.json"""							,     """w+"""						) as f:
									json.dump(lowercase_							,     lowercase_						)
							__SCREAMING_SNAKE_CASE       :		str           =		parser.parse_yaml_file(Path(temp_local_path + """.json"""						)						)[0]

					__SCREAMING_SNAKE_CASE       :		Tuple           =		BasicExample(**lowercase_						)
					self.assertEqual(lowercase_							,     lowercase_						)

			def UpperCamelCase__					(							self     : List[Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		str           =		HfArgumentParser(lowercase_						)

					__SCREAMING_SNAKE_CASE       :		List[Any]           =		{
					    """foo""": 1_2,
					    """bar""": 3.14,
					    """baz""": """42""",
					    """flag""": True,
					}
					with tempfile.TemporaryDirectory() as tmp_dir:
							__SCREAMING_SNAKE_CASE       :		Tuple           =		os.path.join(lowercase_							,     """temp_yaml"""						)
							os.mkdir(lowercase_						)
							with open(temp_local_path + """.yaml"""							,     """w+"""						) as f:
									yaml.dump(lowercase_							,     lowercase_						)
							__SCREAMING_SNAKE_CASE       :		List[str]           =		parser.parse_yaml_file(Path(temp_local_path + """.yaml"""						)						)[0]
					__SCREAMING_SNAKE_CASE       :		Any           =		BasicExample(**lowercase_						)
					self.assertEqual(lowercase_							,     lowercase_						)



			def UpperCamelCase__					(							self     : Union[str, Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		str           =		HfArgumentParser(lowercase_						)
					self.assertIsNotNone(lowercase_						)
'''simple docstring'''




import faiss  # noqa: F401 # Here to have a nice missing dependency error message early on
import numpy  # noqa: F401 # Here to have a nice missing dependency error message early on
import requests  # noqa: F401 # Here to have a nice missing dependency error message early on
import sklearn  # noqa: F401 # Here to have a nice missing dependency error message early on
import tqdm  # noqa: F401 # Here to have a nice missing dependency error message early on
from mauve import compute_mauve  # From: mauve-text

import datasets


_lowercase						: Optional[int]						=						"\\n@inproceedings{pillutla-etal:mauve:neurips2021,\n  title={MAUVE: Measuring the Gap Between Neural Text and Human Text using Divergence Frontiers},\n  author={Pillutla, Krishna and Swayamdipta, Swabha and Zellers, Rowan and Thickstun, John and Welleck, Sean and Choi, Yejin and Harchaoui, Zaid},\n  booktitle = {NeurIPS},\n  year      = {2021}\n}\n\n"

_lowercase						: List[Any]						=						"\\nMAUVE is a library built on PyTorch and HuggingFace Transformers to measure the gap between neural text and human text with the eponymous MAUVE measure.\n\nMAUVE summarizes both Type I and Type II errors measured softly using Kullback–Leibler (KL) divergences.\n\nFor details, see the MAUVE paper: https://arxiv.org/abs/2102.01454 (Neurips, 2021).\n\nThis metrics is a wrapper around the official implementation of MAUVE:\nhttps://github.com/krishnap25/mauve\n"

_lowercase						: List[Any]						=						"\nCalculates MAUVE scores between two lists of generated text and reference text.\nArgs:\n    predictions: list of generated text to score. Each predictions\n        should be a string with tokens separated by spaces.\n    references: list of reference for each prediction. Each\n        reference should be a string with tokens separated by spaces.\nOptional Args:\n    num_buckets: the size of the histogram to quantize P and Q. Options: 'auto' (default) or an integer\n    pca_max_data: the number data points to use for PCA dimensionality reduction prior to clustering. If -1, use all the data. Default -1\n    kmeans_explained_var: amount of variance of the data to keep in dimensionality reduction by PCA. Default 0.9\n    kmeans_num_redo: number of times to redo k-means clustering (the best objective is kept). Default 5\n    kmeans_max_iter: maximum number of k-means iterations. Default 500\n    featurize_model_name: name of the model from which features are obtained. Default 'gpt2-large' Use one of ['gpt2', 'gpt2-medium', 'gpt2-large', 'gpt2-xl'].\n    device_id: Device for featurization. Supply a GPU id (e.g. 0 or 3) to use GPU. If no GPU with this id is found, use CPU\n    max_text_length: maximum number of tokens to consider. Default 1024\n    divergence_curve_discretization_size: Number of points to consider on the divergence curve. Default 25\n    mauve_scaling_factor: \"c\" from the paper. Default 5.\n    verbose: If True (default), print running time updates\n    seed: random seed to initialize k-means cluster assignments.\nReturns:\n    mauve: MAUVE score, a number between 0 and 1. Larger values indicate that P and Q are closer,\n    frontier_integral: Frontier Integral, a number between 0 and 1. Smaller values indicate that P and Q are closer,\n    divergence_curve: a numpy.ndarray of shape (m, 2); plot it with matplotlib to view the divergence curve,\n    p_hist: a discrete distribution, which is a quantized version of the text distribution p_text,\n    q_hist: same as above, but with q_text.\nExamples:\n\n    >>> # faiss segfaults in doctest for some reason, so the .compute call is not tested with doctest\n    >>> import datasets\n    >>> mauve = datasets.load_metric('mauve')\n    >>> predictions = [\"hello there\", \"general kenobi\"]\n    >>> references = [\"hello there\", \"general kenobi\"]\n    >>> out = mauve.compute(predictions=predictions, references=references) # doctest: +SKIP\n    >>> print(out.mauve) # doctest: +SKIP\n    1.0\n"





@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION,     _KWARGS_DESCRIPTION)
class     __magic_name__						(    datasets.Metric):







			def 	SCREAMING_SNAKE_CASE_     (	self				:  List[Any]    ):
										return datasets.MetricInfo(
										    description=_DESCRIPTION				,			citation=_CITATION				,			homepage="""https://github.com/krishnap25/mauve"""				,			inputs_description=_KWARGS_DESCRIPTION				,			features=datasets.Features(
										        {
										            """predictions""": datasets.Value("""string"""				,			id="""sequence"""    ),
										            """references""": datasets.Value("""string"""				,			id="""sequence"""    ),
										        }    )				,			codebase_urls=["""https://github.com/krishnap25/mauve"""]				,			reference_urls=[
										        """https://arxiv.org/abs/2102.01454""",
										        """https://github.com/krishnap25/mauve""",
										    ]				,			)







			def 	SCREAMING_SNAKE_CASE_     (	self				:  Optional[int]				,			lowercase_				:  Union[str, Any]				,			lowercase_				:  Any				,			lowercase_				:  Any=None				,			lowercase_				:  str=None				,			lowercase_				:  Dict=None				,			lowercase_				:  Any=None				,			lowercase_				:  int="auto"				,			lowercase_				:  Tuple=-1				,			lowercase_				:  str=0.9				,			lowercase_				:  Union[str, Any]=5				,			lowercase_				:  List[str]=500				,			lowercase_				:  Union[str, Any]="gpt2-large"				,			lowercase_				:  List[Any]=-1				,			lowercase_				:  str=1024				,			lowercase_				:  List[str]=25				,			lowercase_				:  str=5				,			lowercase_				:  List[Any]=True				,			lowercase_				:  Tuple=25				,			):
										lowercase_					:			List[str]										=       compute_mauve(
										    p_text=lowercase_				,			q_text=lowercase_				,			p_features=lowercase_				,			q_features=lowercase_				,			p_tokens=lowercase_				,			q_tokens=lowercase_				,			num_buckets=lowercase_				,			pca_max_data=lowercase_				,			kmeans_explained_var=lowercase_				,			kmeans_num_redo=lowercase_				,			kmeans_max_iter=lowercase_				,			featurize_model_name=lowercase_				,			device_id=lowercase_				,			max_text_length=lowercase_				,			divergence_curve_discretization_size=lowercase_				,			mauve_scaling_factor=lowercase_				,			verbose=lowercase_				,			seed=lowercase_				,			)
										return out





