

from copy import deepcopy
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union

import torch
from torch import nn
from torch.utils.data import Dataset

from .deepspeed import is_deepspeed_zeroa_enabled
from .generation.configuration_utils import GenerationConfig
from .trainer import Trainer
from .utils import logging


if TYPE_CHECKING:
      from .data.data_collator import DataCollator
      from .modeling_utils import PreTrainedModel
      from .tokenization_utils_base import PreTrainedTokenizerBase
      from .trainer_callback import TrainerCallback
      from .trainer_utils import EvalPrediction, PredictionOutput
      from .training_args import TrainingArguments


lowerCAmelCase__							=			logging.get_logger(__name__)






class     __magic_name__     (							snake_case__     ):


 def __init__(    self		:			Any      ,    lowerCAmelCase__		:			Union["PreTrainedModel", nn.Module] = None      ,    lowerCAmelCase__		:			"TrainingArguments" = None      ,    lowerCAmelCase__		:			Optional["DataCollator"] = None      ,    lowerCAmelCase__		:			Optional[Dataset] = None      ,    lowerCAmelCase__		:			Optional[Union[Dataset, Dict[str, Dataset]]] = None      ,    lowerCAmelCase__		:			Optional["PreTrainedTokenizerBase"] = None      ,    lowerCAmelCase__		:			Optional[Callable[[], "PreTrainedModel"]] = None      ,    lowerCAmelCase__		:			Optional[Callable[["EvalPrediction"], Dict]] = None      ,    lowerCAmelCase__		:			Optional[List["TrainerCallback"]] = None      ,    lowerCAmelCase__		:			Tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None)      ,    lowerCAmelCase__		:			Optional[Callable[[torch.Tensor, torch.Tensor], torch.Tensor]] = None      ,    )     ->   Optional[Any]:
   super().__init__(
       model=_SCREAMING_SNAKE_CASE      ,    args=_SCREAMING_SNAKE_CASE      ,    data_collator=_SCREAMING_SNAKE_CASE      ,    train_dataset=_SCREAMING_SNAKE_CASE      ,    eval_dataset=_SCREAMING_SNAKE_CASE      ,    tokenizer=_SCREAMING_SNAKE_CASE      ,    model_init=_SCREAMING_SNAKE_CASE      ,    compute_metrics=_SCREAMING_SNAKE_CASE      ,    callbacks=_SCREAMING_SNAKE_CASE      ,    optimizers=_SCREAMING_SNAKE_CASE      ,    preprocess_logits_for_metrics=_SCREAMING_SNAKE_CASE      ,    )

   # Override self.model.generation_config if a GenerationConfig is specified in args.
   # Priority: args.generation_config > model.generation_config > default GenerationConfig.
   if self.args.generation_config is not None:
     UpperCAmelCase          =	self.load_generation_config(self.args.generation_config     )
     UpperCAmelCase          =	gen_config


 @staticmethod
 def _UpperCamelCase						(    lowerCAmelCase__		:			Union[str, GenerationConfig]     )     ->   GenerationConfig:

   # GenerationConfig provided, nothing to do
   if isinstance(_SCREAMING_SNAKE_CASE      ,    _SCREAMING_SNAKE_CASE     ):
     return deepcopy(_SCREAMING_SNAKE_CASE     )

   # str or Path
   UpperCAmelCase          =	Path(_SCREAMING_SNAKE_CASE     ) if isinstance(_SCREAMING_SNAKE_CASE      ,    _SCREAMING_SNAKE_CASE     ) else gen_config_arg
   UpperCAmelCase          =	None

   # Figuring if it is path pointing to a file, pointing to a directory or else a model id or URL
   # This step is required in order to determine config_file_name
   if pretrained_model_name.is_file():
     UpperCAmelCase          =	pretrained_model_name.name
     UpperCAmelCase          =	pretrained_model_name.parent
   # dir path
   elif pretrained_model_name.is_dir():
     pass
   # model id or URL
   else:
     UpperCAmelCase          =	gen_config_arg

   UpperCAmelCase          =	GenerationConfig.from_pretrained(_SCREAMING_SNAKE_CASE      ,    _SCREAMING_SNAKE_CASE     )
   return gen_config


 def _UpperCamelCase						(    self		:			Optional[Any]      ,    lowerCAmelCase__		:			Optional[Dataset] = None      ,    lowerCAmelCase__		:			Optional[List[str]] = None      ,    lowerCAmelCase__		:			str = "eval"      ,    **lowerCAmelCase__		:			str      ,    )     ->   Dict[str, float]:
   UpperCAmelCase          =	gen_kwargs.copy()
   if gen_kwargs.get("max_length"     ) is None and gen_kwargs.get("max_new_tokens"     ) is None:
     UpperCAmelCase          =	self.args.generation_max_length
   UpperCAmelCase          =	(
       gen_kwargs["num_beams"] if gen_kwargs.get("num_beams"     ) is not None else self.args.generation_num_beams
   )
   UpperCAmelCase          =	gen_kwargs

   return super().evaluate(_SCREAMING_SNAKE_CASE      ,    ignore_keys=_SCREAMING_SNAKE_CASE      ,    metric_key_prefix=_SCREAMING_SNAKE_CASE     )


 def _UpperCamelCase						(    self		:			Dict      ,    lowerCAmelCase__		:			Dataset      ,    lowerCAmelCase__		:			Optional[List[str]] = None      ,    lowerCAmelCase__		:			str = "test"      ,    **lowerCAmelCase__		:			int      ,    )     ->   "PredictionOutput":
   UpperCAmelCase          =	gen_kwargs.copy()
   if gen_kwargs.get("max_length"     ) is None and gen_kwargs.get("max_new_tokens"     ) is None:
     UpperCAmelCase          =	self.args.generation_max_length
   UpperCAmelCase          =	(
       gen_kwargs["num_beams"] if gen_kwargs.get("num_beams"     ) is not None else self.args.generation_num_beams
   )
   UpperCAmelCase          =	gen_kwargs

   return super().predict(_SCREAMING_SNAKE_CASE      ,    ignore_keys=_SCREAMING_SNAKE_CASE      ,    metric_key_prefix=_SCREAMING_SNAKE_CASE     )


 def _UpperCamelCase						(    self		:			Optional[int]      ,    lowerCAmelCase__		:			nn.Module      ,    lowerCAmelCase__		:			Dict[str, Union[torch.Tensor, Any]]      ,    lowerCAmelCase__		:			bool      ,    lowerCAmelCase__		:			Optional[List[str]] = None      ,    **lowerCAmelCase__		:			int      ,    )     ->   Tuple[Optional[float], Optional[torch.Tensor], Optional[torch.Tensor]]:

   if not self.args.predict_with_generate or prediction_loss_only:
     return super().prediction_step(
         _SCREAMING_SNAKE_CASE      ,    _SCREAMING_SNAKE_CASE      ,    prediction_loss_only=_SCREAMING_SNAKE_CASE      ,    ignore_keys=_SCREAMING_SNAKE_CASE     )

   UpperCAmelCase          =	"labels" in inputs
   UpperCAmelCase          =	self._prepare_inputs(_SCREAMING_SNAKE_CASE     )

   # XXX: adapt synced_gpus for fairscale as well
   # Priority (handled in generate):
   # gen_kwargs > model.generation_config > default GenerationConfig()

   if len(_SCREAMING_SNAKE_CASE     ) == 0 and hasattr(self      ,    "_gen_kwargs"     ):
     UpperCAmelCase          =	self._gen_kwargs.copy()

   if gen_kwargs.get("max_length"     ) is None and gen_kwargs.get("max_new_tokens"     ) is None:
     UpperCAmelCase          =	self.model.config.max_length
   UpperCAmelCase          =	(
       gen_kwargs["num_beams"] if gen_kwargs.get("num_beams"     ) is not None else self.model.config.num_beams
   )
   UpperCAmelCase          =	True if is_deepspeed_zeroa_enabled() else False
   UpperCAmelCase          =	(
       gen_kwargs["synced_gpus"] if gen_kwargs.get("synced_gpus"     ) is not None else default_synced_gpus
   )

   # If the `decoder_input_ids` was created from `labels`, evict the former, so that the model can freely generate
   # (otherwise, it would continue generating from the padded `decoder_input_ids`)
   if (
       "labels" in inputs
       and "decoder_input_ids" in inputs
       and inputs["labels"].shape == inputs["decoder_input_ids"].shape
   ):
     UpperCAmelCase          =	{k: v for k, v in inputs.items() if k != "decoder_input_ids"}
   UpperCAmelCase          =	self.model.generate(**_SCREAMING_SNAKE_CASE      ,    **_SCREAMING_SNAKE_CASE     )

   # Temporary hack to ensure the generation config is not initialized for each iteration of the evaluation loop
   # TODO: remove this hack when the legacy code that initializes generation_config from a model config is
   # removed in https://github.com/huggingface/transformers/blob/98d88b23f54e5a23e741833f1e973fdf600cc2c5/src/transformers/generation/utils.py#L1183
   if self.model.generation_config._from_model_config:
     UpperCAmelCase          =	False

   # Retrieves GenerationConfig from model.generation_config
   UpperCAmelCase          =	self.model.generation_config
   # in case the batch is shorter than max length, the output should be padded
   if generated_tokens.shape[-1] < gen_config.max_length:
     UpperCAmelCase          =	self._pad_tensors_to_max_len(_SCREAMING_SNAKE_CASE      ,    gen_config.max_length     )
   elif gen_config.max_new_tokens is not None and generated_tokens.shape[-1] < gen_config.max_new_tokens + 1:
     UpperCAmelCase          =	self._pad_tensors_to_max_len(_SCREAMING_SNAKE_CASE      ,    gen_config.max_new_tokens + 1     )

   with torch.no_grad():
     if has_labels:
       with self.compute_loss_context_manager():
         UpperCAmelCase          =	model(**_SCREAMING_SNAKE_CASE     )
       if self.label_smoother is not None:
         UpperCAmelCase          =	self.label_smoother(_SCREAMING_SNAKE_CASE      ,    inputs["labels"]     ).mean().detach()
       else:
         UpperCAmelCase          =	(outputs["loss"] if isinstance(_SCREAMING_SNAKE_CASE      ,    _SCREAMING_SNAKE_CASE     ) else outputs[0]).mean().detach()
     else:
       UpperCAmelCase          =	None

   if self.args.prediction_loss_only:
     return loss, None, None

   if has_labels:
     UpperCAmelCase          =	inputs["labels"]
     if labels.shape[-1] < gen_config.max_length:
       UpperCAmelCase          =	self._pad_tensors_to_max_len(_SCREAMING_SNAKE_CASE      ,    gen_config.max_length     )
     elif gen_config.max_new_tokens is not None and labels.shape[-1] < gen_config.max_new_tokens + 1:
       UpperCAmelCase          =	self._pad_tensors_to_max_len(_SCREAMING_SNAKE_CASE      ,    gen_config.max_new_tokens + 1     )
   else:
     UpperCAmelCase          =	None

   return loss, generated_tokens, labels


 def _UpperCamelCase						(    self		:			List[str]      ,    lowerCAmelCase__		:			str      ,    lowerCAmelCase__		:			Any     )     ->   Optional[int]:
   if self.tokenizer is not None and hasattr(self.tokenizer      ,    "pad_token_id"     ):
     # If PAD token is not defined at least EOS token has to be defined
     UpperCAmelCase          =	(
         self.tokenizer.pad_token_id if self.tokenizer.pad_token_id is not None else self.tokenizer.eos_token_id
     )
   else:
     if self.model.config.pad_token_id is not None:
       UpperCAmelCase          =	self.model.config.pad_token_id
     else:
       raise ValueError("Pad_token_id must be set in the configuration of the model, in order to pad tensors"     )

   UpperCAmelCase          =	pad_token_id * torch.ones(
       (tensor.shape[0], max_length)      ,    dtype=tensor.dtype      ,    device=tensor.device     )
   UpperCAmelCase          =	tensor
   return padded_tensor











from typing import List

from packaging import version
from sklearn.metrics import fa_score

import datasets
from datasets.config import PY_VERSION


if PY_VERSION < version.parse('3.8'):
					import importlib_metadata
else:
					import importlib.metadata as importlib_metadata


# TODO(Patrick/Anton)
lowerCAmelCase_     =			'\\n'

lowerCAmelCase_     =			'\\n    XTREME-S is a benchmark to evaluate universal cross-lingual speech representations in many languages.\n    XTREME-S covers four task families: speech recognition, classification, speech-to-text translation and retrieval.\n'

lowerCAmelCase_     =			'\nCompute XTREME-S evaluation metric associated to each XTREME-S dataset.\nArgs:\n    predictions: list of predictions to score.\n        Each translation should be tokenized into a list of tokens.\n    references: list of lists of references for each translation.\n        Each reference should be tokenized into a list of tokens.\n    bleu_kwargs: optional dict of keywords to be passed when computing \'bleu\'.\n        Keywords include Dict can be one of \'smooth_method\', \'smooth_value\', \'force\', \'lowercase\',\n        \'tokenize\', \'use_effective_order\'.\n    wer_kwargs: optional dict of keywords to be passed when computing \'wer\' and \'cer\'.\n        Keywords include \'concatenate_texts\'.\nReturns: depending on the XTREME-S task, one or several of:\n    "accuracy": Accuracy - for \'fleurs-lang_id\', \'minds14\'\n    "f1": F1 score - for \'minds14\'\n    "wer": Word error rate - for \'mls\', \'fleurs-asr\', \'voxpopuli\', \'babel\'\n    "cer": Character error rate - for \'mls\', \'fleurs-asr\', \'voxpopuli\', \'babel\'\n    "bleu": BLEU score according to the `sacrebleu` metric - for \'covost2\'\nExamples:\n\n    >>> xtreme_s_metric = datasets.load_metric(\'xtreme_s\', \'mls\')  # \'mls\', \'voxpopuli\', \'fleurs-asr\' or \'babel\'\n    >>> references = ["it is sunny here", "paper and pen are essentials"]\n    >>> predictions = ["it\'s sunny", "paper pen are essential"]\n    >>> results = xtreme_s_metric.compute(predictions=predictions, references=references)\n    >>> print({k: round(v, 2) for k, v in results.items()})\n    {\'wer\': 0.56, \'cer\': 0.27}\n\n    >>> xtreme_s_metric = datasets.load_metric(\'xtreme_s\', \'covost2\')\n    >>> references = ["bonjour paris", "il est necessaire de faire du sport de temps en temp"]\n    >>> predictions = ["bonjour paris", "il est important de faire du sport souvent"]\n    >>> results = xtreme_s_metric.compute(predictions=predictions, references=references)\n    >>> print({k: round(v, 2) for k, v in results.items()})\n    {\'bleu\': 31.65}\n\n    >>> xtreme_s_metric = datasets.load_metric(\'xtreme_s\', \'fleurs-lang_id\')\n    >>> references = [0, 1, 0, 0, 1]\n    >>> predictions = [0, 1, 1, 0, 0]\n    >>> results = xtreme_s_metric.compute(predictions=predictions, references=references)\n    >>> print({k: round(v, 2) for k, v in results.items()})\n    {\'accuracy\': 0.6}\n\n    >>> xtreme_s_metric = datasets.load_metric(\'xtreme_s\', \'minds14\')\n    >>> references = [0, 1, 0, 0, 1]\n    >>> predictions = [0, 1, 1, 0, 0]\n    >>> results = xtreme_s_metric.compute(predictions=predictions, references=references)\n    >>> print({k: round(v, 2) for k, v in results.items()})\n    {\'f1\': 0.58, \'accuracy\': 0.6}\n'

lowerCAmelCase_     =			['fleurs-asr', 'mls', 'voxpopuli', 'babel', 'covost2', 'fleurs-lang_id', 'minds14']
lowerCAmelCase_     =			''

try:
					from jiwer import transforms as tr

					lowerCAmelCase_     =			True
except ImportError:
					lowerCAmelCase_     =			False

if _jiwer_available and version.parse(importlib_metadata.version('jiwer')) < version.parse('2.3.0'):
					class   UpperCamelCase			(					tr.AbstractTransform			):







							"""simple docstring"""



							def __init__(	self		:							Any    ,_SCREAMING_SNAKE_CASE		:							str = " "		)     -> Dict:


											'''simple docstring'''
											A									=   sentence_delimiter
							def    A(	self		:							Optional[int]    ,_SCREAMING_SNAKE_CASE		:							str		)     -> int:


											'''simple docstring'''
											return list(_SCREAMING_SNAKE_CASE		)







							def    A(	self		:							Optional[Any]    ,_SCREAMING_SNAKE_CASE		:							List[str]		)     -> Tuple:


											'''simple docstring'''
											A									=   []
											for sent_idx, sentence in enumerate(_SCREAMING_SNAKE_CASE		):
															chars.extend(self.process_string(_SCREAMING_SNAKE_CASE		)		)
															if self.sentence_delimiter is not None and self.sentence_delimiter != "" and sent_idx < len(_SCREAMING_SNAKE_CASE		) - 1:
																			chars.append(self.sentence_delimiter		)
											return chars


					lowerCAmelCase_     =			tr.Compose(
					    [tr.RemoveMultipleSpaces(), tr.Strip(), SentencesToListOfCharacters(SENTENCE_DELIMITER)]
					)
elif _jiwer_available:
					lowerCAmelCase_     =			tr.Compose(
					    [
					        tr.RemoveMultipleSpaces(),
					        tr.Strip(),
					        tr.ReduceToSingleSentence(SENTENCE_DELIMITER),
					        tr.ReduceToListOfListOfChars(),
					    ]
					)
else:
					lowerCAmelCase_     =			None







def   snake_case		(				UpperCAmelCase						:							List[str],    UpperCAmelCase						:							Tuple ):
				return float((preds == labels).mean() )







def   snake_case		(				UpperCAmelCase						:							int,    UpperCAmelCase						:							Tuple ):
				return {
				    "f1": float(fa_score(y_true=UpperCAmelCase,    y_pred=UpperCAmelCase,    average='macro' ) ),
				    "accuracy": simple_accuracy(UpperCAmelCase,    UpperCAmelCase ),
				}







def   snake_case		(				UpperCAmelCase						:							Tuple,    UpperCAmelCase						:							List[str],    UpperCAmelCase						:							List[Any]="exp",    UpperCAmelCase						:							List[Any]=None,    UpperCAmelCase						:							int=False,    UpperCAmelCase						:							Dict=False,    UpperCAmelCase						:							List[Any]=None,    UpperCAmelCase						:							str=False,    ):
				# xtreme-s can only have one label
				A									=   [[label] for label in labels]
				A									=   list(UpperCAmelCase )
				try:
								import sacrebleu as scb
				except ImportError:
								raise ValueError(
								    'sacrebleu has to be installed in order to apply the bleu metric for covost2.'
								    'You can install it via `pip install sacrebleu`.' )

				if version.parse(scb.__version__ ) < version.parse('1.4.12' ):
								raise ImportWarning(
								    'To use `sacrebleu`, the module `sacrebleu>=1.4.12` is required, and the current version of `sacrebleu` doesn\'t match this condition.\n'
								    'You can install it with `pip install "sacrebleu>=1.4.12"`.' )

				A									=   len(labels[0] )
				if any(len(UpperCAmelCase ) != references_per_prediction for refs in labels ):
								raise ValueError('Sacrebleu requires the same number of references for each prediction' )
				A									=   [[refs[i] for refs in labels] for i in range(UpperCAmelCase )]
				A									=   scb.corpus_bleu(
				    UpperCAmelCase,    UpperCAmelCase,    smooth_method=UpperCAmelCase,    smooth_value=UpperCAmelCase,    force=UpperCAmelCase,    lowercase=UpperCAmelCase,    use_effective_order=UpperCAmelCase,    **({'tokenize': tokenize} if tokenize else {}),    )
				return {"bleu": output.score}







def   snake_case		(				UpperCAmelCase						:							Tuple,    UpperCAmelCase						:							Tuple,    UpperCAmelCase						:							Optional[Any],    UpperCAmelCase						:							Optional[int] ):
				try:
								from jiwer import compute_measures
				except ImportError:
								raise ValueError(
								    f'jiwer has to be installed in order to apply the wer metric for {config_name}.'
								    'You can install it via `pip install jiwer`.' )

				if concatenate_texts:
								A									=   compute_measures(UpperCAmelCase,    UpperCAmelCase )['wer']

								A									=   compute_measures(UpperCAmelCase,    UpperCAmelCase,    truth_transform=UpperCAmelCase,    hypothesis_transform=UpperCAmelCase )['wer']
								return {"wer": wer, "cer": cer}
				else:

								def compute_score(UpperCAmelCase						:							Optional[int],    UpperCAmelCase						:							Tuple,    UpperCAmelCase						:							List[Any]="wer" ):
												A									=   0
												A									=   0
												for prediction, reference in zip(UpperCAmelCase,    UpperCAmelCase ):
																if score_type == "wer":
																				A									=   compute_measures(UpperCAmelCase,    UpperCAmelCase )
																elif score_type == "cer":
																				A									=   compute_measures(
																				    UpperCAmelCase,    UpperCAmelCase,    truth_transform=UpperCAmelCase,    hypothesis_transform=UpperCAmelCase )
																incorrect += measures["substitutions"] + measures["deletions"] + measures["insertions"]
																total += measures["substitutions"] + measures["deletions"] + measures["hits"]
												return incorrect / total

								return {"wer": compute_score(UpperCAmelCase,    UpperCAmelCase,    'wer' ), "cer": compute_score(UpperCAmelCase,    UpperCAmelCase,    'cer' )}



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







		"""simple docstring"""



		def    A(	self		:							Any		)     -> str:


						'''simple docstring'''
						if self.config_name not in _CONFIG_NAMES:
										raise KeyError(f'You should supply a configuration name selected in {_CONFIG_NAMES}'		)

						A									=   'int64' if self.config_name in ['fleurs-lang_id', 'minds14'] else 'string'

						return datasets.MetricInfo(
						    description=_DESCRIPTION    ,citation=_CITATION    ,inputs_description=_KWARGS_DESCRIPTION    ,features=datasets.Features(
						        {'predictions': datasets.Value(_SCREAMING_SNAKE_CASE		), 'references': datasets.Value(_SCREAMING_SNAKE_CASE		)}		)    ,codebase_urls=[]    ,reference_urls=[]    ,format='numpy'    ,)







		def    A(	self		:							Optional[Any]    ,_SCREAMING_SNAKE_CASE		:							str    ,_SCREAMING_SNAKE_CASE		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							Dict=None    ,_SCREAMING_SNAKE_CASE		:							List[Any]=None		)     -> Tuple:


						'''simple docstring'''
						A									=   bleu_kwargs if bleu_kwargs is not None else {}
						A									=   wer_kwargs if wer_kwargs is not None else {}

						if self.config_name == "fleurs-lang_id":
										return {"accuracy": simple_accuracy(_SCREAMING_SNAKE_CASE    ,_SCREAMING_SNAKE_CASE		)}
						elif self.config_name == "minds14":
										return fa_and_simple_accuracy(_SCREAMING_SNAKE_CASE    ,_SCREAMING_SNAKE_CASE		)
						elif self.config_name == "covost2":
										A									=   bleu_kwargs.pop('smooth_method'    ,'exp'		)
										A									=   bleu_kwargs.pop('smooth_value'    ,_SCREAMING_SNAKE_CASE		)
										A									=   bleu_kwargs.pop('force'    ,_SCREAMING_SNAKE_CASE		)
										A									=   bleu_kwargs.pop('lowercase'    ,_SCREAMING_SNAKE_CASE		)
										A									=   bleu_kwargs.pop('tokenize'    ,_SCREAMING_SNAKE_CASE		)
										A									=   bleu_kwargs.pop('use_effective_order'    ,_SCREAMING_SNAKE_CASE		)
										return bleu(
										    preds=_SCREAMING_SNAKE_CASE    ,labels=_SCREAMING_SNAKE_CASE    ,smooth_method=_SCREAMING_SNAKE_CASE    ,smooth_value=_SCREAMING_SNAKE_CASE    ,force=_SCREAMING_SNAKE_CASE    ,lowercase=_SCREAMING_SNAKE_CASE    ,tokenize=_SCREAMING_SNAKE_CASE    ,use_effective_order=_SCREAMING_SNAKE_CASE    ,)
						elif self.config_name in ["fleurs-asr", "mls", "voxpopuli", "babel"]:
										A									=   wer_kwargs.pop('concatenate_texts'    ,_SCREAMING_SNAKE_CASE		)
										return wer_and_cer(_SCREAMING_SNAKE_CASE    ,_SCREAMING_SNAKE_CASE    ,_SCREAMING_SNAKE_CASE    ,self.config_name		)
						else:
										raise KeyError(f'You should supply a configuration name selected in {_CONFIG_NAMES}'		)





