






'''simple docstring'''





import time
from dataclasses import dataclass
from multiprocessing import Pool
from unittest import TestCase
from unittest.mock import patch

import multiprocess
import numpy as np
import pytest

from datasets.utils.py_utils import (
    NestedDataStructure,
    asdict,
    iflatmap_unordered,
    map_nested,
    temp_seed,
    temporary_assignment,
    zip_dict,
)

from .utils import require_tf, require_torch






def    lowerCamelCase_     (    lowercase__):  # picklable for multiprocessing
	return x.sum()






def    lowerCamelCase_     (    lowercase__):  # picklable for multiprocessing
	return i + 1
@dataclass
class 				lowercase       :


				'''simple docstring'''

				lowerCAmelCase__      				=							42
				lowerCAmelCase__      				=							42
class 				lowercase       (							_lowerCamelCase      ):


				'''simple docstring'''

				def    a__				(					self     :     List[str]     )							->							Optional[int]:

					'''simple docstring'''




					lowerCamelCase__  =     {}
					lowerCamelCase__  =     []
					lowerCamelCase__  =     1
					lowerCamelCase__  =     [1, 2]
					lowerCamelCase__  =     {"a": 1, "b": 2}
					lowerCamelCase__  =     {"a": [1, 2], "b": [3, 4]}
					lowerCamelCase__  =     {"a": {"1": 1}, "b": 2}
					lowerCamelCase__  =     {"a": 1, "b": 2, "c": 3, "d": 4}
					lowerCamelCase__  =     {}
					lowerCamelCase__  =     []
					lowerCamelCase__  =     2
					lowerCamelCase__  =     [2, 3]
					lowerCamelCase__  =     {"a": 2, "b": 3}
					lowerCamelCase__  =     {"a": [2, 3], "b": [4, 5]}
					lowerCamelCase__  =     {"a": {"1": 2}, "b": 3}
					lowerCamelCase__  =     {"a": 2, "b": 3, "c": 4, "d": 5}
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase     )				,     __lowerCamelCase     )

					lowerCamelCase__  =     2
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )

					lowerCamelCase__  =     {"a": np.eye(2     ), "b": np.zeros(3     ), "c": np.ones(2     )}
					lowerCamelCase__  =     {"a": 2, "b": 0, "c": 2}
					lowerCamelCase__  =     {
					    "a": np.eye(2     ).astype(__lowerCamelCase     ),
					    "b": np.zeros(3     ).astype(__lowerCamelCase     ),
					    "c": np.ones(2     ).astype(__lowerCamelCase     ),
					}
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     map_numpy=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(
					    {k: v.tolist() for k, v in map_nested(__lowerCamelCase				,     __lowerCamelCase				,     map_numpy=__lowerCamelCase     ).items()}				,     {k: v.tolist() for k, v in expected_map_nested_sna_int.items()}				,     )
					self.assertEqual(map_nested(__lowerCamelCase				,     __lowerCamelCase				,     map_numpy=__lowerCamelCase				,     num_proc=__lowerCamelCase     )				,     __lowerCamelCase     )
					self.assertEqual(
					    {k: v.tolist() for k, v in map_nested(__lowerCamelCase				,     __lowerCamelCase				,     map_numpy=__lowerCamelCase				,     num_proc=__lowerCamelCase     ).items()}				,     {k: v.tolist() for k, v in expected_map_nested_sna_int.items()}				,     )
					with self.assertRaises(__lowerCamelCase     ):  # can't pickle a local lambda
						map_nested(lambda __lowerCamelCase     : x + 1				,     __lowerCamelCase				,     num_proc=__lowerCamelCase     )

				def    a__				(					self     :     str     )							->							Dict:

					'''simple docstring'''




					lowerCamelCase__  =     {"a": 1, "b": 2}
					lowerCamelCase__  =     {"a": 3, "b": 4}
					lowerCamelCase__  =     {"a": 5, "b": 6}
					lowerCamelCase__  =     sorted([("a", (1, 3, 5)), ("b", (2, 4, 6))]     )
					self.assertEqual(sorted(zip_dict(__lowerCamelCase				,     __lowerCamelCase				,     __lowerCamelCase     )     )				,     __lowerCamelCase     )




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

					'''simple docstring'''




					class 				lowercase       :


									'''simple docstring'''

									lowerCAmelCase__      				=							"bar"
					lowerCamelCase__  =     Foo()
					self.assertEqual(foo.my_attr				,     "bar"     )
					with temporary_assignment(__lowerCamelCase				,     "my_attr"				,     "BAR"     ):
						self.assertEqual(foo.my_attr				,     "BAR"     )
					self.assertEqual(foo.my_attr				,     "bar"     )






@pytest.mark.parametrize(
    "iterable_length, num_proc, expected_num_proc"				,     [
        (1, None, 1),
        (1, 1, 1),
        (2, None, 1),
        (2, 1, 1),
        (2, 2, 1),
        (2, 3, 1),
        (3, 2, 1),
        (16, 16, 16),
        (16, 17, 16),
        (17, 16, 16),
    ]				,     )
def    lowerCamelCase_     (    lowercase__				,     lowercase__				,     lowercase__):
	with patch("datasets.utils.py_utils._single_map_nested") as mock_single_map_nested, patch(
	    "datasets.parallel.parallel.Pool") as mock_multiprocessing_pool:
		lowerCamelCase__  =     {F'''{i}''': i for i in range(lowercase__)}
		lowerCamelCase__  =     map_nested(lambda lowercase__: x + 10				,     lowercase__				,     num_proc=lowercase__				,     parallel_min_length=16)
		if expected_num_proc == 1:
			assert mock_single_map_nested.called
			assert not mock_multiprocessing_pool.called
		else:
			assert not mock_single_map_nested.called
			assert mock_multiprocessing_pool.called
			assert mock_multiprocessing_pool.call_args[0][0] == expected_num_proc
class 				lowercase       (							_lowerCamelCase      ):


				'''simple docstring'''

				@require_tf
				def    a__				(					self     :     Optional[Any]     )							->							str:

					'''simple docstring'''




					import tensorflow as tf
					from tensorflow.keras import layers

					lowerCamelCase__  =     layers.Dense(2     )

					def gen_random_output():
						lowerCamelCase__  =     tf.random.uniform((1, 3)     )
						return model(__lowerCamelCase     ).numpy()

					with temp_seed(42				,     set_tensorflow=__lowerCamelCase     ):
						lowerCamelCase__  =     gen_random_output()
					with temp_seed(42				,     set_tensorflow=__lowerCamelCase     ):
						lowerCamelCase__  =     gen_random_output()
					lowerCamelCase__  =     gen_random_output()

					np.testing.assert_equal(__lowerCamelCase				,     __lowerCamelCase     )
					self.assertGreater(np.abs(outa - outa     ).sum()				,     0     )

				@require_torch
				def    a__				(					self     :     Optional[Any]     )							->							Dict:

					'''simple docstring'''




					import torch

					def gen_random_output():
						lowerCamelCase__  =     torch.nn.Linear(3				,     2     )
						lowerCamelCase__  =     torch.rand(1				,     3     )
						return model(__lowerCamelCase     ).detach().numpy()

					with temp_seed(42				,     set_pytorch=__lowerCamelCase     ):
						lowerCamelCase__  =     gen_random_output()
					with temp_seed(42				,     set_pytorch=__lowerCamelCase     ):
						lowerCamelCase__  =     gen_random_output()
					lowerCamelCase__  =     gen_random_output()

					np.testing.assert_equal(__lowerCamelCase				,     __lowerCamelCase     )
					self.assertGreater(np.abs(outa - outa     ).sum()				,     0     )




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

					'''simple docstring'''




					def gen_random_output():
						return np.random.rand(1				,     3     )

					with temp_seed(42     ):
						lowerCamelCase__  =     gen_random_output()
					with temp_seed(42     ):
						lowerCamelCase__  =     gen_random_output()
					lowerCamelCase__  =     gen_random_output()

					np.testing.assert_equal(__lowerCamelCase				,     __lowerCamelCase     )
					self.assertGreater(np.abs(outa - outa     ).sum()				,     0     )






@pytest.mark.parametrize("input_data"				,     [{}])
def    lowerCamelCase_     (    lowercase__):
	lowerCamelCase__  =     NestedDataStructure(lowercase__).data
	assert output_data == input_data






@pytest.mark.parametrize(
    "data, expected_output"				,     [
        ({}, []),
        ([], []),
        ("foo", ["foo"]),
        (["foo", "bar"], ["foo", "bar"]),
        ([["foo", "bar"]], ["foo", "bar"]),
        ([[["foo"], ["bar"]]], ["foo", "bar"]),
        ([[["foo"], "bar"]], ["foo", "bar"]),
        ({"a": 1, "b": 2}, [1, 2]),
        ({"a": [1, 2], "b": [3, 4]}, [1, 2, 3, 4]),
        ({"a": [[1, 2]], "b": [[3, 4]]}, [1, 2, 3, 4]),
        ({"a": [[1, 2]], "b": [3, 4]}, [1, 2, 3, 4]),
        ({"a": [[[1], [2]]], "b": [[[3], [4]]]}, [1, 2, 3, 4]),
        ({"a": [[[1], [2]]], "b": [[3, 4]]}, [1, 2, 3, 4]),
        ({"a": [[[1], [2]]], "b": [3, 4]}, [1, 2, 3, 4]),
        ({"a": [[[1], [2]]], "b": [3, [4]]}, [1, 2, 3, 4]),
        ({"a": {"1": 1}, "b": 2}, [1, 2]),
        ({"a": {"1": [1]}, "b": 2}, [1, 2]),
        ({"a": {"1": [1]}, "b": [2]}, [1, 2]),
    ]				,     )
def    lowerCamelCase_     (    lowercase__				,     lowercase__):
	lowerCamelCase__  =     NestedDataStructure(lowercase__).flatten()
	assert output == expected_output






def    lowerCamelCase_     (    ):
	lowerCamelCase__  =     A(x=1				,     y="foobar")
	lowerCamelCase__  =     {"x": 1, "y": "foobar"}
	assert asdict(lowercase__) == expected_output

	lowerCamelCase__  =     {"a": {"b": A(x=10				,     y="foo")}, "c": [A(x=20				,     y="bar")]}
	lowerCamelCase__  =     {"a": {"b": {"x": 10, "y": "foo"}}, "c": [{"x": 20, "y": "bar"}]}
	assert asdict(lowercase__) == expected_output

	with pytest.raises(lowercase__):
		asdict([1, A(x=10				,     y="foo")])






def    lowerCamelCase_     (    lowercase__):
	return text.split()






def    lowerCamelCase_     (    lowercase__):
	yield (time.time(), content)
	time.sleep(2)
	yield (time.time(), content)






def    lowerCamelCase_     (    ):
	with Pool(2) as pool:
		lowerCamelCase__  =     list(iflatmap_unordered(lowercase__				,     _split_text				,     kwargs_iterable=[{"text": "hello there"}] * 10))
		assert out.count("hello") == 10
		assert out.count("there") == 10
		assert len(lowercase__) == 20

	# check multiprocess from pathos (uses dill for pickling)
	with multiprocess.Pool(2) as pool:
		lowerCamelCase__  =     list(iflatmap_unordered(lowercase__				,     _split_text				,     kwargs_iterable=[{"text": "hello there"}] * 10))
		assert out.count("hello") == 10
		assert out.count("there") == 10
		assert len(lowercase__) == 20

	# check that we get items as fast as possible
	with Pool(2) as pool:
		lowerCamelCase__  =     []
		for yield_time, content in iflatmap_unordered(
		    lowercase__				,     _aseconds_generator_of_aitems_with_timing				,     kwargs_iterable=[{"content": "a"}, {"content": "b"}]):
			assert yield_time < time.time() + 0.1, "we should each item directly after it was yielded"
			out.append(lowercase__)
		assert out.count("a") == 2
		assert out.count("b") == 2
		assert len(lowercase__) == 4









'''simple docstring'''





from __future__ import annotations

import unittest

from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available
from transformers.testing_utils import require_tf, require_tokenizers, slow
from transformers.utils import cached_property

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
 import tensorflow as tf

 from transformers import TFAutoModelForSeqaSeqLM, TFBlenderbotSmallForConditionalGeneration, TFBlenderbotSmallModel
@require_tf
class 				lowercase       :


    '''simple docstring'''

    lowerCAmelCase__      				=							BlenderbotSmallConfig
    lowerCAmelCase__      				=							{}
    lowerCAmelCase__      				=							"gelu"

    def __init__(					self     :     List[Any]				,     __lowerCamelCase     :     Union[str, Any]				,     __lowerCamelCase     :     str=13				,     __lowerCamelCase     :     List[str]=7				,     __lowerCamelCase     :     Dict=True				,     __lowerCamelCase     :     Any=False				,     __lowerCamelCase     :     Union[str, Any]=99				,     __lowerCamelCase     :     Optional[int]=32				,     __lowerCamelCase     :     Optional[int]=2				,     __lowerCamelCase     :     List[str]=4				,     __lowerCamelCase     :     Union[str, Any]=37				,     __lowerCamelCase     :     Tuple=0.1				,     __lowerCamelCase     :     List[str]=0.1				,     __lowerCamelCase     :     int=20				,     __lowerCamelCase     :     Optional[Any]=2				,     __lowerCamelCase     :     List[str]=1				,     __lowerCamelCase     :     Union[str, Any]=0				,     )							->							str:

     '''simple docstring'''




     lowerCamelCase__  =     parent
     lowerCamelCase__  =     batch_size
     lowerCamelCase__  =     seq_length
     lowerCamelCase__  =     is_training
     lowerCamelCase__  =     use_labels
     lowerCamelCase__  =     vocab_size
     lowerCamelCase__  =     hidden_size
     lowerCamelCase__  =     num_hidden_layers
     lowerCamelCase__  =     num_attention_heads
     lowerCamelCase__  =     intermediate_size

     lowerCamelCase__  =     hidden_dropout_prob
     lowerCamelCase__  =     attention_probs_dropout_prob
     lowerCamelCase__  =     max_position_embeddings
     lowerCamelCase__  =     eos_token_id
     lowerCamelCase__  =     pad_token_id
     lowerCamelCase__  =     bos_token_id

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

     '''simple docstring'''




     lowerCamelCase__  =     ids_tensor([self.batch_size, self.seq_length - 1]				,     self.vocab_size     )
     lowerCamelCase__  =     tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size     )				,     1     )
     lowerCamelCase__  =     tf.concat([input_ids, eos_tensor]				,     axis=1     )

     lowerCamelCase__  =     ids_tensor([self.batch_size, self.seq_length]				,     self.vocab_size     )

     lowerCamelCase__  =     self.config_cls(
         vocab_size=self.vocab_size				,     d_model=self.hidden_size				,     encoder_layers=self.num_hidden_layers				,     decoder_layers=self.num_hidden_layers				,     encoder_attention_heads=self.num_attention_heads				,     decoder_attention_heads=self.num_attention_heads				,     encoder_ffn_dim=self.intermediate_size				,     decoder_ffn_dim=self.intermediate_size				,     dropout=self.hidden_dropout_prob				,     attention_dropout=self.attention_probs_dropout_prob				,     max_position_embeddings=self.max_position_embeddings				,     eos_token_ids=[2]				,     bos_token_id=self.bos_token_id				,     pad_token_id=self.pad_token_id				,     decoder_start_token_id=self.pad_token_id				,     **self.config_updates				,     )
     lowerCamelCase__  =     prepare_blenderbot_small_inputs_dict(__lowerCamelCase				,     __lowerCamelCase				,     __lowerCamelCase     )
     return config, inputs_dict




    def    a__				(					self     :     int				,     __lowerCamelCase     :     Optional[int]				,     __lowerCamelCase     :     Optional[Any]     )							->							Tuple:

     '''simple docstring'''




     lowerCamelCase__  =     TFBlenderbotSmallModel(config=__lowerCamelCase     ).get_decoder()
     lowerCamelCase__  =     inputs_dict["input_ids"]

     lowerCamelCase__  =     input_ids[:1, :]
     lowerCamelCase__  =     inputs_dict["attention_mask"][:1, :]
     lowerCamelCase__  =     inputs_dict["head_mask"]
     lowerCamelCase__  =     1

     # first forward pass
     lowerCamelCase__  =     model(__lowerCamelCase				,     attention_mask=__lowerCamelCase				,     head_mask=__lowerCamelCase				,     use_cache=__lowerCamelCase     )

     lowerCamelCase__  ,	lowerCamelCase__  =     outputs.to_tuple()

     # create hypothetical next token and extent to next_input_ids
     lowerCamelCase__  =     ids_tensor((self.batch_size, 3)				,     config.vocab_size     )
     lowerCamelCase__  =     tf.cast(ids_tensor((self.batch_size, 3)				,     2     )				,     tf.inta     )

     # append to next input_ids and
     lowerCamelCase__  =     tf.concat([input_ids, next_tokens]				,     axis=-1     )
     lowerCamelCase__  =     tf.concat([attention_mask, next_attn_mask]				,     axis=-1     )

     lowerCamelCase__  =     model(__lowerCamelCase				,     attention_mask=__lowerCamelCase     )[0]
     lowerCamelCase__  =     model(__lowerCamelCase				,     attention_mask=__lowerCamelCase				,     past_key_values=__lowerCamelCase     )[0]

     self.parent.assertEqual(next_tokens.shape[1]				,     output_from_past.shape[1]     )

     # select random slice
     lowerCamelCase__  =     int(ids_tensor((1,)				,     output_from_past.shape[-1]     )     )
     lowerCamelCase__  =     output_from_no_past[:, -3:, random_slice_idx]
     lowerCamelCase__  =     output_from_past[:, :, random_slice_idx]

     # test that outputs are equal for slice
     tf.debugging.assert_near(__lowerCamelCase				,     __lowerCamelCase				,     rtol=1E-3     )






def    lowerCamelCase_     (    lowercase__				,     lowercase__				,     lowercase__				,     lowercase__=None				,     lowercase__=None				,     lowercase__=None				,     lowercase__=None				,     lowercase__=None				,     ):
 if attention_mask is None:
  lowerCamelCase__  =     tf.cast(tf.math.not_equal(lowercase__				,     config.pad_token_id)				,     tf.inta)
 if decoder_attention_mask is None:
  lowerCamelCase__  =     tf.concat(
      [
          tf.ones(decoder_input_ids[:, :1].shape				,     dtype=tf.inta),
          tf.cast(tf.math.not_equal(decoder_input_ids[:, 1:]				,     config.pad_token_id)				,     tf.inta),
      ]				,     axis=-1				,     )
 if head_mask is None:
  lowerCamelCase__  =     tf.ones((config.encoder_layers, config.encoder_attention_heads))
 if decoder_head_mask is None:
  lowerCamelCase__  =     tf.ones((config.decoder_layers, config.decoder_attention_heads))
 if cross_attn_head_mask is None:
  lowerCamelCase__  =     tf.ones((config.decoder_layers, config.decoder_attention_heads))
 return {
     "input_ids": input_ids,
     "decoder_input_ids": decoder_input_ids,
     "attention_mask": attention_mask,
     "decoder_attention_mask": decoder_attention_mask,
     "head_mask": head_mask,
     "decoder_head_mask": decoder_head_mask,
     "cross_attn_head_mask": cross_attn_head_mask,
 }
@require_tf
class 				lowercase       (							_lowerCamelCase ,       _lowerCamelCase ,       unittest.TestCase      ):


    '''simple docstring'''

    lowerCAmelCase__      				=							(
        (TFBlenderbotSmallForConditionalGeneration, TFBlenderbotSmallModel) if is_tf_available() else ()
    )
    lowerCAmelCase__      				=							(TFBlenderbotSmallForConditionalGeneration,) if is_tf_available() else ()
    lowerCAmelCase__      				=							(
        {
            "conversational": TFBlenderbotSmallForConditionalGeneration,
            "feature-extraction": TFBlenderbotSmallModel,
            "summarization": TFBlenderbotSmallForConditionalGeneration,
            "text2text-generation": TFBlenderbotSmallForConditionalGeneration,
            "translation": TFBlenderbotSmallForConditionalGeneration,
        }
        if is_tf_available()
        else {}
    )
    lowerCAmelCase__      				=							True
    lowerCAmelCase__      				=							False
    lowerCAmelCase__      				=							False

    def    a__				(					self     :     List[Any]     )							->							Optional[Any]:

     '''simple docstring'''




     lowerCamelCase__  =     TFBlenderbotSmallModelTester(self     )
     lowerCamelCase__  =     ConfigTester(self				,     config_class=__lowerCamelCase     )

    def    a__				(					self     :     Any     )							->							Tuple:

     '''simple docstring'''




     self.config_tester.run_common_tests()




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

     '''simple docstring'''




     lowerCamelCase__  =     self.model_tester.prepare_config_and_inputs_for_common()
     self.model_tester.check_decoder_model_past_large_inputs(*__lowerCamelCase     )
@require_tokenizers
@require_tf
class 				lowercase       (							unittest.TestCase      ):


    '''simple docstring'''

    lowerCAmelCase__      				=							[
        "Social anxiety\nWow, I am never shy. Do you have anxiety?\nYes. I end up sweating and blushing and feel like "
        "  i'm going to throw up.\nand why is that?"
    ]
    lowerCAmelCase__      				=							"facebook/blenderbot_small-90M"

    @cached_property
    def    a__				(					self     :     Optional[Any]     )							->							Tuple:

     '''simple docstring'''




     return BlenderbotSmallTokenizer.from_pretrained("facebook/blenderbot-90M"     )

    @cached_property
    def    a__				(					self     :     int     )							->							int:

     '''simple docstring'''




     lowerCamelCase__  =     TFAutoModelForSeqaSeqLM.from_pretrained(self.model_name     )
     return model




    @slow
    def    a__				(					self     :     Any     )							->							Union[str, Any]:

     '''simple docstring'''




     lowerCamelCase__  =     self.tokenizer(self.src_text				,     return_tensors="tf"     )
     lowerCamelCase__  =     self.model.generate(
         model_inputs.input_ids				,     attention_mask=model_inputs.attention_mask				,     num_beams=2				,     use_cache=__lowerCamelCase				,     )
     lowerCamelCase__  =     self.tokenizer.batch_decode(generated_ids.numpy()				,     skip_special_tokens=__lowerCamelCase     )[0]
     assert generated_words in (
         "i don't know. i just feel like i'm going to throw up. it's not fun.",
         "i'm not sure. i just feel like i've been feeling like i have to be in a certain place",
         "i'm not sure. i just feel like i've been in a bad situation.",
     )

