

'''simple docstring'''

import tempfile
import unittest

import numpy as np

import transformers
from transformers import GPTaConfig, GPTaTokenizer, is_flax_available, is_torch_available
from transformers.testing_utils import is_pt_flax_cross_test, require_flax, slow

from ...generation.test_flax_utils import FlaxGenerationTesterMixin
from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_flax_available():
 import jax
 import jax.numpy as jnp

 from transformers.modeling_flax_pytorch_utils import (
     convert_pytorch_state_dict_to_flax,
     load_flax_weights_in_pytorch_model,
 )
 from transformers.models.gpta.modeling_flax_gpta import FlaxGPTaLMHeadModel, FlaxGPTaModel

if is_torch_available():
 import torch




class 			A_					:






     '''simple docstring'''



     def __init__(						self					:	int	,     lowercase_					:	str	,     lowercase_					:	Any=14	,     lowercase_					:	str=7	,     lowercase_					:	Dict=True	,     lowercase_					:	List[str]=True	,     lowercase_					:	Optional[int]=False	,     lowercase_					:	Optional[int]=True	,     lowercase_					:	str=99	,     lowercase_					:	Optional[int]=32	,     lowercase_					:	Optional[Any]=5	,     lowercase_					:	Any=4	,     lowercase_					:	Any=37	,     lowercase_					:	Optional[Any]="gelu"	,     lowercase_					:	List[Any]=0.1	,     lowercase_					:	Union[str, Any]=0.1	,     lowercase_					:	Optional[Any]=512	,     lowercase_					:	Optional[int]=0.02	,     )		->      Union[str, Any]:
      UpperCAmelCase			:      Optional[int]		   =					parent
      UpperCAmelCase			:      Dict		   =					batch_size
      UpperCAmelCase			:      List[str]		   =					seq_length
      UpperCAmelCase			:      Any		   =					is_training
      UpperCAmelCase			:      str		   =					use_input_mask
      UpperCAmelCase			:      Optional[Any]		   =					use_token_type_ids
      UpperCAmelCase			:      int		   =					use_labels
      UpperCAmelCase			:      List[str]		   =					vocab_size
      UpperCAmelCase			:      Optional[Any]		   =					hidden_size
      UpperCAmelCase			:      Optional[Any]		   =					num_hidden_layers
      UpperCAmelCase			:      str		   =					num_attention_heads
      UpperCAmelCase			:      Tuple		   =					intermediate_size
      UpperCAmelCase			:      Tuple		   =					hidden_act
      UpperCAmelCase			:      Union[str, Any]		   =					hidden_dropout_prob
      UpperCAmelCase			:      List[Any]		   =					attention_probs_dropout_prob
      UpperCAmelCase			:      Tuple		   =					max_position_embeddings
      UpperCAmelCase			:      List[str]		   =					initializer_range
      UpperCAmelCase			:      Tuple		   =					None
      UpperCAmelCase			:      int		   =					vocab_size - 1
      UpperCAmelCase			:      List[str]		   =					vocab_size - 1
      UpperCAmelCase			:      Union[str, Any]		   =					vocab_size - 1


     def   UpperCAmelCase_			(						self					:	List[Any]			)		->      List[str]:
      UpperCAmelCase			:      Union[str, Any]		   =					ids_tensor([self.batch_size, self.seq_length]	,     self.vocab_size			)

      UpperCAmelCase			:      Optional[int]		   =					None
      if self.use_input_mask:
       UpperCAmelCase			:      Any		   =					random_attention_mask([self.batch_size, self.seq_length]			)

      UpperCAmelCase			:      Any		   =					GPTaConfig(
          vocab_size=self.vocab_size	,     n_embd=self.hidden_size	,     n_layer=self.num_hidden_layers	,     n_head=self.num_attention_heads	,     n_positions=self.max_position_embeddings	,     use_cache=lowercase_	,     bos_token_id=self.bos_token_id	,     eos_token_id=self.eos_token_id	,     pad_token_id=self.pad_token_id	,     )

      return (config, input_ids, input_mask)


     def   UpperCAmelCase_			(						self					:	str			)		->      str:
      UpperCAmelCase			:      Optional[int]		   =					self.prepare_config_and_inputs()
      UpperCAmelCase   ,					UpperCAmelCase   ,					UpperCAmelCase			:      Dict		   =					config_and_inputs
      UpperCAmelCase			:      List[str]		   =					{'input_ids': input_ids, 'attention_mask': attention_mask}
      return config, inputs_dict


     def   UpperCAmelCase_			(						self					:	List[str]			)		->      int:
      UpperCAmelCase   ,					UpperCAmelCase   ,					UpperCAmelCase			:      Optional[Any]		   =					self.prepare_config_and_inputs()

      UpperCAmelCase			:      str		   =					floats_tensor([self.batch_size, self.seq_length, self.hidden_size]			)
      UpperCAmelCase			:      Tuple		   =					ids_tensor([self.batch_size, self.seq_length]	,     vocab_size=2			)

      return (
          config,
          input_ids,
          attention_mask,
          encoder_hidden_states,
          encoder_attention_mask,
      )


     def   UpperCAmelCase_			(						self					:	List[Any]	,     lowercase_					:	Tuple	,     lowercase_					:	List[Any]	,     lowercase_					:	Any	,     lowercase_					:	Tuple			)		->      Union[str, Any]:
      UpperCAmelCase			:      Optional[Any]		   =					20
      UpperCAmelCase			:      List[Any]		   =					model_class_name(lowercase_			)

      UpperCAmelCase			:      Union[str, Any]		   =					model.init_cache(input_ids.shape[0]	,     lowercase_			)
      UpperCAmelCase			:      Optional[Any]		   =					jnp.ones((input_ids.shape[0], max_decoder_length)	,     dtype='i4'			)

      UpperCAmelCase			:      Optional[Any]		   =					jnp.broadcast_to(
          jnp.arange(input_ids.shape[-1] - 1			)[None, :]	,     (input_ids.shape[0], input_ids.shape[-1] - 1)			)
      UpperCAmelCase			:      Dict		   =					model(
          input_ids[:, :-1]	,     attention_mask=lowercase_	,     past_key_values=lowercase_	,     position_ids=lowercase_	,     )

      UpperCAmelCase			:      List[Any]		   =					jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]	,     dtype='i4'			)
      UpperCAmelCase			:      Dict		   =					model(
          input_ids[:, -1:]	,     attention_mask=lowercase_	,     past_key_values=outputs_cache.past_key_values	,     position_ids=lowercase_	,     )

      UpperCAmelCase			:      List[str]		   =					model(lowercase_			)

      UpperCAmelCase			:      Optional[int]		   =					np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])			)			)
      self.parent.assertTrue(diff < 1E-3	,     msg=f"""Max diff is {diff}"""			)




     def   UpperCAmelCase_			(						self					:	Dict	,     lowercase_					:	Optional[Any]	,     lowercase_					:	Optional[Any]	,     lowercase_					:	Dict	,     lowercase_					:	Optional[int]			)		->      List[str]:
      UpperCAmelCase			:      Union[str, Any]		   =					20
      UpperCAmelCase			:      Any		   =					model_class_name(lowercase_			)

      UpperCAmelCase			:      int		   =					jnp.concatenate(
          [attention_mask, jnp.zeros((attention_mask.shape[0], max_decoder_length - attention_mask.shape[1])			)]	,     axis=-1	,     )

      UpperCAmelCase			:      Optional[Any]		   =					model.init_cache(input_ids.shape[0]	,     lowercase_			)
      UpperCAmelCase			:      Tuple		   =					jnp.broadcast_to(
          jnp.arange(input_ids.shape[-1] - 1			)[None, :]	,     (input_ids.shape[0], input_ids.shape[-1] - 1)			)

      UpperCAmelCase			:      Optional[int]		   =					model(
          input_ids[:, :-1]	,     attention_mask=lowercase_	,     past_key_values=lowercase_	,     position_ids=lowercase_	,     )
      UpperCAmelCase			:      int		   =					jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]	,     dtype='i4'			)
      UpperCAmelCase			:      List[Any]		   =					model(
          input_ids[:, -1:]	,     past_key_values=outputs_cache.past_key_values	,     attention_mask=lowercase_	,     position_ids=lowercase_	,     )

      UpperCAmelCase			:      Optional[int]		   =					model(lowercase_	,     attention_mask=lowercase_			)

      UpperCAmelCase			:      Optional[int]		   =					np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])			)			)
      self.parent.assertTrue(diff < 1E-3	,     msg=f"""Max diff is {diff}"""			)




@require_flax
class 			A_					(							_snake_case			,  _snake_case			,  unittest.TestCase				):






     '''simple docstring'''



     UpperCAmelCase_		:      Tuple    						=    (FlaxGPTaModel, FlaxGPTaLMHeadModel) if is_flax_available() else ()
     UpperCAmelCase_		:      Any    						=    (FlaxGPTaLMHeadModel,) if is_flax_available() else ()


     def   UpperCAmelCase_			(						self					:	List[str]			)		->      Tuple:
      UpperCAmelCase			:      Optional[int]		   =					FlaxGPTaModelTester(self			)


     def   UpperCAmelCase_			(						self					:	List[Any]			)		->      Tuple:
      for model_class_name in self.all_model_classes:
       UpperCAmelCase   ,					UpperCAmelCase   ,					UpperCAmelCase			:      Tuple		   =					self.model_tester.prepare_config_and_inputs()
       self.model_tester.check_use_cache_forward(lowercase_	,     lowercase_	,     lowercase_	,     lowercase_			)


     def   UpperCAmelCase_			(						self					:	int			)		->      Union[str, Any]:
      for model_class_name in self.all_model_classes:
       UpperCAmelCase   ,					UpperCAmelCase   ,					UpperCAmelCase			:      Optional[Any]		   =					self.model_tester.prepare_config_and_inputs()
       self.model_tester.check_use_cache_forward_with_attn_mask(
           lowercase_	,     lowercase_	,     lowercase_	,     lowercase_			)


     @slow
     def   UpperCAmelCase_			(						self					:	int			)		->      List[str]:
      UpperCAmelCase			:      Optional[int]		   =					GPTaTokenizer.from_pretrained('gpt2'	,     pad_token='</s>'	,     padding_side='left'			)
      UpperCAmelCase			:      int		   =					tokenizer(['Hello this is a long string', 'Hey']	,     return_tensors='np'	,     padding=lowercase_	,     truncation=lowercase_			)

      UpperCAmelCase			:      Optional[Any]		   =					FlaxGPTaLMHeadModel.from_pretrained('gpt2'			)
      UpperCAmelCase			:      List[Any]		   =					False
      UpperCAmelCase			:      str		   =					model.config.eos_token_id

      UpperCAmelCase			:      Optional[Any]		   =					jax.jit(model.generate			)

      UpperCAmelCase			:      Optional[int]		   =					jit_generate(inputs['input_ids']	,     attention_mask=inputs['attention_mask']			).sequences

      UpperCAmelCase			:      Any		   =					tokenizer.batch_decode(lowercase_	,     skip_special_tokens=lowercase_			)

      UpperCAmelCase			:      int		   =					[
          'Hello this is a long string of words. I\'m going to start with the first one.\n',
          'Hey, I\'m not sure if I\'m going to be able to do',
      ]

      self.assertListEqual(lowercase_	,     lowercase_			)


     @is_pt_flax_cross_test
     def   UpperCAmelCase_			(						self					:	Tuple			)		->      int:
      UpperCAmelCase   ,					UpperCAmelCase			:      int		   =					self.model_tester.prepare_config_and_inputs_for_common()

      for model_class in self.all_model_classes:
       with self.subTest(model_class.__name__			):
        # prepare inputs
        UpperCAmelCase			:      int		   =					self._prepare_for_class(lowercase_	,     lowercase_			)
        UpperCAmelCase			:      int		   =					{k: torch.tensor(v.tolist()			) for k, v in prepared_inputs_dict.items()}

        # load corresponding PyTorch class
        UpperCAmelCase			:      Any		   =					model_class.__name__[4:]  # Skip the "Flax" at the beginning
        UpperCAmelCase			:      Tuple		   =					getattr(lowercase_	,     lowercase_			)

        UpperCAmelCase   ,					UpperCAmelCase			:      Optional[int]		   =					pt_inputs['input_ids'].shape
        UpperCAmelCase			:      int		   =					np.random.randint(0	,     seq_length - 1	,     size=(batch_size,)			)
        for batch_idx, start_index in enumerate(lowercase_			):
         UpperCAmelCase			:      str		   =					0
         UpperCAmelCase			:      List[str]		   =					1
         UpperCAmelCase			:      List[Any]		   =					0
         UpperCAmelCase			:      Optional[Any]		   =					1
        UpperCAmelCase			:      List[str]		   =					pt_model_class(lowercase_			).eval()
        UpperCAmelCase			:      Optional[int]		   =					model_class(lowercase_	,     dtype=jnp.floataa			)

        UpperCAmelCase			:      List[str]		   =					convert_pytorch_state_dict_to_flax(pt_model.state_dict()	,     lowercase_			)
        UpperCAmelCase			:      Union[str, Any]		   =					fx_state

        with torch.no_grad():
         UpperCAmelCase			:      Union[str, Any]		   =					pt_model(**lowercase_			).to_tuple()

        UpperCAmelCase			:      List[Any]		   =					fx_model(**lowercase_			).to_tuple()
        self.assertEqual(len(lowercase_			)	,     len(lowercase_			)	,     'Output lengths differ between Flax and PyTorch'			)
        for fx_output, pt_output in zip(lowercase_	,     lowercase_			):
         self.assert_almost_equals(fx_output[:, -1]	,     pt_output[:, -1].numpy()	,     4E-2			)

        with tempfile.TemporaryDirectory() as tmpdirname:
         pt_model.save_pretrained(lowercase_			)
         UpperCAmelCase			:      str		   =					model_class.from_pretrained(lowercase_	,     from_pt=lowercase_			)

        UpperCAmelCase			:      Optional[Any]		   =					fx_model_loaded(**lowercase_			).to_tuple()
        self.assertEqual(
            len(lowercase_			)	,     len(lowercase_			)	,     'Output lengths differ between Flax and PyTorch'			)
        for fx_output_loaded, pt_output in zip(lowercase_	,     lowercase_			):
         self.assert_almost_equals(fx_output_loaded[:, -1]	,     pt_output[:, -1].numpy()	,     4E-2			)


     @is_pt_flax_cross_test
     def   UpperCAmelCase_			(						self					:	Optional[int]			)		->      Dict:
      UpperCAmelCase   ,					UpperCAmelCase			:      Optional[int]		   =					self.model_tester.prepare_config_and_inputs_for_common()
      for model_class in self.all_model_classes:
       with self.subTest(model_class.__name__			):
        # prepare inputs
        UpperCAmelCase			:      Any		   =					self._prepare_for_class(lowercase_	,     lowercase_			)
        UpperCAmelCase			:      Tuple		   =					{k: torch.tensor(v.tolist()			) for k, v in prepared_inputs_dict.items()}

        # load corresponding PyTorch class
        UpperCAmelCase			:      str		   =					model_class.__name__[4:]  # Skip the "Flax" at the beginning
        UpperCAmelCase			:      Tuple		   =					getattr(lowercase_	,     lowercase_			)

        UpperCAmelCase			:      Union[str, Any]		   =					pt_model_class(lowercase_			).eval()
        UpperCAmelCase			:      Optional[int]		   =					model_class(lowercase_	,     dtype=jnp.floataa			)

        UpperCAmelCase			:      int		   =					load_flax_weights_in_pytorch_model(lowercase_	,     fx_model.params			)
        UpperCAmelCase   ,					UpperCAmelCase			:      int		   =					pt_inputs['input_ids'].shape
        UpperCAmelCase			:      str		   =					np.random.randint(0	,     seq_length - 1	,     size=(batch_size,)			)
        for batch_idx, start_index in enumerate(lowercase_			):
         UpperCAmelCase			:      Union[str, Any]		   =					0
         UpperCAmelCase			:      List[Any]		   =					1
         UpperCAmelCase			:      List[Any]		   =					0
         UpperCAmelCase			:      Any		   =					1

        # make sure weights are tied in PyTorch
        pt_model.tie_weights()

        with torch.no_grad():
         UpperCAmelCase			:      Any		   =					pt_model(**lowercase_			).to_tuple()

        UpperCAmelCase			:      Optional[int]		   =					fx_model(**lowercase_			).to_tuple()
        self.assertEqual(len(lowercase_			)	,     len(lowercase_			)	,     'Output lengths differ between Flax and PyTorch'			)
        for fx_output, pt_output in zip(lowercase_	,     lowercase_			):
         self.assert_almost_equals(fx_output[:, -1]	,     pt_output[:, -1].numpy()	,     4E-2			)

        with tempfile.TemporaryDirectory() as tmpdirname:
         fx_model.save_pretrained(lowercase_			)
         UpperCAmelCase			:      Union[str, Any]		   =					pt_model_class.from_pretrained(lowercase_	,     from_flax=lowercase_			)

        with torch.no_grad():
         UpperCAmelCase			:      Optional[Any]		   =					pt_model_loaded(**lowercase_			).to_tuple()

        self.assertEqual(
            len(lowercase_			)	,     len(lowercase_			)	,     'Output lengths differ between Flax and PyTorch'			)
        for fx_output, pt_output in zip(lowercase_	,     lowercase_			):
         self.assert_almost_equals(fx_output[:, -1]	,     pt_output[:, -1].numpy()	,     4E-2			)




     @slow
     def   UpperCAmelCase_			(						self					:	Optional[int]			)		->      Tuple:
      for model_class_name in self.all_model_classes:
       UpperCAmelCase			:      int		   =					model_class_name.from_pretrained('gpt2'	,     from_pt=lowercase_			)
       UpperCAmelCase			:      Optional[int]		   =					model(np.ones((1, 1)			)			)
       self.assertIsNotNone(lowercase_			)







'''simple docstring'''

import sacrebleu as scb
from packaging import version

import datasets


lowercase__            =     "\\n@inproceedings{post-2018-call,\n    title = \"A Call for Clarity in Reporting {BLEU} Scores\",\n    author = \"Post, Matt\",\n    booktitle = \"Proceedings of the Third Conference on Machine Translation: Research Papers\",\n    month = oct,\n    year = \"2018\",\n    address = \"Belgium, Brussels\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://www.aclweb.org/anthology/W18-6319\",\n    pages = \"186--191\",\n}\n"

lowercase__            =     "\\nSacreBLEU provides hassle-free computation of shareable, comparable, and reproducible BLEU scores.\nInspired by Rico Sennrich's `multi-bleu-detok.perl`, it produces the official WMT scores but works with plain text.\nIt also knows all the standard test sets and handles downloading, processing, and tokenization for you.\n\nSee the [README.md] file at https://github.com/mjpost/sacreBLEU for more information.\n"

lowercase__            =     "\nProduces BLEU scores along with its sufficient statistics\nfrom a source against one or more references.\n\nArgs:\n    predictions (`list` of `str`): list of translations to score. Each translation should be tokenized into a list of tokens.\n    references (`list` of `list` of `str`): A list of lists of references. The contents of the first sub-list are the references for the first prediction, the contents of the second sub-list are for the second prediction, etc. Note that there must be the same number of references for each prediction (i.e. all sub-lists must be of the same length).\n    smooth_method (`str`): The smoothing method to use, defaults to `'exp'`. Possible values are:\n        - `'none'`: no smoothing\n        - `'floor'`: increment zero counts\n        - `'add-k'`: increment num/denom by k for n>1\n        - `'exp'`: exponential decay\n    smooth_value (`float`): The smoothing value. Only valid when `smooth_method='floor'` (in which case `smooth_value` defaults to `0.1`) or `smooth_method='add-k'` (in which case `smooth_value` defaults to `1`).\n    tokenize (`str`): Tokenization method to use for BLEU. If not provided, defaults to `'zh'` for Chinese, `'ja-mecab'` for Japanese and `'13a'` (mteval) otherwise. Possible values are:\n        - `'none'`: No tokenization.\n        - `'zh'`: Chinese tokenization.\n        - `'13a'`: mimics the `mteval-v13a` script from Moses.\n        - `'intl'`: International tokenization, mimics the `mteval-v14` script from Moses\n        - `'char'`: Language-agnostic character-level tokenization.\n        - `'ja-mecab'`: Japanese tokenization. Uses the [MeCab tokenizer](https://pypi.org/project/mecab-python3).\n    lowercase (`bool`): If `True`, lowercases the input, enabling case-insensitivity. Defaults to `False`.\n    force (`bool`): If `True`, insists that your tokenized input is actually detokenized. Defaults to `False`.\n    use_effective_order (`bool`): If `True`, stops including n-gram orders for which precision is 0. This should be `True`, if sentence-level BLEU will be computed. Defaults to `False`.\n\nReturns:\n    'score': BLEU score,\n    'counts': Counts,\n    'totals': Totals,\n    'precisions': Precisions,\n    'bp': Brevity penalty,\n    'sys_len': predictions length,\n    'ref_len': reference length,\n\nExamples:\n\n    Example 1:\n        >>> predictions = [\"hello there general kenobi\", \"foo bar foobar\"]\n        >>> references = [[\"hello there general kenobi\", \"hello there !\"], [\"foo bar foobar\", \"foo bar foobar\"]]\n        >>> sacrebleu = datasets.load_metric(\"sacrebleu\")\n        >>> results = sacrebleu.compute(predictions=predictions, references=references)\n        >>> print(list(results.keys()))\n        ['score', 'counts', 'totals', 'precisions', 'bp', 'sys_len', 'ref_len']\n        >>> print(round(results[\"score\"], 1))\n        100.0\n\n    Example 2:\n        >>> predictions = [\"hello there general kenobi\",\n        ...                 \"on our way to ankh morpork\"]\n        >>> references = [[\"hello there general kenobi\", \"hello there !\"],\n        ...                 [\"goodbye ankh morpork\", \"ankh morpork\"]]\n        >>> sacrebleu = datasets.load_metric(\"sacrebleu\")\n        >>> results = sacrebleu.compute(predictions=predictions,\n        ...                             references=references)\n        >>> print(list(results.keys()))\n        ['score', 'counts', 'totals', 'precisions', 'bp', 'sys_len', 'ref_len']\n        >>> print(round(results[\"score\"], 1))\n        39.8\n"




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






     '''simple docstring'''



     def   UpperCAmelCase_			(						self					:	Tuple			)		->      Union[str, Any]:
      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"`.'			)
      return datasets.MetricInfo(
          description=_DESCRIPTION	,     citation=_CITATION	,     homepage='https://github.com/mjpost/sacreBLEU'	,     inputs_description=_KWARGS_DESCRIPTION	,     features=datasets.Features(
              {
                  'predictions': datasets.Value('string'	,     id='sequence'			),
                  'references': datasets.Sequence(datasets.Value('string'	,     id='sequence'			)	,     id='references'			),
              }			)	,     codebase_urls=['https://github.com/mjpost/sacreBLEU']	,     reference_urls=[
              'https://github.com/mjpost/sacreBLEU',
              'https://en.wikipedia.org/wiki/BLEU',
              'https://towardsdatascience.com/evaluating-text-output-in-nlp-bleu-at-your-own-risk-e8609665a213',
          ]	,     )




     def   UpperCAmelCase_			(						self					:	Union[str, Any]	,     lowercase_					:	Union[str, Any]	,     lowercase_					:	int	,     lowercase_					:	List[Any]="exp"	,     lowercase_					:	Optional[int]=None	,     lowercase_					:	List[str]=False	,     lowercase_					:	Tuple=False	,     lowercase_					:	int=None	,     lowercase_					:	str=False	,     )		->      Dict:
      UpperCAmelCase			:      Union[str, Any]		   =					len(references[0]			)
      if any(len(lowercase_			) != references_per_prediction for refs in references			):
       raise ValueError('Sacrebleu requires the same number of references for each prediction'			)
      UpperCAmelCase			:      Optional[Any]		   =					[[refs[i] for refs in references] for i in range(lowercase_			)]
      UpperCAmelCase			:      List[Any]		   =					scb.corpus_bleu(
          lowercase_	,     lowercase_	,     smooth_method=lowercase_	,     smooth_value=lowercase_	,     force=lowercase_	,     lowercase=lowercase_	,     use_effective_order=lowercase_	,     **({'tokenize': tokenize} if tokenize else {})	,     )
      UpperCAmelCase			:      Union[str, Any]		   =					{
          'score': output.score,
          'counts': output.counts,
          'totals': output.totals,
          'precisions': output.precisions,
          'bp': output.bp,
          'sys_len': output.sys_len,
          'ref_len': output.ref_len,
      }
      return output_dict




