



import collections.abc
from typing import Optional, Tuple, Union

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

from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrainedModel
from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
from .configuration_poolformer import PoolFormerConfig


__A							       =		logging.get_logger(__name__)

# General docstring
__A							       =		'''PoolFormerConfig'''

# Base docstring
__A							       =		'''sail/poolformer_s12'''
__A							       =		[1, 512, 7, 7]

# Image classification docstring
__A							       =		'''sail/poolformer_s12'''
__A							       =		'''tabby, tabby cat'''

__A							       =		[
    '''sail/poolformer_s12''',
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
]



def 			__a	(       lowerCAmelCase_  :   Tuple     ,lowerCAmelCase_  :   Tuple = 0.0     ,lowerCAmelCase_  :   List[str] = False							) ->					Optional[int]:






						'''simple docstring'''



						if drop_prob == 0.0 or not training:
												return input
						UpperCAmelCase_=  1 - drop_prob
						UpperCAmelCase_=  (input.shape[0],) + (1,) * (input.ndim - 1)  # work with diff dim tensors, not just 2D ConvNets
						UpperCAmelCase_=  keep_prob + torch.rand(A__     ,dtype=input.dtype     ,device=input.device							)
						random_tensor.floor_()  # binarize
						UpperCAmelCase_=  input.div(A__							) * random_tensor
						return output






class 						lowercase		(					nn.Module):






	"""simple docstring"""


	def __init__(      self      :		int		,    __UpperCAmelCase      :		Any = None	)     ->					str:
							super().__init__()
							UpperCAmelCase_=  drop_prob




	def     _SCREAMING_SNAKE_CASE						(      self      :		str		,    __UpperCAmelCase      :		int	)     ->					List[Any]:
							return drop_path(__UpperCAmelCase		,    self.drop_prob		,    self.training	)




	def     _SCREAMING_SNAKE_CASE						(      self      :		Optional[Any]	)     ->					str:
							return "p={}".format(self.drop_prob	)






class 						lowercase		(					nn.Module):






	"""simple docstring"""


	def __init__(      self      :		List[Any]		,    __UpperCAmelCase      :		int		,    __UpperCAmelCase      :		Any		,    __UpperCAmelCase      :		Optional[Any]		,    __UpperCAmelCase      :		Dict		,    __UpperCAmelCase      :		Optional[int]		,    __UpperCAmelCase      :		str=None	)     ->					str:
							super().__init__()
							UpperCAmelCase_=  patch_size if isinstance(__UpperCAmelCase		,    collections.abc.Iterable	) else (patch_size, patch_size)
							UpperCAmelCase_=  stride if isinstance(__UpperCAmelCase		,    collections.abc.Iterable	) else (stride, stride)
							UpperCAmelCase_=  padding if isinstance(__UpperCAmelCase		,    collections.abc.Iterable	) else (padding, padding)

							UpperCAmelCase_=  nn.Convad(__UpperCAmelCase		,    __UpperCAmelCase		,    kernel_size=__UpperCAmelCase		,    stride=__UpperCAmelCase		,    padding=__UpperCAmelCase	)
							UpperCAmelCase_=  norm_layer(__UpperCAmelCase	) if norm_layer else nn.Identity()




	def     _SCREAMING_SNAKE_CASE						(      self      :		Union[str, Any]		,    __UpperCAmelCase      :		Optional[int]	)     ->					int:
							UpperCAmelCase_=  self.projection(__UpperCAmelCase	)
							UpperCAmelCase_=  self.norm(__UpperCAmelCase	)
							return embeddings






class 						lowercase		(					nn.GroupNorm):






	"""simple docstring"""


	def __init__(      self      :		int		,    __UpperCAmelCase      :		Any		,    **__UpperCAmelCase      :		Optional[Any]	)     ->					Union[str, Any]:
							super().__init__(1		,    __UpperCAmelCase		,    **__UpperCAmelCase	)






class 						lowercase		(					nn.Module):






	"""simple docstring"""


	def __init__(      self      :		Union[str, Any]		,    __UpperCAmelCase      :		Optional[int]	)     ->					Optional[int]:
							super().__init__()
							UpperCAmelCase_=  nn.AvgPoolad(__UpperCAmelCase		,    stride=1		,    padding=pool_size // 2		,    count_include_pad=__UpperCAmelCase	)




	def     _SCREAMING_SNAKE_CASE						(      self      :		Optional[int]		,    __UpperCAmelCase      :		Any	)     ->					List[Any]:
							return self.pool(__UpperCAmelCase	) - hidden_states






class 						lowercase		(					nn.Module):






	"""simple docstring"""


	def __init__(      self      :		Tuple		,    __UpperCAmelCase      :		Any		,    __UpperCAmelCase      :		Optional[Any]		,    __UpperCAmelCase      :		Any		,    __UpperCAmelCase      :		str	)     ->					Union[str, Any]:
							super().__init__()
							UpperCAmelCase_=  nn.Convad(__UpperCAmelCase		,    __UpperCAmelCase		,    1	)
							UpperCAmelCase_=  nn.Convad(__UpperCAmelCase		,    __UpperCAmelCase		,    1	)
							UpperCAmelCase_=  PoolFormerDropPath(__UpperCAmelCase	)
							if isinstance(config.hidden_act		,    __UpperCAmelCase	):
													UpperCAmelCase_=  ACTaFN[config.hidden_act]
							else:
													UpperCAmelCase_=  config.hidden_act




	def     _SCREAMING_SNAKE_CASE						(      self      :		List[Any]		,    __UpperCAmelCase      :		List[str]	)     ->					int:
							UpperCAmelCase_=  self.conva(__UpperCAmelCase	)
							UpperCAmelCase_=  self.act_fn(__UpperCAmelCase	)
							UpperCAmelCase_=  self.drop(__UpperCAmelCase	)
							UpperCAmelCase_=  self.conva(__UpperCAmelCase	)
							UpperCAmelCase_=  self.drop(__UpperCAmelCase	)

							return hidden_states






class 						lowercase		(					nn.Module):






	"""simple docstring"""


	def __init__(      self      :		Tuple		,    __UpperCAmelCase      :		Tuple		,    __UpperCAmelCase      :		str		,    __UpperCAmelCase      :		int		,    __UpperCAmelCase      :		Dict		,    __UpperCAmelCase      :		str		,    __UpperCAmelCase      :		List[Any]	)     ->					Tuple:
							super().__init__()
							UpperCAmelCase_=  PoolFormerPooling(__UpperCAmelCase	)
							UpperCAmelCase_=  PoolFormerOutput(__UpperCAmelCase		,    __UpperCAmelCase		,    __UpperCAmelCase		,    __UpperCAmelCase	)
							UpperCAmelCase_=  PoolFormerGroupNorm(__UpperCAmelCase	)
							UpperCAmelCase_=  PoolFormerGroupNorm(__UpperCAmelCase	)

							# Useful for training neural nets
							UpperCAmelCase_=  PoolFormerDropPath(__UpperCAmelCase	) if drop_path > 0.0 else nn.Identity()
							UpperCAmelCase_=  config.use_layer_scale
							if config.use_layer_scale:
													UpperCAmelCase_=  nn.Parameter(
													    config.layer_scale_init_value * torch.ones((__UpperCAmelCase)	)		,    requires_grad=__UpperCAmelCase	)
													UpperCAmelCase_=  nn.Parameter(
													    config.layer_scale_init_value * torch.ones((__UpperCAmelCase)	)		,    requires_grad=__UpperCAmelCase	)




	def     _SCREAMING_SNAKE_CASE						(      self      :		Dict		,    __UpperCAmelCase      :		Dict	)     ->					Optional[int]:
							if self.use_layer_scale:
													UpperCAmelCase_=  self.pooling(self.before_norm(__UpperCAmelCase	)	)
													UpperCAmelCase_=  self.layer_scale_a.unsqueeze(-1	).unsqueeze(-1	) * pooling_output
													# First residual connection
													UpperCAmelCase_=  hidden_states + self.drop_path(__UpperCAmelCase	)
													UpperCAmelCase_=  ()

													UpperCAmelCase_=  self.output(self.after_norm(__UpperCAmelCase	)	)
													UpperCAmelCase_=  self.layer_scale_a.unsqueeze(-1	).unsqueeze(-1	) * layer_output
													# Second residual connection
													UpperCAmelCase_=  hidden_states + self.drop_path(__UpperCAmelCase	)

													UpperCAmelCase_=  (output,) + outputs
													return outputs

							else:
													UpperCAmelCase_=  self.drop_path(self.pooling(self.before_norm(__UpperCAmelCase	)	)	)
													# First residual connection
													UpperCAmelCase_=  pooling_output + hidden_states
													UpperCAmelCase_=  ()

													# Second residual connection inside the PoolFormerOutput block
													UpperCAmelCase_=  self.drop_path(self.output(self.after_norm(__UpperCAmelCase	)	)	)
													UpperCAmelCase_=  hidden_states + layer_output

													UpperCAmelCase_=  (output,) + outputs
													return outputs






class 						lowercase		(					nn.Module):






	"""simple docstring"""


	def __init__(      self      :		List[Any]		,    __UpperCAmelCase      :		Optional[int]	)     ->					Any:
							super().__init__()
							UpperCAmelCase_=  config
							# stochastic depth decay rule
							UpperCAmelCase_=  [x.item() for x in torch.linspace(0		,    config.drop_path_rate		,    sum(config.depths	)	)]

							# patch embeddings
							UpperCAmelCase_=  []
							for i in range(config.num_encoder_blocks	):
													embeddings.append(
													    PoolFormerEmbeddings(
													        patch_size=config.patch_sizes[i]		,    stride=config.strides[i]		,    padding=config.padding[i]		,    num_channels=config.num_channels if i == 0 else config.hidden_sizes[i - 1]		,    hidden_size=config.hidden_sizes[i]		,    )	)
							UpperCAmelCase_=  nn.ModuleList(__UpperCAmelCase	)

							# Transformer blocks
							UpperCAmelCase_=  []
							UpperCAmelCase_=  0
							for i in range(config.num_encoder_blocks	):
													# each block consists of layers
													UpperCAmelCase_=  []
													if i != 0:
																			cur += config.depths[i - 1]
													for j in range(config.depths[i]	):
																			layers.append(
																			    PoolFormerLayer(
																			        __UpperCAmelCase		,    num_channels=config.hidden_sizes[i]		,    pool_size=config.pool_size		,    hidden_size=config.hidden_sizes[i]		,    intermediate_size=int(config.hidden_sizes[i] * config.mlp_ratio	)		,    drop_path=dpr[cur + j]		,    )	)
													blocks.append(nn.ModuleList(__UpperCAmelCase	)	)

							UpperCAmelCase_=  nn.ModuleList(__UpperCAmelCase	)




	def     _SCREAMING_SNAKE_CASE						(      self      :		List[Any]		,    __UpperCAmelCase      :		Union[str, Any]		,    __UpperCAmelCase      :		Optional[Any]=False		,    __UpperCAmelCase      :		Optional[Any]=True	)     ->					Dict:
							UpperCAmelCase_=  () if output_hidden_states else None

							UpperCAmelCase_=  pixel_values
							for idx, layers in enumerate(zip(self.patch_embeddings		,    self.block	)	):
													UpperCAmelCase_,  UpperCAmelCase_=  layers
													# Get patch embeddings from hidden_states
													UpperCAmelCase_=  embedding_layer(__UpperCAmelCase	)
													# Send the embeddings through the blocks
													for _, blk in enumerate(__UpperCAmelCase	):
																			UpperCAmelCase_=  blk(__UpperCAmelCase	)
																			UpperCAmelCase_=  layer_outputs[0]

													if output_hidden_states:
																			UpperCAmelCase_=  all_hidden_states + (hidden_states,)

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

							return BaseModelOutputWithNoAttention(last_hidden_state=__UpperCAmelCase		,    hidden_states=__UpperCAmelCase	)






class 						lowercase		(					UpperCamelCase__):






	"""simple docstring"""


	a__ :   Union[str, Any]						  =				PoolFormerConfig
	a__ :   Optional[Any]						  =				'poolformer'
	a__ :   List[Any]						  =				'pixel_values'
	a__ :   int						  =				True




	def     _SCREAMING_SNAKE_CASE						(      self      :		List[str]		,    __UpperCAmelCase      :		Optional[Any]	)     ->					List[Any]:
							if isinstance(__UpperCAmelCase		,    (nn.Linear, nn.Convad)	):
													module.weight.data.normal_(mean=0.0		,    std=self.config.initializer_range	)
													if module.bias is not None:
																			module.bias.data.zero_()
							elif isinstance(__UpperCAmelCase		,    nn.LayerNorm	):
													module.bias.data.zero_()
													module.weight.data.fill_(1.0	)




	def     _SCREAMING_SNAKE_CASE						(      self      :		str		,    __UpperCAmelCase      :		Any		,    __UpperCAmelCase      :		Optional[Any]=False	)     ->					Union[str, Any]:
							if isinstance(__UpperCAmelCase		,    __UpperCAmelCase	):
													UpperCAmelCase_=  value

__A							       =		r'''\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use\n    it 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 ([`PoolFormerConfig`]): 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'''

__A							       =		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            [`PoolFormerImageProcessor.__call__`] for details.\n'''






@add_start_docstrings(
    "The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top."					,       UpperCamelCase__					,       )
class 						lowercase		(					UpperCamelCase__):






	"""simple docstring"""


	def __init__(      self      :		str		,    __UpperCAmelCase      :		str	)     ->					Any:
							super().__init__(__UpperCAmelCase	)
							UpperCAmelCase_=  config

							UpperCAmelCase_=  PoolFormerEncoder(__UpperCAmelCase	)

							# Initialize weights and apply final processing
							self.post_init()




	def     _SCREAMING_SNAKE_CASE						(      self      :		Tuple	)     ->					List[Any]:
							return self.embeddings.patch_embeddings




	@add_start_docstrings_to_model_forward(__UpperCAmelCase	)
	@add_code_sample_docstrings(
	    checkpoint=_CHECKPOINT_FOR_DOC		,    output_type=__UpperCAmelCase		,    config_class=_CONFIG_FOR_DOC		,    modality="""vision"""		,    expected_output=_EXPECTED_OUTPUT_SHAPE		,    )
	def     _SCREAMING_SNAKE_CASE						(      self      :		Dict		,    __UpperCAmelCase      :		str = None		,    __UpperCAmelCase      :		Any = None		,    __UpperCAmelCase      :		List[Any] = None		,    )     ->					Union[str, Any]:
							UpperCAmelCase_=  (
							    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
							)
							UpperCAmelCase_=  return_dict if return_dict is not None else self.config.use_return_dict

							if pixel_values is None:
													raise ValueError("""You have to specify pixel_values"""	)

							UpperCAmelCase_=  self.encoder(
							    __UpperCAmelCase		,    output_hidden_states=__UpperCAmelCase		,    return_dict=__UpperCAmelCase		,    )
							UpperCAmelCase_=  encoder_outputs[0]

							if not return_dict:
													return (sequence_output, None) + encoder_outputs[1:]

							return BaseModelOutputWithNoAttention(
							    last_hidden_state=__UpperCAmelCase		,    hidden_states=encoder_outputs.hidden_states		,    )






class 						lowercase		(					nn.Module):






	"""simple docstring"""


	def __init__(      self      :		str		,    __UpperCAmelCase      :		List[Any]	)     ->					int:
							super().__init__()
							UpperCAmelCase_=  nn.Linear(config.hidden_size		,    config.hidden_size	)




	def     _SCREAMING_SNAKE_CASE						(      self      :		List[Any]		,    __UpperCAmelCase      :		int	)     ->					int:
							UpperCAmelCase_=  self.dense(__UpperCAmelCase	)
							return output






@add_start_docstrings(
    "\n    PoolFormer Model transformer with an image classification head on top\n    "					,       UpperCamelCase__					,       )
class 						lowercase		(					UpperCamelCase__):






	"""simple docstring"""


	def __init__(      self      :		Dict		,    __UpperCAmelCase      :		List[str]	)     ->					Union[str, Any]:
							super().__init__(__UpperCAmelCase	)
							UpperCAmelCase_=  config.num_labels
							UpperCAmelCase_=  PoolFormerModel(__UpperCAmelCase	)

							# Final norm
							UpperCAmelCase_=  PoolFormerGroupNorm(config.hidden_sizes[-1]	)
							# Classifier head
							UpperCAmelCase_=  (
							    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(__UpperCAmelCase	)
	@add_code_sample_docstrings(
	    checkpoint=_IMAGE_CLASS_CHECKPOINT		,    output_type=__UpperCAmelCase		,    config_class=_CONFIG_FOR_DOC		,    expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT		,    )
	def     _SCREAMING_SNAKE_CASE						(      self      :		Dict		,    __UpperCAmelCase      :		Union[str, Any] = None		,    __UpperCAmelCase      :		List[Any] = None		,    __UpperCAmelCase      :		str = None		,    __UpperCAmelCase      :		Union[str, Any] = None		,    )     ->					Union[str, Any]:
							UpperCAmelCase_=  return_dict if return_dict is not None else self.config.use_return_dict

							UpperCAmelCase_=  self.poolformer(
							    __UpperCAmelCase		,    output_hidden_states=__UpperCAmelCase		,    return_dict=__UpperCAmelCase		,    )

							UpperCAmelCase_=  outputs[0]

							UpperCAmelCase_=  self.classifier(self.norm(__UpperCAmelCase	).mean([-2, -1]	)	)

							UpperCAmelCase_=  None
							if labels is not None:
													if self.config.problem_type is None:
																			if self.num_labels == 1:
																									UpperCAmelCase_=  """regression"""
																			elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
																									UpperCAmelCase_=  """single_label_classification"""
																			else:
																									UpperCAmelCase_=  """multi_label_classification"""

													if self.config.problem_type == "regression":
																			UpperCAmelCase_=  MSELoss()
																			if self.num_labels == 1:
																									UpperCAmelCase_=  loss_fct(logits.squeeze()		,    labels.squeeze()	)
																			else:
																									UpperCAmelCase_=  loss_fct(__UpperCAmelCase		,    __UpperCAmelCase	)
													elif self.config.problem_type == "single_label_classification":
																			UpperCAmelCase_=  CrossEntropyLoss()
																			UpperCAmelCase_=  loss_fct(logits.view(-1		,    self.num_labels	)		,    labels.view(-1	)	)
													elif self.config.problem_type == "multi_label_classification":
																			UpperCAmelCase_=  BCEWithLogitsLoss()
																			UpperCAmelCase_=  loss_fct(__UpperCAmelCase		,    __UpperCAmelCase	)

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

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






'''simple docstring'''
import comet  # From: unbabel-comet
import torch

import datasets


lowercase__											=datasets.logging.get_logger(__name__)

lowercase__											='\\n@inproceedings{rei-EtAl:2020:WMT,\n   author    = {Rei, Ricardo  and  Stewart, Craig  and  Farinha, Ana C  and  Lavie, Alon},\n   title     = {Unbabel\'s Participation in the WMT20 Metrics Shared Task},\n   booktitle      = {Proceedings of the Fifth Conference on Machine Translation},\n   month          = {November},\n   year           = {2020},\n   address        = {Online},\n   publisher      = {Association for Computational Linguistics},\n   pages     = {909--918},\n}\n@inproceedings{rei-etal-2020-comet,\n   title = "{COMET}: A Neural Framework for {MT} Evaluation",\n   author = "Rei, Ricardo  and\n      Stewart, Craig  and\n      Farinha, Ana C  and\n      Lavie, Alon",\n   booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",\n   month = nov,\n   year = "2020",\n   address = "Online",\n   publisher = "Association for Computational Linguistics",\n   url = "https://www.aclweb.org/anthology/2020.emnlp-main.213",\n   pages = "2685--2702",\n}\n'

lowercase__											='\\nCrosslingual Optimized Metric for Evaluation of Translation (COMET) is an open-source framework used to train Machine Translation metrics that achieve high levels of correlation with different types of human judgments (HTER, DA\'s or MQM).\nWith the release of the framework the authors also released fully trained models that were used to compete in the WMT20 Metrics Shared Task achieving SOTA in that years competition.\n\nSee the [README.md] file at https://unbabel.github.io/COMET/html/models.html for more information.\n'

lowercase__											='\nCOMET score.\n\nArgs:\n\n`sources` (list of str): Source sentences\n`predictions` (list of str): candidate translations\n`references` (list of str): reference translations\n`cuda` (bool): If set to True, runs COMET using GPU\n`show_progress` (bool): Shows progress\n`model`: COMET model to be used. Will default to `wmt-large-da-estimator-1719` if None.\n\nReturns:\n    `samples`: List of dictionaries with `src`, `mt`, `ref` and `score`.\n    `scores`: List of scores.\n\nExamples:\n\n    >>> comet_metric = datasets.load_metric(\'comet\')\n    >>> # comet_metric = load_metric(\'comet\', \'wmt20-comet-da\')  # you can also choose which model to use\n    >>> source = ["Dem Feuer konnte Einhalt geboten werden", "Schulen und Kindergärten wurden eröffnet."]\n    >>> hypothesis = ["The fire could be stopped", "Schools and kindergartens were open"]\n    >>> reference = ["They were able to control the fire.", "Schools and kindergartens opened"]\n    >>> results = comet_metric.compute(predictions=hypothesis, references=reference, sources=source)\n    >>> print([round(v, 2) for v in results["scores"]])\n    [0.19, 0.92]\n'







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




			def 					lowerCAmelCase__					(       self	):
				return datasets.MetricInfo(
				    description=_DESCRIPTION					,   citation=_CITATION					,   homepage="""https://unbabel.github.io/COMET/html/index.html"""					,   inputs_description=_KWARGS_DESCRIPTION					,   features=datasets.Features(
				        {
				            """sources""": datasets.Value("""string"""					,   id="""sequence"""	),
				            """predictions""": datasets.Value("""string"""					,   id="""sequence"""	),
				            """references""": datasets.Value("""string"""					,   id="""sequence"""	),
				        }	)					,   codebase_urls=["""https://github.com/Unbabel/COMET"""]					,   reference_urls=[
				        """https://github.com/Unbabel/COMET""",
				        """https://www.aclweb.org/anthology/2020.emnlp-main.213/""",
				        """http://www.statmt.org/wmt20/pdf/2020.wmt-1.101.pdf6""",
				    ]					,   )




			def 					lowerCAmelCase__					(       self					,   UpperCAmelCase	):
				if self.config_name == "default":
					a_      				=						comet.load_from_checkpoint(comet.download_model("""wmt20-comet-da"""	)	)
				else:
					a_      				=						comet.load_from_checkpoint(comet.download_model(self.config_name	)	)






			def 					lowerCAmelCase__					(       self					,   UpperCAmelCase					,   UpperCAmelCase					,   UpperCAmelCase					,   UpperCAmelCase=None					,   UpperCAmelCase=False	):
				if gpus is None:
					a_      				=						1 if torch.cuda.is_available() else 0
				a_      				=						{"""src""": sources, """mt""": predictions, """ref""": references}
				a_      				=						[dict(zip(UpperCAmelCase					,   UpperCAmelCase	)	) for t in zip(*data.values()	)]
				a_				,  a_      				=						self.scorer.predict(UpperCAmelCase					,   gpus=UpperCAmelCase					,   progress_bar=UpperCAmelCase	)
				return {"mean_score": mean_score, "scores": scores}
