


import gc
import random
import unittest

import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast

from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky.text_encoder import MCLIPConfig, MultilingualCLIP
from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference


enable_full_determinism()






class _lowerCamelCase(		a_,					unittest.TestCase  ):
       lowercase_					:      Optional[Any]       					=     KandinskyInpaintPipeline
       lowercase_					:      List[str]       					=     ["""prompt""", """image_embeds""", """negative_image_embeds""", """image""", """mask_image"""]
       lowercase_					:      Optional[Any]       					=     [
           """prompt""",
           """negative_prompt""",
           """image_embeds""",
           """negative_image_embeds""",
           """image""",
           """mask_image""",
       ]
       lowercase_					:      List[str]       					=     [
           """generator""",
           """height""",
           """width""",
           """latents""",
           """guidance_scale""",
           """negative_prompt""",
           """num_inference_steps""",
           """return_dict""",
           """guidance_scale""",
           """num_images_per_prompt""",
           """output_type""",
           """return_dict""",
       ]
       lowercase_					:      Optional[Any]       					=     False
       @property
       def      UpperCamelCase	(   self)			->  Union[str, Any]:




           """simple docstring"""

           return 32
       @property
       def      UpperCamelCase	(   self)			->  List[Any]:




           """simple docstring"""

           return 32
       @property
       def      UpperCamelCase	(   self)			->  Any:




           """simple docstring"""

           return self.time_input_dim
       @property
       def      UpperCamelCase	(   self)			->  Tuple:




           """simple docstring"""

           return self.time_input_dim * 4
       @property
       def      UpperCamelCase	(   self)			->  Tuple:




           """simple docstring"""

           return 1_00
       @property
       def      UpperCamelCase	(   self)			->  str:




           """simple docstring"""

           _lowercase			:				List[str] 						=						XLMRobertaTokenizerFast.from_pretrained('YiYiXu/tiny-random-mclip-base')
           return tokenizer
       @property
       def      UpperCamelCase	(   self)			->  List[Any]:




           """simple docstring"""

           torch.manual_seed(0)
           _lowercase			:				List[str] 						=						MCLIPConfig(
               numDims=self.cross_attention_dim, transformerDimensions=self.text_embedder_hidden_size, hidden_size=self.text_embedder_hidden_size, intermediate_size=37, num_attention_heads=4, num_hidden_layers=5, vocab_size=10_05, )

           _lowercase			:				str 						=						MultilingualCLIP(UpperCamelCase_)
           _lowercase			:				Dict 						=						text_encoder.eval()

           return text_encoder
       @property
       def      UpperCamelCase	(   self)			->  str:




           """simple docstring"""

           torch.manual_seed(0)

           _lowercase			:				Union[str, Any] 						=						{
               'in_channels': 9,
               # Out channels is double in channels because predicts mean and variance
               'out_channels': 8,
               'addition_embed_type': 'text_image',
               'down_block_types': ('ResnetDownsampleBlock2D', 'SimpleCrossAttnDownBlock2D'),
               'up_block_types': ('SimpleCrossAttnUpBlock2D', 'ResnetUpsampleBlock2D'),
               'mid_block_type': 'UNetMidBlock2DSimpleCrossAttn',
               'block_out_channels': (self.block_out_channels_a, self.block_out_channels_a * 2),
               'layers_per_block': 1,
               'encoder_hid_dim': self.text_embedder_hidden_size,
               'encoder_hid_dim_type': 'text_image_proj',
               'cross_attention_dim': self.cross_attention_dim,
               'attention_head_dim': 4,
               'resnet_time_scale_shift': 'scale_shift',
               'class_embed_type': None,
           }

           _lowercase			:				Optional[int] 						=						UNetaDConditionModel(**UpperCamelCase_)
           return model
       @property
       def      UpperCamelCase	(   self)			->  List[str]:




           """simple docstring"""

           return {
               "block_out_channels": [32, 64],
               "down_block_types": ["DownEncoderBlock2D", "AttnDownEncoderBlock2D"],
               "in_channels": 3,
               "latent_channels": 4,
               "layers_per_block": 1,
               "norm_num_groups": 8,
               "norm_type": "spatial",
               "num_vq_embeddings": 12,
               "out_channels": 3,
               "up_block_types": [
                   "AttnUpDecoderBlock2D",
                   "UpDecoderBlock2D",
               ],
               "vq_embed_dim": 4,
           }
       @property
       def      UpperCamelCase	(   self)			->  Optional[Any]:




           """simple docstring"""

           torch.manual_seed(0)
           _lowercase			:				Optional[int] 						=						VQModel(**self.dummy_movq_kwargs)
           return model
       def      UpperCamelCase	(   self)			->  Optional[Any]:




           """simple docstring"""

           _lowercase			:				Any 						=						self.dummy_text_encoder
           _lowercase			:				Optional[int] 						=						self.dummy_tokenizer
           _lowercase			:				int 						=						self.dummy_unet
           _lowercase			:				List[str] 						=						self.dummy_movq

           _lowercase			:				Optional[Any] 						=						DDIMScheduler(
               num_train_timesteps=10_00, beta_schedule='linear', beta_start=0.0_0_0_8_5, beta_end=0.0_1_2, clip_sample=UpperCamelCase_, set_alpha_to_one=UpperCamelCase_, steps_offset=1, prediction_type='epsilon', thresholding=UpperCamelCase_, )

           _lowercase			:				int 						=						{
               'text_encoder': text_encoder,
               'tokenizer': tokenizer,
               'unet': unet,
               'scheduler': scheduler,
               'movq': movq,
           }

           return components
       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase=0)			->  Optional[int]:




           """simple docstring"""

           _lowercase			:				str 						=						floats_tensor((1, self.cross_attention_dim), rng=random.Random(UpperCamelCase_)).to(UpperCamelCase_)
           _lowercase			:				str 						=						floats_tensor((1, self.cross_attention_dim), rng=random.Random(seed + 1)).to(UpperCamelCase_)
           # create init_image
           _lowercase			:				Union[str, Any] 						=						floats_tensor((1, 3, 64, 64), rng=random.Random(UpperCamelCase_)).to(UpperCamelCase_)
           _lowercase			:				int 						=						image.cpu().permute(0, 2, 3, 1)[0]
           _lowercase			:				List[Any] 						=						Image.fromarray(np.uinta(UpperCamelCase_)).convert('RGB').resize((2_56, 2_56))
           # create mask
           _lowercase			:				List[str] 						=						np.ones((64, 64), dtype=np.floataa)
           _lowercase			:				List[Any] 						=						0

           if str(UpperCamelCase_).startswith('mps'):
               _lowercase			:				int 						=						torch.manual_seed(UpperCamelCase_)
           else:
               _lowercase			:				str 						=						torch.Generator(device=UpperCamelCase_).manual_seed(UpperCamelCase_)
           _lowercase			:				Tuple 						=						{
               'prompt': 'horse',
               'image': init_image,
               'mask_image': mask,
               'image_embeds': image_embeds,
               'negative_image_embeds': negative_image_embeds,
               'generator': generator,
               'height': 64,
               'width': 64,
               'num_inference_steps': 2,
               'guidance_scale': 4.0,
               'output_type': 'np',
           }
           return inputs
       def      UpperCamelCase	(   self)			->  Tuple:




           """simple docstring"""

           _lowercase			:				int 						=						'cpu'

           _lowercase			:				Dict 						=						self.get_dummy_components()

           _lowercase			:				List[Any] 						=						self.pipeline_class(**UpperCamelCase_)
           _lowercase			:				Optional[int] 						=						pipe.to(UpperCamelCase_)

           pipe.set_progress_bar_config(disable=UpperCamelCase_)

           _lowercase			:				Optional[int] 						=						pipe(**self.get_dummy_inputs(UpperCamelCase_))
           _lowercase			:				int 						=						output.images

           _lowercase			:				Optional[Any] 						=						pipe(
               **self.get_dummy_inputs(UpperCamelCase_), return_dict=UpperCamelCase_, )[0]

           _lowercase			:				Optional[Any] 						=						image[0, -3:, -3:, -1]
           _lowercase			:				Any 						=						image_from_tuple[0, -3:, -3:, -1]

           print(F'''image.shape {image.shape}''')

           assert image.shape == (1, 64, 64, 3)

           _lowercase			:				List[str] 						=						np.array(
               [0.8_3_2_6_9_1_9, 0.7_3_7_9_0_4_6_7, 0.2_0_9_1_8_5_8_1, 0.9_3_0_9_6_1_2, 0.5_5_1_1_7_9_1, 0.4_3_7_1_3_3_2_8, 0.5_5_1_3_3_2_1, 0.4_9_9_2_2_9_3_4, 0.5_9_4_9_7_7_8_6])

           assert (
               np.abs(image_slice.flatten() - expected_slice).max() < 1E-2
           ), F''' expected_slice {expected_slice}, but got {image_slice.flatten()}'''
           assert (
               np.abs(image_from_tuple_slice.flatten() - expected_slice).max() < 1E-2
           ), F''' expected_slice {expected_slice}, but got {image_from_tuple_slice.flatten()}'''




       def      UpperCamelCase	(   self)			->  List[Any]:




           """simple docstring"""

           super().test_inference_batch_single_identical(expected_max_diff=3E-3)






@slow
@require_torch_gpu
class _lowerCamelCase(		unittest.TestCase  ):
       def      UpperCamelCase	(   self)			->  List[str]:




           """simple docstring"""

           super().tearDown()
           gc.collect()
           torch.cuda.empty_cache()




       def      UpperCamelCase	(   self)			->  Optional[int]:




           """simple docstring"""

           _lowercase			:				int 						=						load_numpy(
               'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
               '/kandinsky/kandinsky_inpaint_cat_with_hat_fp16.npy')

           _lowercase			:				str 						=						load_image(
               'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main' '/kandinsky/cat.png')
           _lowercase			:				Optional[int] 						=						np.ones((7_68, 7_68), dtype=np.floataa)
           _lowercase			:				Tuple 						=						0

           _lowercase			:				int 						=						'a hat'

           _lowercase			:				int 						=						KandinskyPriorPipeline.from_pretrained(
               'kandinsky-community/kandinsky-2-1-prior', torch_dtype=torch.floataa)
           pipe_prior.to(UpperCamelCase_)

           _lowercase			:				Optional[int] 						=						KandinskyInpaintPipeline.from_pretrained(
               'kandinsky-community/kandinsky-2-1-inpaint', torch_dtype=torch.floataa)
           _lowercase			:				List[Any] 						=						pipeline.to(UpperCamelCase_)
           pipeline.set_progress_bar_config(disable=UpperCamelCase_)

           _lowercase			:				List[str] 						=						torch.Generator(device='cpu').manual_seed(0)
           _lowercase						,							_lowercase			:				int 						=						pipe_prior(
               UpperCamelCase_, generator=UpperCamelCase_, num_inference_steps=5, negative_prompt='', ).to_tuple()

           _lowercase			:				Any 						=						pipeline(
               UpperCamelCase_, image=UpperCamelCase_, mask_image=UpperCamelCase_, image_embeds=UpperCamelCase_, negative_image_embeds=UpperCamelCase_, generator=UpperCamelCase_, num_inference_steps=1_00, height=7_68, width=7_68, output_type='np', )

           _lowercase			:				Any 						=						output.images[0]

           assert image.shape == (7_68, 7_68, 3)

           assert_mean_pixel_difference(UpperCamelCase_, UpperCamelCase_)










"""simple docstring"""
from __future__ import annotations

import random
import unittest

from transformers import TransfoXLConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

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 (
     TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
     TFTransfoXLForSequenceClassification,
     TFTransfoXLLMHeadModel,
     TFTransfoXLModel,
 )



class        UpperCamelCase__ :







    """simple docstring"""







    def __init__(		self :	int				,    UpperCamelCase_ :	Union[str, Any]				,    ):





           '''simple docstring'''

           __magic_name__      				=    parent
           __magic_name__      				=    1_3
           __magic_name__      				=    7
           __magic_name__      				=    3_0
           __magic_name__      				=    self.seq_length + self.mem_len
           __magic_name__      				=    1_5
           __magic_name__      				=    True
           __magic_name__      				=    True
           __magic_name__      				=    9_9
           __magic_name__      				=    [1_0, 5_0, 8_0]
           __magic_name__      				=    3_2
           __magic_name__      				=    3_2
           __magic_name__      				=    4
           __magic_name__      				=    8
           __magic_name__      				=    1_2_8
           __magic_name__      				=    2
           __magic_name__      				=    2
           __magic_name__      				=    None
           __magic_name__      				=    1
           __magic_name__      				=    0
           __magic_name__      				=    3
           __magic_name__      				=    self.vocab_size - 1
           __magic_name__      				=    0.01







    def 				a__			(		self :	Dict ):





           '''simple docstring'''

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

           __magic_name__      				=    None
           if self.use_labels:
                  __magic_name__      				=    ids_tensor([self.batch_size, self.seq_length]				,    self.vocab_size )

           __magic_name__      				=    TransfoXLConfig(
               vocab_size=self.vocab_size				,    mem_len=self.mem_len				,    clamp_len=self.clamp_len				,    cutoffs=self.cutoffs				,    d_model=self.hidden_size				,    d_embed=self.d_embed				,    n_head=self.num_attention_heads				,    d_head=self.d_head				,    d_inner=self.d_inner				,    div_val=self.div_val				,    n_layer=self.num_hidden_layers				,    eos_token_id=self.eos_token_id				,    pad_token_id=self.vocab_size - 1				,    init_range=self.init_range				,    num_labels=self.num_labels				,    )

           return (config, input_ids_a, input_ids_a, lm_labels)







    def 				a__			(		self :	Optional[Any] ):





           '''simple docstring'''

           random.seed(self.seed )
           tf.random.set_seed(self.seed )







    def 				a__			(		self :	Dict				,    UpperCamelCase_ :	Optional[int]				,    UpperCamelCase_ :	Optional[Any]				,    UpperCamelCase_ :	int				,    UpperCamelCase_ :	List[Any] ):





           '''simple docstring'''

           __magic_name__      				=    TFTransfoXLModel(UpperCamelCase_ )

           __magic_name__				,  __magic_name__      				=    model(UpperCamelCase_ ).to_tuple()

           __magic_name__      				=    {'input_ids': input_ids_a, 'mems': mems_a}

           __magic_name__				,  __magic_name__      				=    model(UpperCamelCase_ ).to_tuple()

           self.parent.assertEqual(hidden_states_a.shape				,    (self.batch_size, self.seq_length, self.hidden_size) )
           self.parent.assertEqual(hidden_states_a.shape				,    (self.batch_size, self.seq_length, self.hidden_size) )
           self.parent.assertListEqual(
               [mem.shape for mem in mems_a]				,    [(self.mem_len, self.batch_size, self.hidden_size)] * self.num_hidden_layers				,    )
           self.parent.assertListEqual(
               [mem.shape for mem in mems_a]				,    [(self.mem_len, self.batch_size, self.hidden_size)] * self.num_hidden_layers				,    )







    def 				a__			(		self :	Optional[int]				,    UpperCamelCase_ :	Union[str, Any]				,    UpperCamelCase_ :	Tuple				,    UpperCamelCase_ :	Optional[Any]				,    UpperCamelCase_ :	Tuple ):





           '''simple docstring'''

           __magic_name__      				=    TFTransfoXLLMHeadModel(UpperCamelCase_ )

           __magic_name__				,  __magic_name__      				=    model(UpperCamelCase_ ).to_tuple()

           __magic_name__      				=    {'input_ids': input_ids_a, 'labels': lm_labels}
           __magic_name__				,  __magic_name__      				=    model(UpperCamelCase_ ).to_tuple()

           __magic_name__				,  __magic_name__      				=    model([input_ids_a, mems_a] ).to_tuple()

           __magic_name__      				=    {'input_ids': input_ids_a, 'mems': mems_a, 'labels': lm_labels}

           __magic_name__				,  __magic_name__      				=    model(UpperCamelCase_ ).to_tuple()

           self.parent.assertEqual(lm_logits_a.shape				,    (self.batch_size, self.seq_length, self.vocab_size) )
           self.parent.assertListEqual(
               [mem.shape for mem in mems_a]				,    [(self.mem_len, self.batch_size, self.hidden_size)] * self.num_hidden_layers				,    )

           self.parent.assertEqual(lm_logits_a.shape				,    (self.batch_size, self.seq_length, self.vocab_size) )
           self.parent.assertListEqual(
               [mem.shape for mem in mems_a]				,    [(self.mem_len, self.batch_size, self.hidden_size)] * self.num_hidden_layers				,    )







    def 				a__			(		self :	Union[str, Any]				,    UpperCamelCase_ :	Optional[int]				,    UpperCamelCase_ :	Tuple				,    UpperCamelCase_ :	Tuple				,    UpperCamelCase_ :	Dict ):





           '''simple docstring'''

           __magic_name__      				=    TFTransfoXLForSequenceClassification(UpperCamelCase_ )
           __magic_name__      				=    model(UpperCamelCase_ )
           self.parent.assertEqual(result.logits.shape				,    (self.batch_size, self.num_labels) )







    def 				a__			(		self :	Dict ):





           '''simple docstring'''

           __magic_name__      				=    self.prepare_config_and_inputs()
           ((__magic_name__)				,  (__magic_name__)				,  (__magic_name__)				,  (__magic_name__))      				=    config_and_inputs
           __magic_name__      				=    {'input_ids': input_ids_a}
           return config, inputs_dict



@require_tf
class        UpperCamelCase__ (				a_							,	a_							,	unittest.TestCase):







    """simple docstring"""
    __UpperCAmelCase           = (
        (TFTransfoXLModel, TFTransfoXLLMHeadModel, TFTransfoXLForSequenceClassification) if is_tf_available() else ()
    )
    __UpperCAmelCase           = () if is_tf_available() else ()
    __UpperCAmelCase           = (
        {
            """feature-extraction""": TFTransfoXLModel,
            """text-classification""": TFTransfoXLForSequenceClassification,
            """text-generation""": TFTransfoXLLMHeadModel,
            """zero-shot""": TFTransfoXLForSequenceClassification,
        }
        if is_tf_available()
        else {}
    )
    # TODO: add this test when TFTransfoXLLMHead has a linear output layer implemented
    __UpperCAmelCase           = False
    __UpperCAmelCase           = False
    __UpperCAmelCase           = False
    __UpperCAmelCase           = False







    def 				a__			(		self :	int				,    UpperCamelCase_ :	Dict				,    UpperCamelCase_ :	List[Any]				,    UpperCamelCase_ :	Optional[int]				,    UpperCamelCase_ :	List[str]				,    UpperCamelCase_ :	Tuple ):





           '''simple docstring'''

           if pipeline_test_casse_name == "TextGenerationPipelineTests":
                  # Get `ValueError: AttributeError: 'NoneType' object has no attribute 'new_ones'` or `AssertionError`.
                  # `TransfoXLConfig` was never used in pipeline tests: cannot create a simple
                  # tokenizer.
                  return True

           return False







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





           '''simple docstring'''

           __magic_name__      				=    TFTransfoXLModelTester(self )
           __magic_name__      				=    ConfigTester(self				,    config_class=UpperCamelCase_				,    d_embed=3_7 )







    def 				a__			(		self :	List[str] ):





           '''simple docstring'''

           self.config_tester.run_common_tests()







    def 				a__			(		self :	int ):





           '''simple docstring'''

           self.model_tester.set_seed()
           __magic_name__      				=    self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_transfo_xl_model(*UpperCamelCase_ )







    def 				a__			(		self :	str ):





           '''simple docstring'''

           self.model_tester.set_seed()
           __magic_name__      				=    self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_transfo_xl_lm_head(*UpperCamelCase_ )







    def 				a__			(		self :	Any ):





           '''simple docstring'''

           __magic_name__      				=    self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_transfo_xl_for_sequence_classification(*UpperCamelCase_ )







    def 				a__			(		self :	List[str] ):





           '''simple docstring'''

           __magic_name__				,  __magic_name__      				=    self.model_tester.prepare_config_and_inputs_for_common()
           __magic_name__      				=    [TFTransfoXLForSequenceClassification]

           for model_class in self.all_model_classes:
                  __magic_name__      				=    model_class(UpperCamelCase_ )
                  assert isinstance(model.get_input_embeddings()				,    tf.keras.layers.Layer )
                  if model_class in list_other_models_with_output_ebd:
                         __magic_name__      				=    model.get_output_embeddings()
                         assert isinstance(UpperCamelCase_				,    tf.keras.layers.Layer )
                         __magic_name__      				=    model.get_bias()
                         assert name is None
                  else:
                         __magic_name__      				=    model.get_output_embeddings()
                         assert x is None
                         __magic_name__      				=    model.get_bias()
                         assert name is None







    def 				a__			(		self :	int ):





           '''simple docstring'''

           pass







    @slow
    def 				a__			(		self :	str ):





           '''simple docstring'''

           for model_name in TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                  __magic_name__      				=    TFTransfoXLModel.from_pretrained(UpperCamelCase_ )
                  self.assertIsNotNone(UpperCamelCase_ )







    @unittest.skip(reason='This model doesn\'t play well with fit() due to not returning a single loss.' )
    def 				a__			(		self :	List[str] ):





           '''simple docstring'''

           pass



@require_tf
class        UpperCamelCase__ (				unittest.TestCase):







    """simple docstring"""







    @unittest.skip('Skip test until #12651 is resolved.' )
    @slow
    def 				a__			(		self :	Optional[Any] ):





           '''simple docstring'''

           __magic_name__      				=    TFTransfoXLLMHeadModel.from_pretrained('transfo-xl-wt103' )
           # fmt: off
           __magic_name__      				=    tf.convert_to_tensor([[3_3,1_2_9_7,2,1,1_0_0_9,4,1_1_0_9,1_1_7_3_9,4_7_6_2,3_5_8,5,2_5,2_4_5,2_2,1_7_0_6,1_7,2_0_0_9_8,5,3_2_1_5,2_1,3_7,1_1_1_0,3,1_3,1_0_4_1,4,2_4,6_0_3,4_9_0,2,7_1_4_7_7,2_0_0_9_8,1_0_4_4_4_7,2,2_0_9_6_1,1,2_6_0_4,4,1,3_2_9,3,6_2_2_4,8_3_1,1_6_0_0_2,2,8,6_0_3,7_8_9_6_7,2_9_5_4_6,2_3,8_0_3,2_0,2_5,4_1_6,5,8,2_3_2,4,2_7_7,6,1_8_5_5,4_6_0_1,3,2_9_5_4_6,5_4,8,3_6_0_9,5,5_7_2_1_1,4_9,4,1,2_7_7,1_8,8,1_7_5_5,1_5_6_9_1,3,3_4_1,2_5,4_1_6,6_9_3,4_2_5_7_3,7_1,1_7,4_0_1,9_4,3_1,1_7_9_1_9,2,2_9_5_4_6,7_8_7_3,1_8,1,4_3_5,2_3,1_1_0_1_1,7_5_5,5,5_1_6_7,3,7_9_8_3,9_8,8_4,2,2_9_5_4_6,3_2_6_7,8,3_6_0_9,4,1,4_8_6_5,1_0_7_5,2,6_0_8_7,7_1,6,3_4_6,8,5_8_5_4,3,2_9_5_4_6,8_2_4,1_4_0_0,1_8_6_8,2,1_9,1_6_0,2,3_1_1,8,5_4_9_6,2,2_0_9_2_0,1_7,2_5,1_5_0_9_7,3,2_4,2_4,0]]				,    dtype=tf.intaa )  # noqa: E231
           # fmt: on
           #  In 1991 , the remains of Russian Tsar Nicholas II and his family
           #  ( except for Alexei and Maria ) are discovered .
           #  The voice of Nicholas's young son , Tsarevich Alexei Nikolaevich , narrates the
           #  remainder of the story . 1883 Western Siberia ,
           #  a young Grigori Rasputin is asked by his father and a group of men to perform magic .
           #  Rasputin has a vision and denounces one of the men as a horse thief . Although his
           #  father initially slaps him for making such an accusation , Rasputin watches as the
           #  man is chased outside and beaten . Twenty years later , Rasputin sees a vision of
           #  the Virgin Mary , prompting him to become a priest . Rasputin quickly becomes famous ,
           #  with people , even a bishop , begging for his blessing . <eod> </s> <eos>

           # fmt: off
           __magic_name__      				=    [3_3,1_2_9_7,2,1,1_0_0_9,4,1_1_0_9,1_1_7_3_9,4_7_6_2,3_5_8,5,2_5,2_4_5,2_2,1_7_0_6,1_7,2_0_0_9_8,5,3_2_1_5,2_1,3_7,1_1_1_0,3,1_3,1_0_4_1,4,2_4,6_0_3,4_9_0,2,7_1_4_7_7,2_0_0_9_8,1_0_4_4_4_7,2,2_0_9_6_1,1,2_6_0_4,4,1,3_2_9,3,6_2_2_4,8_3_1,1_6_0_0_2,2,8,6_0_3,7_8_9_6_7,2_9_5_4_6,2_3,8_0_3,2_0,2_5,4_1_6,5,8,2_3_2,4,2_7_7,6,1_8_5_5,4_6_0_1,3,2_9_5_4_6,5_4,8,3_6_0_9,5,5_7_2_1_1,4_9,4,1,2_7_7,1_8,8,1_7_5_5,1_5_6_9_1,3,3_4_1,2_5,4_1_6,6_9_3,4_2_5_7_3,7_1,1_7,4_0_1,9_4,3_1,1_7_9_1_9,2,2_9_5_4_6,7_8_7_3,1_8,1,4_3_5,2_3,1_1_0_1_1,7_5_5,5,5_1_6_7,3,7_9_8_3,9_8,8_4,2,2_9_5_4_6,3_2_6_7,8,3_6_0_9,4,1,4_8_6_5,1_0_7_5,2,6_0_8_7,7_1,6,3_4_6,8,5_8_5_4,3,2_9_5_4_6,8_2_4,1_4_0_0,1_8_6_8,2,1_9,1_6_0,2,3_1_1,8,5_4_9_6,2,2_0_9_2_0,1_7,2_5,1_5_0_9_7,3,2_4,2_4,0,3_3,1,1_8_5_7,2,1,1_0_0_9,4,1_1_0_9,1_1_7_3_9,4_7_6_2,3_5_8,5,2_5,2_4_5,2_8,1_1_1_0,3,1_3,1_0_4_1,4,2_4,6_0_3,4_9_0,2,7_1_4_7_7,2_0_0_9_8,1_0_4_4_4_7,2,2_0_9_6_1,1,2_6_0_4,4,1,3_2_9,3,0]  # noqa: E231
           # fmt: on
           #  In 1991, the remains of Russian Tsar Nicholas II and his family (
           #  except for Alexei and Maria ) are discovered. The voice of young son,
           #  Tsarevich Alexei Nikolaevich, narrates the remainder of the story.
           #  1883 Western Siberia, a young Grigori Rasputin is asked by his father
           #  and a group of men to perform magic. Rasputin has a vision and
           #  denounces one of the men as a horse thief. Although his father initially
           #  slaps him for making such an accusation, Rasputin watches as the man
           #  is chased outside and beaten. Twenty years later, Rasputin sees a vision
           #  of the Virgin Mary, prompting him to become a priest.
           #  Rasputin quickly becomes famous, with people, even a bishop, begging for
           #  his blessing. <unk> <unk> <eos> In the 1990s, the remains of Russian Tsar
           # Nicholas II and his family were discovered. The voice of <unk> young son,
           # Tsarevich Alexei Nikolaevich, narrates the remainder of the story.<eos>

           __magic_name__      				=    model.generate(UpperCamelCase_				,    max_length=2_0_0				,    do_sample=UpperCamelCase_ )
           self.assertListEqual(output_ids[0].numpy().tolist()				,    UpperCamelCase_ )