




from typing import Optional, Tuple, Union

import tensorflow as tf

from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
    TFBaseModelOutputWithNoAttention,
    TFBaseModelOutputWithPoolingAndNoAttention,
    TFSequenceClassifierOutput,
)
from ...modeling_tf_utils import TFPreTrainedModel, TFSequenceClassificationLoss, keras_serializable, unpack_inputs
from ...tf_utils import shape_list
from ...utils import logging
from .configuration_regnet import RegNetConfig


lowerCamelCase							:						str					       =  logging.get_logger(__name__)

# General docstring
lowerCamelCase							:						List[str]					       =  "RegNetConfig"

# Base docstring
lowerCamelCase							:						Tuple					       =  "facebook/regnet-y-040"
lowerCamelCase							:						Dict					       =  [1, 1_088, 7, 7]

# Image classification docstring
lowerCamelCase							:						str					       =  "facebook/regnet-y-040"
lowerCamelCase							:						Union[str, Any]					       =  "tabby, tabby cat"

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







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    List[str]		,				A_   :    int		,				A_   :    int = 3		,				A_   :    int = 1		,				A_   :    int = 1		,				A_   :    Optional[str] = "relu"		,				**A_   :    int		,				)  ->      Dict:

       """simple docstring"""






       super().__init__(**A_    )
       # The padding and conv has been verified in
       # https://colab.research.google.com/gist/sayakpaul/854bc10eeaf21c9ee2119e0b9f3841a7/scratchpad.ipynb
       lowerCamelCase_							=       tf.keras.layers.ZeroPaddingaD(padding=kernel_size // 2    )
       lowerCamelCase_							=       tf.keras.layers.ConvaD(
           filters=A_		,				kernel_size=A_		,				strides=A_		,				padding='VALID'		,				groups=A_		,				use_bias=A_		,				name='convolution'		,				)
       lowerCamelCase_							=       tf.keras.layers.BatchNormalization(epsilon=1E-5		,				momentum=0.9		,				name='normalization'    )
       lowerCamelCase_							=       ACTaFN[activation] if activation is not None else tf.identity





 def 							a__					(							self   :    Dict		,				A_   :    Any    )  ->      Any:

       """simple docstring"""






       lowerCamelCase_							=       self.convolution(self.padding(A_    )    )
       lowerCamelCase_							=       self.normalization(A_    )
       lowerCamelCase_							=       self.activation(A_    )
       return hidden_state







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    Optional[int]		,				A_   :    RegNetConfig		,				**A_   :    List[str]    )  ->      Any:

       """simple docstring"""






       super().__init__(**A_    )
       lowerCamelCase_							=       config.num_channels
       lowerCamelCase_							=       TFRegNetConvLayer(
           out_channels=config.embedding_size		,				kernel_size=3		,				stride=2		,				activation=config.hidden_act		,				name='embedder'		,				)





 def 							a__					(							self   :    Any		,				A_   :    str    )  ->      Any:

       """simple docstring"""






       lowerCamelCase_							=       shape_list(A_    )[1]
       if tf.executing_eagerly() and 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.'    )

       # When running on CPU, `tf.keras.layers.Conv2D` doesn't support `NCHW` format.
       # So change the input format from `NCHW` to `NHWC`.
       # shape = (batch_size, in_height, in_width, in_channels=num_channels)
       lowerCamelCase_							=       tf.transpose(A_		,				perm=(0, 2, 3, 1)    )
       lowerCamelCase_							=       self.embedder(A_    )
       return hidden_state







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    Tuple		,				A_   :    int		,				A_   :    int = 2		,				**A_   :    str    )  ->      Optional[int]:

       """simple docstring"""






       super().__init__(**A_    )
       lowerCamelCase_							=       tf.keras.layers.ConvaD(
           filters=A_		,				kernel_size=1		,				strides=A_		,				use_bias=A_		,				name='convolution'    )
       lowerCamelCase_							=       tf.keras.layers.BatchNormalization(epsilon=1E-5		,				momentum=0.9		,				name='normalization'    )





 def 							a__					(							self   :    Any		,				A_   :    tf.Tensor		,				A_   :    bool = False    )  ->      tf.Tensor:

       """simple docstring"""






       return self.normalization(self.convolution(A_    )		,				training=A_    )







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    Any		,				A_   :    int		,				A_   :    int		,				**A_   :    Dict    )  ->      Optional[int]:

       """simple docstring"""






       super().__init__(**A_    )
       lowerCamelCase_							=       tf.keras.layers.GlobalAveragePoolingaD(keepdims=A_		,				name='pooler'    )
       lowerCamelCase_							=       [
           tf.keras.layers.ConvaD(filters=A_		,				kernel_size=1		,				activation='relu'		,				name='attention.0'    ),
           tf.keras.layers.ConvaD(filters=A_		,				kernel_size=1		,				activation='sigmoid'		,				name='attention.2'    ),
       ]





 def 							a__					(							self   :    List[Any]		,				A_   :    Any    )  ->      List[str]:

       """simple docstring"""






       lowerCamelCase_							=       self.pooler(A_    )
       for layer_module in self.attention:
             lowerCamelCase_							=       layer_module(A_    )
       lowerCamelCase_							=       hidden_state * pooled
       return hidden_state







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    List[Any]		,				A_   :    RegNetConfig		,				A_   :    int		,				A_   :    int		,				A_   :    int = 1		,				**A_   :    Optional[Any]    )  ->      Any:

       """simple docstring"""






       super().__init__(**A_    )
       lowerCamelCase_							=       in_channels != out_channels or stride != 1
       lowerCamelCase_							=       max(1		,				out_channels // config.groups_width    )
       lowerCamelCase_							=       (
           TFRegNetShortCut(A_		,				stride=A_		,				name='shortcut'    )
           if should_apply_shortcut
           else tf.keras.layers.Activation('linear'		,				name='shortcut'    )
       )
       # `self.layers` instead of `self.layer` because that is a reserved argument.
       lowerCamelCase_							=       [
           TFRegNetConvLayer(A_		,				kernel_size=1		,				activation=config.hidden_act		,				name='layer.0'    ),
           TFRegNetConvLayer(
               A_		,				stride=A_		,				groups=A_		,				activation=config.hidden_act		,				name='layer.1'    ),
           TFRegNetConvLayer(A_		,				kernel_size=1		,				activation=A_		,				name='layer.2'    ),
       ]
       lowerCamelCase_							=       ACTaFN[config.hidden_act]





 def 							a__					(							self   :    Any		,				A_   :    List[str]    )  ->      Dict:

       """simple docstring"""






       lowerCamelCase_							=       hidden_state
       for layer_module in self.layers:
             lowerCamelCase_							=       layer_module(A_    )
       lowerCamelCase_							=       self.shortcut(A_    )
       hidden_state += residual
       lowerCamelCase_							=       self.activation(A_    )
       return hidden_state







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    Dict		,				A_   :    RegNetConfig		,				A_   :    int		,				A_   :    int		,				A_   :    int = 1		,				**A_   :    Optional[Any]    )  ->      Tuple:

       """simple docstring"""






       super().__init__(**A_    )
       lowerCamelCase_							=       in_channels != out_channels or stride != 1
       lowerCamelCase_							=       max(1		,				out_channels // config.groups_width    )
       lowerCamelCase_							=       (
           TFRegNetShortCut(A_		,				stride=A_		,				name='shortcut'    )
           if should_apply_shortcut
           else tf.keras.layers.Activation('linear'		,				name='shortcut'    )
       )
       lowerCamelCase_							=       [
           TFRegNetConvLayer(A_		,				kernel_size=1		,				activation=config.hidden_act		,				name='layer.0'    ),
           TFRegNetConvLayer(
               A_		,				stride=A_		,				groups=A_		,				activation=config.hidden_act		,				name='layer.1'    ),
           TFRegNetSELayer(A_		,				reduced_channels=int(round(in_channels / 4    )    )		,				name='layer.2'    ),
           TFRegNetConvLayer(A_		,				kernel_size=1		,				activation=A_		,				name='layer.3'    ),
       ]
       lowerCamelCase_							=       ACTaFN[config.hidden_act]





 def 							a__					(							self   :    Any		,				A_   :    Union[str, Any]    )  ->      Dict:

       """simple docstring"""






       lowerCamelCase_							=       hidden_state
       for layer_module in self.layers:
             lowerCamelCase_							=       layer_module(A_    )
       lowerCamelCase_							=       self.shortcut(A_    )
       hidden_state += residual
       lowerCamelCase_							=       self.activation(A_    )
       return hidden_state







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    Any		,				A_   :    RegNetConfig		,				A_   :    int		,				A_   :    int		,				A_   :    int = 2		,				A_   :    int = 2		,				**A_   :    Tuple    )  ->      List[Any]:

       """simple docstring"""






       super().__init__(**A_    )

       lowerCamelCase_							=       TFRegNetXLayer if config.layer_type == 'x' else TFRegNetYLayer
       lowerCamelCase_							=       [
           # downsampling is done in the first layer with stride of 2
           layer(A_		,				A_		,				A_		,				stride=A_		,				name='layers.0'    ),
           *[layer(A_		,				A_		,				A_		,				name=f"""layers.{i+1}"""    ) for i in range(depth - 1    )],
       ]





 def 							a__					(							self   :    str		,				A_   :    List[Any]    )  ->      List[str]:

       """simple docstring"""






       for layer_module in self.layers:
             lowerCamelCase_							=       layer_module(A_    )
       return hidden_state







class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 def __init__(							self   :    Tuple		,				A_   :    RegNetConfig		,				**A_   :    Any    )  ->      List[str]:

       """simple docstring"""






       super().__init__(**A_    )
       lowerCamelCase_							=       []
       # based on `downsample_in_first_stage`, the first layer of the first stage may or may not downsample the input
       self.stages.append(
           TFRegNetStage(
               A_		,				config.embedding_size		,				config.hidden_sizes[0]		,				stride=2 if config.downsample_in_first_stage else 1		,				depth=config.depths[0]		,				name='stages.0'		,				)    )
       lowerCamelCase_							=       zip(config.hidden_sizes		,				config.hidden_sizes[1:]    )
       for i, ((in_channels, out_channels), depth) in enumerate(zip(A_		,				config.depths[1:]    )    ):
             self.stages.append(TFRegNetStage(A_		,				A_		,				A_		,				depth=A_		,				name=f"""stages.{i+1}"""    )    )





 def 							a__					(							self   :    Dict		,				A_   :    tf.Tensor		,				A_   :    bool = False		,				A_   :    bool = True    )  ->      TFBaseModelOutputWithNoAttention:

       """simple docstring"""






       lowerCamelCase_							=       () if output_hidden_states else None

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

             lowerCamelCase_							=       stage_module(A_    )

       if output_hidden_states:
             lowerCamelCase_							=       hidden_states + (hidden_state,)

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

       return TFBaseModelOutputWithNoAttention(last_hidden_state=A_		,				hidden_states=A_    )







@keras_serializable
class     A(		tf.keras.layers.Layer  ):



 '''simple docstring'''


 UpperCamelCase		  =		RegNetConfig

 def __init__(							self   :    List[str]		,				A_   :    Optional[Any]		,				**A_   :    int    )  ->      Optional[int]:

       """simple docstring"""






       super().__init__(**A_    )
       lowerCamelCase_							=       config
       lowerCamelCase_							=       TFRegNetEmbeddings(A_		,				name='embedder'    )
       lowerCamelCase_							=       TFRegNetEncoder(A_		,				name='encoder'    )
       lowerCamelCase_							=       tf.keras.layers.GlobalAveragePoolingaD(keepdims=A_		,				name='pooler'    )





 @unpack_inputs
 def 							a__					(							self   :    int		,				A_   :    tf.Tensor		,				A_   :    Optional[bool] = None		,				A_   :    Optional[bool] = None		,				A_   :    bool = False		,				)  ->      TFBaseModelOutputWithPoolingAndNoAttention:

       """simple docstring"""






       lowerCamelCase_							=       (
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       lowerCamelCase_							=       return_dict if return_dict is not None else self.config.use_return_dict

       lowerCamelCase_							=       self.embedder(A_		,				training=A_    )

       lowerCamelCase_							=       self.encoder(
           A_		,				output_hidden_states=A_		,				return_dict=A_		,				training=A_    )

       lowerCamelCase_							=       encoder_outputs[0]
       lowerCamelCase_							=       self.pooler(A_    )

       # Change to NCHW output format have uniformity in the modules
       lowerCamelCase_							=       tf.transpose(A_		,				perm=(0, 3, 1, 2)    )
       lowerCamelCase_							=       tf.transpose(A_		,				perm=(0, 3, 1, 2)    )

       # Change the other hidden state outputs to NCHW as well
       if output_hidden_states:
             lowerCamelCase_							=       tuple([tf.transpose(A_		,				perm=(0, 3, 1, 2)    ) for h in encoder_outputs[1]]    )

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

       return TFBaseModelOutputWithPoolingAndNoAttention(
           last_hidden_state=A_		,				pooler_output=A_		,				hidden_states=hidden_states if output_hidden_states else encoder_outputs.hidden_states		,				)







class     A(		UpperCamelCase  ):



 '''simple docstring'''


 UpperCamelCase		  =		RegNetConfig
 UpperCamelCase		  =		'''regnet'''
 UpperCamelCase		  =		'''pixel_values'''

 @property
 def 							a__					(							self   :    int    )  ->      Dict:

       """simple docstring"""






       return {"pixel_values": tf.TensorSpec(shape=(None, self.config.num_channels, 224, 224)		,				dtype=tf.floataa    )}

lowerCamelCase							:						str					       =  r"\n    Parameters:\n    This model is a Tensorflow\n    [tf.keras.layers.Layer](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer) sub-class. Use it as a\n    regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and\n    behavior.\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 [`~TFPreTrainedModel.from_pretrained`] method to load the model weights.\n"

lowerCamelCase							:						Dict					       =  r"\n    Args:\n        pixel_values (`tf.Tensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`ConveNextImageProcessor.__call__`] for details.\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 [`~utils.ModelOutput`] instead of a plain tuple.\n"







@add_start_docstrings(
    '''The bare RegNet model outputting raw features without any specific head on top.'''				, UpperCamelCase				, )
class     A(		UpperCamelCase  ):



 '''simple docstring'''


 def __init__(							self   :    Tuple		,				A_   :    RegNetConfig		,				*A_   :    Tuple		,				**A_   :    Any    )  ->      int:

       """simple docstring"""






       super().__init__(A_		,				*A_		,				**A_    )
       lowerCamelCase_							=       TFRegNetMainLayer(A_		,				name='regnet'    )





 @unpack_inputs
 @add_start_docstrings_to_model_forward(A_    )
 @add_code_sample_docstrings(
     checkpoint=_CHECKPOINT_FOR_DOC		,				output_type=A_		,				config_class=_CONFIG_FOR_DOC		,				modality='vision'		,				expected_output=_EXPECTED_OUTPUT_SHAPE		,				)
 def 							a__					(							self   :    List[str]		,				A_   :    tf.Tensor		,				A_   :    Optional[bool] = None		,				A_   :    Optional[bool] = None		,				A_   :    int=False		,				)  ->      Union[TFBaseModelOutputWithPoolingAndNoAttention, Tuple[tf.Tensor]]:

       """simple docstring"""






       lowerCamelCase_							=       (
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       lowerCamelCase_							=       return_dict if return_dict is not None else self.config.use_return_dict

       lowerCamelCase_							=       self.regnet(
           pixel_values=A_		,				output_hidden_states=A_		,				return_dict=A_		,				training=A_		,				)
       if not return_dict:
             return (outputs[0],) + outputs[1:]

       return TFBaseModelOutputWithPoolingAndNoAttention(
           last_hidden_state=outputs.last_hidden_state		,				pooler_output=outputs.pooler_output		,				hidden_states=outputs.hidden_states		,				)







@add_start_docstrings(
    '''
    RegNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
    ImageNet.
    '''				, UpperCamelCase				, )
class     A(		UpperCamelCase				, UpperCamelCase  ):



 '''simple docstring'''


 def __init__(							self   :    List[str]		,				A_   :    RegNetConfig		,				*A_   :    Optional[int]		,				**A_   :    int    )  ->      Optional[Any]:

       """simple docstring"""






       super().__init__(A_		,				*A_		,				**A_    )
       lowerCamelCase_							=       config.num_labels
       lowerCamelCase_							=       TFRegNetMainLayer(A_		,				name='regnet'    )
       # classification head
       lowerCamelCase_							=       [
           tf.keras.layers.Flatten(),
           tf.keras.layers.Dense(config.num_labels		,				name='classifier.1'    ) if config.num_labels > 0 else tf.identity,
       ]





 @unpack_inputs
 @add_start_docstrings_to_model_forward(A_    )
 @add_code_sample_docstrings(
     checkpoint=_IMAGE_CLASS_CHECKPOINT		,				output_type=A_		,				config_class=_CONFIG_FOR_DOC		,				expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT		,				)
 def 							a__					(							self   :    Optional[int]		,				A_   :    tf.Tensor = None		,				A_   :    tf.Tensor = None		,				A_   :    bool = None		,				A_   :    bool = None		,				A_   :    List[Any]=False		,				)  ->      Union[TFSequenceClassifierOutput, Tuple[tf.Tensor]]:

       """simple docstring"""






       lowerCamelCase_							=       (
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       lowerCamelCase_							=       return_dict if return_dict is not None else self.config.use_return_dict

       lowerCamelCase_							=       self.regnet(
           A_		,				output_hidden_states=A_		,				return_dict=A_		,				training=A_    )

       lowerCamelCase_							=       outputs.pooler_output if return_dict else outputs[1]

       lowerCamelCase_							=       self.classifier[0](A_    )
       lowerCamelCase_							=       self.classifier[1](A_    )

       lowerCamelCase_							=       None if labels is None else self.hf_compute_loss(labels=A_		,				logits=A_    )

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

       return TFSequenceClassifierOutput(loss=A_		,				logits=A_		,				hidden_states=outputs.hidden_states    )






"""simple docstring"""

from typing import Dict, List

from nltk.translate import gleu_score

import datasets
from datasets import MetricInfo


_UpperCamelCase		     =    """\
@misc{wu2016googles,
      title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},
      author={Yonghui Wu and Mike Schuster and Zhifeng Chen and Quoc V. Le and Mohammad Norouzi and Wolfgang Macherey
              and Maxim Krikun and Yuan Cao and Qin Gao and Klaus Macherey and Jeff Klingner and Apurva Shah and Melvin
              Johnson and Xiaobing Liu and Łukasz Kaiser and Stephan Gouws and Yoshikiyo Kato and Taku Kudo and Hideto
              Kazawa and Keith Stevens and George Kurian and Nishant Patil and Wei Wang and Cliff Young and
              Jason Smith and Jason Riesa and Alex Rudnick and Oriol Vinyals and Greg Corrado and Macduff Hughes
              and Jeffrey Dean},
      year={2016},
      eprint={1609.08144},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
"""

_UpperCamelCase		     =    """\
The BLEU score has some undesirable properties when used for single
sentences, as it was designed to be a corpus measure. We therefore
use a slightly different score for our RL experiments which we call
the 'GLEU score'. For the GLEU score, we record all sub-sequences of
1, 2, 3 or 4 tokens in output and target sequence (n-grams). We then
compute a recall, which is the ratio of the number of matching n-grams
to the number of total n-grams in the target (ground truth) sequence,
and a precision, which is the ratio of the number of matching n-grams
to the number of total n-grams in the generated output sequence. Then
GLEU score is simply the minimum of recall and precision. This GLEU
score's range is always between 0 (no matches) and 1 (all match) and
it is symmetrical when switching output and target. According to
our experiments, GLEU score correlates quite well with the BLEU
metric on a corpus level but does not have its drawbacks for our per
sentence reward objective.
"""

_UpperCamelCase		     =    """\
Computes corpus-level Google BLEU (GLEU) score of translated segments against one or more references.
Instead of averaging the sentence level GLEU scores (i.e. macro-average precision), Wu et al. (2016) sum up the matching
tokens and the max of hypothesis and reference tokens for each sentence, then compute using the aggregate values.

Args:
    predictions (list of str): list of translations to score.
        Each translation should be tokenized into a list of tokens.
    references (list of list of str): list of lists of references for each translation.
        Each reference should be tokenized into a list of tokens.
    min_len (int): The minimum order of n-gram this function should extract. Defaults to 1.
    max_len (int): The maximum order of n-gram this function should extract. Defaults to 4.

Returns:
    'google_bleu': google_bleu score

Examples:
    Example 1:
        >>> hyp1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'which',
        ...         'ensures', 'that', 'the', 'rubber', 'duck', 'always',
        ...         'disobeys', 'the', 'commands', 'of', 'the', 'cat']
        >>> ref1a = ['It', 'is', 'the', 'guiding', 'principle', 'which',
        ...          'guarantees', 'the', 'rubber', 'duck', 'forces', 'never',
        ...          'being', 'under', 'the', 'command', 'of', 'the', 'cat']

        >>> hyp2 = ['he', 'read', 'the', 'book', 'because', 'he', 'was',
        ...         'interested', 'in', 'world', 'history']
        >>> ref2a = ['he', 'was', 'interested', 'in', 'world', 'history',
        ...          'because', 'he', 'read', 'the', 'book']

        >>> list_of_references = [[ref1a], [ref2a]]
        >>> hypotheses = [hyp1, hyp2]
        >>> google_bleu = datasets.load_metric(\"google_bleu\")
        >>> results = google_bleu.compute(predictions=hypotheses, references=list_of_references)
        >>> print(round(results[\"google_bleu\"], 2))
        0.44

    Example 2:
        >>> hyp1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'which',
        ...         'ensures', 'that', 'the', 'rubber', 'duck', 'always',
        ...         'disobeys', 'the', 'commands', 'of', 'the', 'cat']
        >>> ref1a = ['It', 'is', 'the', 'guiding', 'principle', 'which',
        ...          'guarantees', 'the', 'rubber', 'duck', 'forces', 'never',
        ...          'being', 'under', 'the', 'command', 'of', 'the', 'cat']
        >>> ref1b = ['It', 'is', 'a', 'guide', 'to', 'action', 'that',
        ...          'ensures', 'that', 'the', 'rubber', 'duck', 'will', 'never',
        ...          'heed', 'the', 'cat', 'commands']
        >>> ref1c = ['It', 'is', 'the', 'practical', 'guide', 'for', 'the',
        ...          'rubber', 'duck', 'army', 'never', 'to', 'heed', 'the', 'directions',
        ...          'of', 'the', 'cat']

        >>> hyp2 = ['he', 'read', 'the', 'book', 'because', 'he', 'was',
        ...         'interested', 'in', 'world', 'history']
        >>> ref2a = ['he', 'was', 'interested', 'in', 'world', 'history',
        ...          'because', 'he', 'read', 'the', 'book']

        >>> list_of_references = [[ref1a, ref1b, ref1c], [ref2a]]
        >>> hypotheses = [hyp1, hyp2]
        >>> google_bleu = datasets.load_metric(\"google_bleu\")
        >>> results = google_bleu.compute(predictions=hypotheses, references=list_of_references)
        >>> print(round(results[\"google_bleu\"], 2))
        0.61

    Example 3:
        >>> hyp1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'which',
        ...         'ensures', 'that', 'the', 'rubber', 'duck', 'always',
        ...         'disobeys', 'the', 'commands', 'of', 'the', 'cat']
        >>> ref1a = ['It', 'is', 'the', 'guiding', 'principle', 'which',
        ...          'guarantees', 'the', 'rubber', 'duck', 'forces', 'never',
        ...          'being', 'under', 'the', 'command', 'of', 'the', 'cat']
        >>> ref1b = ['It', 'is', 'a', 'guide', 'to', 'action', 'that',
        ...          'ensures', 'that', 'the', 'rubber', 'duck', 'will', 'never',
        ...          'heed', 'the', 'cat', 'commands']
        >>> ref1c = ['It', 'is', 'the', 'practical', 'guide', 'for', 'the',
        ...          'rubber', 'duck', 'army', 'never', 'to', 'heed', 'the', 'directions',
        ...          'of', 'the', 'cat']

        >>> hyp2 = ['he', 'read', 'the', 'book', 'because', 'he', 'was',
        ...         'interested', 'in', 'world', 'history']
        >>> ref2a = ['he', 'was', 'interested', 'in', 'world', 'history',
        ...          'because', 'he', 'read', 'the', 'book']

        >>> list_of_references = [[ref1a, ref1b, ref1c], [ref2a]]
        >>> hypotheses = [hyp1, hyp2]
        >>> google_bleu = datasets.load_metric(\"google_bleu\")
        >>> results = google_bleu.compute(predictions=hypotheses, references=list_of_references, min_len=2)
        >>> print(round(results[\"google_bleu\"], 2))
        0.53

    Example 4:
        >>> hyp1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'which',
        ...         'ensures', 'that', 'the', 'rubber', 'duck', 'always',
        ...         'disobeys', 'the', 'commands', 'of', 'the', 'cat']
        >>> ref1a = ['It', 'is', 'the', 'guiding', 'principle', 'which',
        ...          'guarantees', 'the', 'rubber', 'duck', 'forces', 'never',
        ...          'being', 'under', 'the', 'command', 'of', 'the', 'cat']
        >>> ref1b = ['It', 'is', 'a', 'guide', 'to', 'action', 'that',
        ...          'ensures', 'that', 'the', 'rubber', 'duck', 'will', 'never',
        ...          'heed', 'the', 'cat', 'commands']
        >>> ref1c = ['It', 'is', 'the', 'practical', 'guide', 'for', 'the',
        ...          'rubber', 'duck', 'army', 'never', 'to', 'heed', 'the', 'directions',
        ...          'of', 'the', 'cat']

        >>> hyp2 = ['he', 'read', 'the', 'book', 'because', 'he', 'was',
        ...         'interested', 'in', 'world', 'history']
        >>> ref2a = ['he', 'was', 'interested', 'in', 'world', 'history',
        ...          'because', 'he', 'read', 'the', 'book']

        >>> list_of_references = [[ref1a, ref1b, ref1c], [ref2a]]
        >>> hypotheses = [hyp1, hyp2]
        >>> google_bleu = datasets.load_metric(\"google_bleu\")
        >>> results = google_bleu.compute(predictions=hypotheses,references=list_of_references, min_len=2, max_len=6)
        >>> print(round(results[\"google_bleu\"], 2))
        0.4
"""






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





       """simple docstring"""


       def 			SCREAMING_SNAKE_CASE_	(   self   ):





        """simple docstring"""

        return datasets.MetricInfo(
            description=_DESCRIPTION			,					citation=_CITATION			,					inputs_description=_KWARGS_DESCRIPTION			,					features=datasets.Features(
                {
                    "predictions": datasets.Sequence(datasets.Value("string"			,					id="token"   )			,					id="sequence"   ),
                    "references": datasets.Sequence(
                        datasets.Sequence(datasets.Value("string"			,					id="token"   )			,					id="sequence"   )			,					id="references"   ),
                }   )			,					)






       def 			SCREAMING_SNAKE_CASE_	(   self			,					snake_case			,					snake_case			,					snake_case = 1			,					snake_case = 4			,					):





        """simple docstring"""

        return {
            "google_bleu": gleu_score.corpus_gleu(
                list_of_references=snake_case			,					hypotheses=snake_case			,					min_len=snake_case			,					max_len=snake_case   )
        }






