



"""simple docstring"""






from typing import Optional

import torch
import torch.utils.checkpoint
from torch import Tensor, nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_outputs import (
    BaseModelOutputWithNoAttention,
    BaseModelOutputWithPoolingAndNoAttention,
    ImageClassifierOutputWithNoAttention,
)
from ...modeling_utils import PreTrainedModel
from ...utils import logging
from .configuration_regnet import RegNetConfig


_lowercase			:			List[str]										=						logging.get_logger(__name__)

# General docstring
_lowercase			:			Union[str, Any]										=						"RegNetConfig"

# Base docstring
_lowercase			:			Optional[Any]										=						"facebook/regnet-y-040"
_lowercase			:			List[str]										=						[1, 1_0_8_8, 7, 7]

# Image classification docstring
_lowercase			:			List[Any]										=						"facebook/regnet-y-040"
_lowercase			:			Any										=						"tabby, tabby cat"

_lowercase			:			List[Any]										=						[
    "facebook/regnet-y-040",
    # See all regnet models at https://huggingface.co/models?filter=regnet
]

class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  Optional[Any],  lowerCamelCase							:  int,  lowerCamelCase							:  int,  lowerCamelCase							:  int = 3,  lowerCamelCase							:  int = 1,  lowerCamelCase							:  int = 1,  lowerCamelCase							:  Optional[str] = "relu",  )-> Dict:
								super().__init__()
								lowerCamelCase__		:		str		     =nn.Convad(
								    lowerCamelCase,  lowerCamelCase,  kernel_size=lowerCamelCase,  stride=lowerCamelCase,  padding=kernel_size // 2,  groups=lowerCamelCase,  bias=lowerCamelCase,  )
								lowerCamelCase__		:		str		     =nn.BatchNormad(lowerCamelCase					)
								lowerCamelCase__		:		Dict		     =ACTaFN[activation] if activation is not None else nn.Identity()




					def 		snake_case	(	self							:  Any,  lowerCamelCase							:  List[str]					)-> Optional[Any]:
								lowerCamelCase__		:		Optional[int]		     =self.convolution(lowerCamelCase					)
								lowerCamelCase__		:		List[str]		     =self.normalization(lowerCamelCase					)
								lowerCamelCase__		:		int		     =self.activation(lowerCamelCase					)
								return hidden_state





class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  Tuple,  lowerCamelCase							:  RegNetConfig					)-> Tuple:
								super().__init__()
								lowerCamelCase__		:		List[Any]		     =RegNetConvLayer(
								    config.num_channels,  config.embedding_size,  kernel_size=3,  stride=2,  activation=config.hidden_act					)
								lowerCamelCase__		:		Union[str, Any]		     =config.num_channels




					def 		snake_case	(	self							:  Optional[int],  lowerCamelCase							:  Optional[Any]					)-> int:
								lowerCamelCase__		:		Dict		     =pixel_values.shape[1]
								if num_channels != self.num_channels:
											raise ValueError(
											    '''Make sure that the channel dimension of the pixel values match with the one set in the configuration.'''					)
								lowerCamelCase__		:		int		     =self.embedder(lowerCamelCase					)
								return hidden_state





class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  Dict,  lowerCamelCase							:  int,  lowerCamelCase							:  int,  lowerCamelCase							:  int = 2					)-> Any:
								super().__init__()
								lowerCamelCase__		:		Dict		     =nn.Convad(lowerCamelCase,  lowerCamelCase,  kernel_size=1,  stride=lowerCamelCase,  bias=lowerCamelCase					)
								lowerCamelCase__		:		Optional[int]		     =nn.BatchNormad(lowerCamelCase					)




					def 		snake_case	(	self							:  int,  lowerCamelCase							:  Tensor					)-> Tensor:
								lowerCamelCase__		:		List[str]		     =self.convolution(lowerCamelCase					)
								lowerCamelCase__		:		str		     =self.normalization(lowerCamelCase					)
								return hidden_state





class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  Tuple,  lowerCamelCase							:  int,  lowerCamelCase							:  int					)-> Optional[Any]:
								super().__init__()

								lowerCamelCase__		:		List[str]		     =nn.AdaptiveAvgPoolad((1, 1)					)
								lowerCamelCase__		:		List[Any]		     =nn.Sequential(
								    nn.Convad(lowerCamelCase,  lowerCamelCase,  kernel_size=1					),  nn.ReLU(),  nn.Convad(lowerCamelCase,  lowerCamelCase,  kernel_size=1					),  nn.Sigmoid(),  )




					def 		snake_case	(	self							:  Dict,  lowerCamelCase							:  Optional[int]					)-> str:
								# b c h w -> b c 1 1
								lowerCamelCase__		:		Optional[int]		     =self.pooler(lowerCamelCase					)
								lowerCamelCase__		:		Union[str, Any]		     =self.attention(lowerCamelCase					)
								lowerCamelCase__		:		Optional[int]		     =hidden_state * attention
								return hidden_state





class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  str,  lowerCamelCase							:  RegNetConfig,  lowerCamelCase							:  int,  lowerCamelCase							:  int,  lowerCamelCase							:  int = 1					)-> Optional[int]:
								super().__init__()
								lowerCamelCase__		:		Any		     =in_channels != out_channels or stride != 1
								lowerCamelCase__		:		Optional[Any]		     =max(1,  out_channels // config.groups_width					)
								lowerCamelCase__		:		Any		     =(
								    RegNetShortCut(lowerCamelCase,  lowerCamelCase,  stride=lowerCamelCase					) if should_apply_shortcut else nn.Identity()
								)
								lowerCamelCase__		:		Optional[Any]		     =nn.Sequential(
								    RegNetConvLayer(lowerCamelCase,  lowerCamelCase,  kernel_size=1,  activation=config.hidden_act					),  RegNetConvLayer(lowerCamelCase,  lowerCamelCase,  stride=lowerCamelCase,  groups=lowerCamelCase,  activation=config.hidden_act					),  RegNetConvLayer(lowerCamelCase,  lowerCamelCase,  kernel_size=1,  activation=lowerCamelCase					),  )
								lowerCamelCase__		:		str		     =ACTaFN[config.hidden_act]




					def 		snake_case	(	self							:  Union[str, Any],  lowerCamelCase							:  str					)-> List[Any]:
								lowerCamelCase__		:		Any		     =hidden_state
								lowerCamelCase__		:		Optional[Any]		     =self.layer(lowerCamelCase					)
								lowerCamelCase__		:		Dict		     =self.shortcut(lowerCamelCase					)
								hidden_state += residual
								lowerCamelCase__		:		str		     =self.activation(lowerCamelCase					)
								return hidden_state





class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  int,  lowerCamelCase							:  RegNetConfig,  lowerCamelCase							:  int,  lowerCamelCase							:  int,  lowerCamelCase							:  int = 1					)-> Any:
								super().__init__()
								lowerCamelCase__		:		Optional[Any]		     =in_channels != out_channels or stride != 1
								lowerCamelCase__		:		Any		     =max(1,  out_channels // config.groups_width					)
								lowerCamelCase__		:		Dict		     =(
								    RegNetShortCut(lowerCamelCase,  lowerCamelCase,  stride=lowerCamelCase					) if should_apply_shortcut else nn.Identity()
								)
								lowerCamelCase__		:		Dict		     =nn.Sequential(
								    RegNetConvLayer(lowerCamelCase,  lowerCamelCase,  kernel_size=1,  activation=config.hidden_act					),  RegNetConvLayer(lowerCamelCase,  lowerCamelCase,  stride=lowerCamelCase,  groups=lowerCamelCase,  activation=config.hidden_act					),  RegNetSELayer(lowerCamelCase,  reduced_channels=int(round(in_channels / 4					)					)					),  RegNetConvLayer(lowerCamelCase,  lowerCamelCase,  kernel_size=1,  activation=lowerCamelCase					),  )
								lowerCamelCase__		:		Optional[int]		     =ACTaFN[config.hidden_act]




					def 		snake_case	(	self							:  str,  lowerCamelCase							:  int					)-> Dict:
								lowerCamelCase__		:		Dict		     =hidden_state
								lowerCamelCase__		:		Any		     =self.layer(lowerCamelCase					)
								lowerCamelCase__		:		Optional[Any]		     =self.shortcut(lowerCamelCase					)
								hidden_state += residual
								lowerCamelCase__		:		Tuple		     =self.activation(lowerCamelCase					)
								return hidden_state





class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  Any,  lowerCamelCase							:  RegNetConfig,  lowerCamelCase							:  int,  lowerCamelCase							:  int,  lowerCamelCase							:  int = 2,  lowerCamelCase							:  int = 2,  )-> List[Any]:
								super().__init__()

								lowerCamelCase__		:		Optional[int]		     =RegNetXLayer if config.layer_type == '''x''' else RegNetYLayer

								lowerCamelCase__		:		Optional[Any]		     =nn.Sequential(
								    # downsampling is done in the first layer with stride of 2
								    layer(
								        lowerCamelCase,  lowerCamelCase,  lowerCamelCase,  stride=lowerCamelCase,  ),  *[layer(lowerCamelCase,  lowerCamelCase,  lowerCamelCase					) for _ in range(depth - 1					)],  )




					def 		snake_case	(	self							:  List[str],  lowerCamelCase							:  int					)-> Optional[Any]:
								lowerCamelCase__		:		Optional[Any]		     =self.layers(lowerCamelCase					)
								return hidden_state





class 	__SCREAMING_SNAKE_CASE     (				nn.Module       ):


					'''simple docstring'''





					def __init__(	self							:  int,  lowerCamelCase							:  RegNetConfig					)-> Union[str, Any]:
								super().__init__()
								lowerCamelCase__		:		Optional[Any]		     =nn.ModuleList([]					)
								# based on `downsample_in_first_stage`, the first layer of the first stage may or may not downsample the input
								self.stages.append(
								    RegNetStage(
								        lowerCamelCase,  config.embedding_size,  config.hidden_sizes[0],  stride=2 if config.downsample_in_first_stage else 1,  depth=config.depths[0],  )					)
								lowerCamelCase__		:		List[Any]		     =zip(config.hidden_sizes,  config.hidden_sizes[1:]					)
								for (in_channels, out_channels), depth in zip(lowerCamelCase,  config.depths[1:]					):
											self.stages.append(RegNetStage(lowerCamelCase,  lowerCamelCase,  lowerCamelCase,  depth=lowerCamelCase					)					)




					def 		snake_case	(	self							:  Union[str, Any],  lowerCamelCase							:  Tensor,  lowerCamelCase							:  bool = False,  lowerCamelCase							:  bool = True					)-> BaseModelOutputWithNoAttention:
								lowerCamelCase__		:		Union[str, Any]		     =() if output_hidden_states else None

								for stage_module in self.stages:
											if output_hidden_states:
														lowerCamelCase__		:		Tuple		     =hidden_states + (hidden_state,)

											lowerCamelCase__		:		List[Any]		     =stage_module(lowerCamelCase					)

								if output_hidden_states:
											lowerCamelCase__		:		List[Any]		     =hidden_states + (hidden_state,)

								if not return_dict:
											return tuple(v for v in [hidden_state, hidden_states] if v is not None					)

								return BaseModelOutputWithNoAttention(last_hidden_state=lowerCamelCase,  hidden_states=lowerCamelCase					)





class 	__SCREAMING_SNAKE_CASE     (				lowerCAmelCase_       ):


					'''simple docstring'''





					_a             =							RegNetConfig
					_a             =							'regnet'
					_a             =							'pixel_values'
					_a             =							True



					def 		snake_case	(	self							:  Optional[Any],  lowerCamelCase							:  Optional[Any]					)-> List[Any]:
								if isinstance(lowerCamelCase,  nn.Convad					):
											nn.init.kaiming_normal_(module.weight,  mode='''fan_out''',  nonlinearity='''relu'''					)
								elif isinstance(lowerCamelCase,  (nn.BatchNormad, nn.GroupNorm)					):
											nn.init.constant_(module.weight,  1					)
											nn.init.constant_(module.bias,  0					)




					def 		snake_case	(	self							:  Optional[int],  lowerCamelCase							:  Any,  lowerCamelCase							:  str=False					)-> Union[str, Any]:
								if isinstance(lowerCamelCase,  lowerCamelCase					):
											lowerCamelCase__		:		List[str]		     =value





_lowercase			:			int										=						r"\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it\n    as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`RegNetConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n"

_lowercase			:			Optional[int]										=						r"\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`ConvNextImageProcessor.__call__`] for details.\n\n        output_hidden_states (`bool`, *optional*):\n            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for\n            more detail.\n        return_dict (`bool`, *optional*):\n            Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.\n"

@add_start_docstrings(
    'The bare RegNet model outputting raw features without any specific head on top.'		,       lowerCAmelCase_		,       )
# Copied from transformers.models.resnet.modeling_resnet.ResNetModel with RESNET->REGNET,ResNet->RegNet
class 	__SCREAMING_SNAKE_CASE     (				lowerCAmelCase_       ):


					'''simple docstring'''





					def __init__(	self							:  Optional[int],  lowerCamelCase							:  Dict					)-> Tuple:
								super().__init__(lowerCamelCase					)
								lowerCamelCase__		:		Optional[int]		     =config
								lowerCamelCase__		:		Union[str, Any]		     =RegNetEmbeddings(lowerCamelCase					)
								lowerCamelCase__		:		Tuple		     =RegNetEncoder(lowerCamelCase					)
								lowerCamelCase__		:		Any		     =nn.AdaptiveAvgPoolad((1, 1)					)
								# Initialize weights and apply final processing
								self.post_init()




					@add_start_docstrings_to_model_forward(lowerCamelCase					)
					@add_code_sample_docstrings(
					    checkpoint=_CHECKPOINT_FOR_DOC,  output_type=lowerCamelCase,  config_class=_CONFIG_FOR_DOC,  modality='''vision''',  expected_output=_EXPECTED_OUTPUT_SHAPE,  )
					def 		snake_case	(	self							:  int,  lowerCamelCase							:  Tensor,  lowerCamelCase							:  Optional[bool] = None,  lowerCamelCase							:  Optional[bool] = None					)-> BaseModelOutputWithPoolingAndNoAttention:
								lowerCamelCase__		:		int		     =(
								    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
								)
								lowerCamelCase__		:		Optional[int]		     =return_dict if return_dict is not None else self.config.use_return_dict

								lowerCamelCase__		:		Optional[int]		     =self.embedder(lowerCamelCase					)

								lowerCamelCase__		:		Tuple		     =self.encoder(
								    lowerCamelCase,  output_hidden_states=lowerCamelCase,  return_dict=lowerCamelCase					)

								lowerCamelCase__		:		Dict		     =encoder_outputs[0]

								lowerCamelCase__		:		str		     =self.pooler(lowerCamelCase					)

								if not return_dict:
											return (last_hidden_state, pooled_output) + encoder_outputs[1:]

								return BaseModelOutputWithPoolingAndNoAttention(
								    last_hidden_state=lowerCamelCase,  pooler_output=lowerCamelCase,  hidden_states=encoder_outputs.hidden_states,  )





@add_start_docstrings(
    '\n    RegNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n    ImageNet.\n    '		,       lowerCAmelCase_		,       )
# Copied from transformers.models.resnet.modeling_resnet.ResNetForImageClassification with RESNET->REGNET,ResNet->RegNet,resnet->regnet
class 	__SCREAMING_SNAKE_CASE     (				lowerCAmelCase_       ):


					'''simple docstring'''





					def __init__(	self							:  Optional[int],  lowerCamelCase							:  List[Any]					)-> Optional[int]:
								super().__init__(lowerCamelCase					)
								lowerCamelCase__		:		Dict		     =config.num_labels
								lowerCamelCase__		:		Union[str, Any]		     =RegNetModel(lowerCamelCase					)
								# classification head
								lowerCamelCase__		:		Optional[int]		     =nn.Sequential(
								    nn.Flatten(),  nn.Linear(config.hidden_sizes[-1],  config.num_labels					) if config.num_labels > 0 else nn.Identity(),  )
								# initialize weights and apply final processing
								self.post_init()




					@add_start_docstrings_to_model_forward(lowerCamelCase					)
					@add_code_sample_docstrings(
					    checkpoint=_IMAGE_CLASS_CHECKPOINT,  output_type=lowerCamelCase,  config_class=_CONFIG_FOR_DOC,  expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT,  )
					def 		snake_case	(	self							:  Optional[Any],  lowerCamelCase							:  Optional[torch.FloatTensor] = None,  lowerCamelCase							:  Optional[torch.LongTensor] = None,  lowerCamelCase							:  Optional[bool] = None,  lowerCamelCase							:  Optional[bool] = None,  )-> ImageClassifierOutputWithNoAttention:
								lowerCamelCase__		:		str		     =return_dict if return_dict is not None else self.config.use_return_dict

								lowerCamelCase__		:		List[Any]		     =self.regnet(lowerCamelCase,  output_hidden_states=lowerCamelCase,  return_dict=lowerCamelCase					)

								lowerCamelCase__		:		List[Any]		     =outputs.pooler_output if return_dict else outputs[1]

								lowerCamelCase__		:		Tuple		     =self.classifier(lowerCamelCase					)

								lowerCamelCase__		:		Dict		     =None

								if labels is not None:
											if self.config.problem_type is None:
														if self.num_labels == 1:
																	lowerCamelCase__		:		int		     ='''regression'''
														elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
																	lowerCamelCase__		:		List[Any]		     ='''single_label_classification'''
														else:
																	lowerCamelCase__		:		Dict		     ='''multi_label_classification'''
											if self.config.problem_type == "regression":
														lowerCamelCase__		:		Optional[int]		     =MSELoss()
														if self.num_labels == 1:
																	lowerCamelCase__		:		List[str]		     =loss_fct(logits.squeeze(),  labels.squeeze()					)
														else:
																	lowerCamelCase__		:		int		     =loss_fct(lowerCamelCase,  lowerCamelCase					)
											elif self.config.problem_type == "single_label_classification":
														lowerCamelCase__		:		List[Any]		     =CrossEntropyLoss()
														lowerCamelCase__		:		Optional[int]		     =loss_fct(logits.view(-1,  self.num_labels					),  labels.view(-1					)					)
											elif self.config.problem_type == "multi_label_classification":
														lowerCamelCase__		:		Union[str, Any]		     =BCEWithLogitsLoss()
														lowerCamelCase__		:		Optional[Any]		     =loss_fct(lowerCamelCase,  lowerCamelCase					)

								if not return_dict:
											lowerCamelCase__		:		Dict		     =(logits,) + outputs[2:]
											return (loss,) + output if loss is not None else output

								return ImageClassifierOutputWithNoAttention(loss=lowerCamelCase,  logits=lowerCamelCase,  hidden_states=outputs.hidden_states					)









"""simple docstring"""






from typing import List

import jiwer
import jiwer.transforms as tr
from packaging import version

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


_lowercase			:			List[str]										=						""


if version.parse(importlib_metadata.version("jiwer")) < version.parse("2.3.0"):

		class 	__SCREAMING_SNAKE_CASE     (				tr.AbstractTransform       ):


							'''simple docstring'''





							def __init__(	self							:  List[Any],  lowerCamelCase							:  str = " "					)-> List[str]:
										lowerCamelCase__		:		List[str]		     =sentence_delimiter



							def 		snake_case	(	self							:  Any,  lowerCamelCase							:  str					)-> Optional[Any]:
										return list(lowerCamelCase					)




							def 		snake_case	(	self							:  Optional[Any],  lowerCamelCase							:  List[str]					)-> Tuple:
										lowerCamelCase__		:		Optional[int]		     =[]
										for sent_idx, sentence in enumerate(lowerCamelCase					):
													chars.extend(self.process_string(lowerCamelCase					)					)
													if self.sentence_delimiter is not None and self.sentence_delimiter != "" and sent_idx < len(lowerCamelCase					) - 1:
																chars.append(self.sentence_delimiter					)
										return chars





		_lowercase			:			Optional[int]										=						tr.Compose(
		    [tr.RemoveMultipleSpaces(), tr.Strip(), SentencesToListOfCharacters(SENTENCE_DELIMITER)]
		)
else:
		_lowercase			:			List[str]										=						tr.Compose(
		    [
		        tr.RemoveMultipleSpaces(),
		        tr.Strip(),
		        tr.ReduceToSingleSentence(SENTENCE_DELIMITER),
		        tr.ReduceToListOfListOfChars(),
		    ]
		)


_lowercase			:			Dict										=						"\\n@inproceedings{inproceedings,\n    author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n    year = {2004},\n    month = {01},\n    pages = {},\n    title = {From WER and RIL to MER and WIL: improved evaluation measures for connected speech recognition.}\n}\n"

_lowercase			:			List[Any]										=						"\\nCharacter error rate (CER) is a common metric of the performance of an automatic speech recognition system.\n\nCER is similar to Word Error Rate (WER), but operates on character instead of word. Please refer to docs of WER for further information.\n\nCharacter error rate can be computed as:\n\nCER = (S + D + I) / N = (S + D + I) / (S + D + C)\n\nwhere\n\nS is the number of substitutions,\nD is the number of deletions,\nI is the number of insertions,\nC is the number of correct characters,\nN is the number of characters in the reference (N=S+D+C).\n\nCER's output is not always a number between 0 and 1, in particular when there is a high number of insertions. This value is often associated to the percentage of characters that were incorrectly predicted. The lower the value, the better the\nperformance of the ASR system with a CER of 0 being a perfect score.\n"

_lowercase			:			Dict										=						"\nComputes CER score of transcribed segments against references.\nArgs:\n    references: list of references for each speech input.\n    predictions: list of transcribtions to score.\n    concatenate_texts: Whether or not to concatenate sentences before evaluation, set to True for more accurate result.\nReturns:\n    (float): the character error rate\n\nExamples:\n\n    >>> predictions = [\"this is the prediction\", \"there is an other sample\"]\n    >>> references = [\"this is the reference\", \"there is another one\"]\n    >>> cer = datasets.load_metric(\"cer\")\n    >>> cer_score = cer.compute(predictions=predictions, references=references)\n    >>> print(cer_score)\n    0.34146341463414637\n"

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


					'''simple docstring'''





					def 		snake_case	(	self							:  Dict					)-> Optional[Any]:
								return datasets.MetricInfo(
								    description=_DESCRIPTION,  citation=_CITATION,  inputs_description=_KWARGS_DESCRIPTION,  features=datasets.Features(
								        {
								            '''predictions''': datasets.Value('''string''',  id='''sequence'''					),
								            '''references''': datasets.Value('''string''',  id='''sequence'''					),
								        }					),  codebase_urls=['''https://github.com/jitsi/jiwer/'''],  reference_urls=[
								        '''https://en.wikipedia.org/wiki/Word_error_rate''',
								        '''https://sites.google.com/site/textdigitisation/qualitymeasures/computingerrorrates''',
								    ],  )




					def 		snake_case	(	self							:  Optional[Any],  lowerCamelCase							:  Union[str, Any],  lowerCamelCase							:  List[str],  lowerCamelCase							:  Dict=False					)-> List[Any]:
								if concatenate_texts:
											return jiwer.compute_measures(
											    lowerCamelCase,  lowerCamelCase,  truth_transform=lowerCamelCase,  hypothesis_transform=lowerCamelCase,  )["wer"]

								lowerCamelCase__		:		Optional[Any]		     =0
								lowerCamelCase__		:		Union[str, Any]		     =0
								for prediction, reference in zip(lowerCamelCase,  lowerCamelCase					):
											lowerCamelCase__		:		int		     =jiwer.compute_measures(
											    lowerCamelCase,  lowerCamelCase,  truth_transform=lowerCamelCase,  hypothesis_transform=lowerCamelCase,  )
											incorrect += measures["substitutions"] + measures["deletions"] + measures["insertions"]
											total += measures["substitutions"] + measures["deletions"] + measures["hits"]

								return incorrect / total




