






import math
from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL
import torch
from transformers import CLIPTextModelWithProjection, CLIPTokenizer

from ...models import PriorTransformer
from ...pipelines import DiffusionPipeline
from ...schedulers import HeunDiscreteScheduler
from ...utils import (
    BaseOutput,
    is_accelerate_available,
    is_accelerate_version,
    logging,
    randn_tensor,
    replace_example_docstring,
)
from .renderer import ShapERenderer


A_	:	Optional[Any]				=				logging.get_logger(__name__)  # pylint: disable=invalid-name

A_	:	str				=				'\n    Examples:\n        ```py\n        >>> import torch\n        >>> from diffusers import DiffusionPipeline\n        >>> from diffusers.utils import export_to_gif\n\n        >>> device = torch.device("cuda" if torch.cuda.is_available() else "cpu")\n\n        >>> repo = "openai/shap-e"\n        >>> pipe = DiffusionPipeline.from_pretrained(repo, torch_dtype=torch.float16)\n        >>> pipe = pipe.to(device)\n\n        >>> guidance_scale = 15.0\n        >>> prompt = "a shark"\n\n        >>> images = pipe(\n        ...     prompt,\n        ...     guidance_scale=guidance_scale,\n        ...     num_inference_steps=64,\n        ...     frame_size=256,\n        ... ).images\n\n        >>> gif_path = export_to_gif(images[0], "shark_3d.gif")\n        ```\n'




@dataclass
class        _lowerCAmelCase( UpperCAmelCase_      ):





       """simple docstring"""







       a       :	Union[List[List[PIL.Image.Image]], List[List[np.ndarray]]]







class        _lowerCAmelCase( UpperCAmelCase_      ):





       """simple docstring"""







       def __init__(      self						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    ):
         super().__init__()

         self.register_modules(
             prior=_lowerCamelCase						,    text_encoder=_lowerCamelCase						,    tokenizer=_lowerCamelCase						,    scheduler=_lowerCamelCase						,    renderer=_lowerCamelCase						,    )





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase							):
         if latents is None:
           UpperCamelCase_:      str					   =       randn_tensor(_lowerCamelCase						,    generator=_lowerCamelCase						,    device=_lowerCamelCase						,    dtype=_lowerCamelCase							)
         else:
           if latents.shape != shape:
             raise ValueError(f'''Unexpected latents shape, got {latents.shape}, expected {shape}'''							)
           UpperCamelCase_:      Tuple					   =       latents.to(_lowerCamelCase							)

         UpperCamelCase_:      List[Any]					   =       latents * scheduler.init_noise_sigma
         return latents





       def     _a					(      self						,    _lowerCamelCase=0							):
         if is_accelerate_available():
           from accelerate import cpu_offload
         else:
           raise ImportError('Please install accelerate via `pip install accelerate`'							)

         UpperCamelCase_:      Any					   =       torch.device(f'''cuda:{gpu_id}'''							)

         UpperCamelCase_:      List[Any]					   =       [self.text_encoder, self.prior]
         for cpu_offloaded_model in models:
           if cpu_offloaded_model is not None:
             cpu_offload(_lowerCamelCase						,    _lowerCamelCase							)





       def     _a					(      self						,    _lowerCamelCase=0							):
         if is_accelerate_available() and is_accelerate_version('>='						,    '0.17.0.dev0'							):
           from accelerate import cpu_offload_with_hook
         else:
           raise ImportError('`enable_model_cpu_offload` requires `accelerate v0.17.0` or higher.'							)

         UpperCamelCase_:      str					   =       torch.device(f'''cuda:{gpu_id}'''							)

         if self.device.type != "cpu":
           self.to('cpu'						,    silence_dtype_warnings=_lowerCamelCase							)
           torch.cuda.empty_cache()  # otherwise we don't see the memory savings (but they probably exist)

         UpperCamelCase_:      int					   =       None
         for cpu_offloaded_model in [self.text_encoder, self.prior, self.renderer]:
           UpperCamelCase_   ,UpperCamelCase_:      Optional[Any]					   =       cpu_offload_with_hook(_lowerCamelCase						,    _lowerCamelCase						,    prev_module_hook=_lowerCamelCase							)

         if self.safety_checker is not None:
           UpperCamelCase_   ,UpperCamelCase_:      Optional[Any]					   =       cpu_offload_with_hook(self.safety_checker						,    _lowerCamelCase						,    prev_module_hook=_lowerCamelCase							)

         # We'll offload the last model manually.
         UpperCamelCase_:      Tuple					   =       hook





       @property
       def     _a					(      self							):
         if self.device != torch.device('meta'							) or not hasattr(self.text_encoder						,    '_hf_hook'							):
           return self.device
         for module in self.text_encoder.modules():
           if (
               hasattr(_lowerCamelCase						,    '_hf_hook'							)
               and hasattr(module._hf_hook						,    'execution_device'							)
               and module._hf_hook.execution_device is not None
           ):
             return torch.device(module._hf_hook.execution_device							)
         return self.device





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    ):
         len(_lowerCamelCase							) if isinstance(_lowerCamelCase						,    _lowerCamelCase							) else 1

         # YiYi Notes: set pad_token_id to be 0, not sure why I can't set in the config file
         UpperCamelCase_:      Optional[Any]					   =       0
         # get prompt text embeddings
         UpperCamelCase_:      Any					   =       self.tokenizer(
             _lowerCamelCase						,    padding='max_length'						,    max_length=self.tokenizer.model_max_length						,    truncation=_lowerCamelCase						,    return_tensors='pt'						,    )
         UpperCamelCase_:      Optional[Any]					   =       text_inputs.input_ids
         UpperCamelCase_:      Dict					   =       self.tokenizer(_lowerCamelCase						,    padding='longest'						,    return_tensors='pt'							).input_ids

         if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(_lowerCamelCase						,    _lowerCamelCase							):
           UpperCamelCase_:      str					   =       self.tokenizer.batch_decode(untruncated_ids[:, self.tokenizer.model_max_length - 1 : -1]							)
           logger.warning(
               'The following part of your input was truncated because CLIP can only handle sequences up to'
               f''' {self.tokenizer.model_max_length} tokens: {removed_text}'''							)

         UpperCamelCase_:      int					   =       self.text_encoder(text_input_ids.to(_lowerCamelCase							)							)
         UpperCamelCase_:      Any					   =       text_encoder_output.text_embeds

         UpperCamelCase_:      Union[str, Any]					   =       prompt_embeds.repeat_interleave(_lowerCamelCase						,    dim=0							)
         # in Shap-E it normalize the prompt_embeds and then later rescale it
         UpperCamelCase_:      List[Any]					   =       prompt_embeds / torch.linalg.norm(_lowerCamelCase						,    dim=-1						,    keepdim=_lowerCamelCase							)

         if do_classifier_free_guidance:
           UpperCamelCase_:      Any					   =       torch.zeros_like(_lowerCamelCase							)

           # For classifier free guidance, we need to do two forward passes.
           # Here we concatenate the unconditional and text embeddings into a single batch
           # to avoid doing two forward passes
           UpperCamelCase_:      Union[str, Any]					   =       torch.cat([negative_prompt_embeds, prompt_embeds]							)

         # Rescale the features to have unit variance
         UpperCamelCase_:      List[str]					   =       math.sqrt(prompt_embeds.shape[1]							) * prompt_embeds

         return prompt_embeds





       @torch.no_grad()
       @replace_example_docstring(_lowerCamelCase							)
       def __call__(      self						,    _lowerCamelCase						,    _lowerCamelCase = 1						,    _lowerCamelCase = 2_5						,    _lowerCamelCase = None						,    _lowerCamelCase = None						,    _lowerCamelCase = 4.0						,    _lowerCamelCase = 6_4						,    _lowerCamelCase = "pil"						,    _lowerCamelCase = True						,    ):

         if isinstance(_lowerCamelCase						,    _lowerCamelCase							):
           UpperCamelCase_:      Any					   =       1
         elif isinstance(_lowerCamelCase						,    _lowerCamelCase							):
           UpperCamelCase_:      int					   =       len(_lowerCamelCase							)
         else:
           raise ValueError(f'''`prompt` has to be of type `str` or `list` but is {type(_lowerCamelCase							)}'''							)

         UpperCamelCase_:      str					   =       self._execution_device

         UpperCamelCase_:      str					   =       batch_size * num_images_per_prompt

         UpperCamelCase_:      List[Any]					   =       guidance_scale > 1.0
         UpperCamelCase_:      int					   =       self._encode_prompt(_lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase							)

         # prior

         self.scheduler.set_timesteps(_lowerCamelCase						,    device=_lowerCamelCase							)
         UpperCamelCase_:      Tuple					   =       self.scheduler.timesteps

         UpperCamelCase_:      Any					   =       self.prior.config.num_embeddings
         UpperCamelCase_:      List[str]					   =       self.prior.config.embedding_dim

         UpperCamelCase_:      Any					   =       self.prepare_latents(
             (batch_size, num_embeddings * embedding_dim)						,    prompt_embeds.dtype						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    self.scheduler						,    )

         # YiYi notes: for testing only to match ldm, we can directly create a latents with desired shape: batch_size, num_embeddings, embedding_dim
         UpperCamelCase_:      Optional[Any]					   =       latents.reshape(latents.shape[0]						,    _lowerCamelCase						,    _lowerCamelCase							)

         for i, t in enumerate(self.progress_bar(_lowerCamelCase							)							):
           # expand the latents if we are doing classifier free guidance
           UpperCamelCase_:      Optional[Any]					   =       torch.cat([latents] * 2							) if do_classifier_free_guidance else latents
           UpperCamelCase_:      Any					   =       self.scheduler.scale_model_input(_lowerCamelCase						,    _lowerCamelCase							)

           UpperCamelCase_:      Tuple					   =       self.prior(
               _lowerCamelCase						,    timestep=_lowerCamelCase						,    proj_embedding=_lowerCamelCase						,    ).predicted_image_embedding

           # remove the variance
           UpperCamelCase_   ,UpperCamelCase_:      Optional[Any]					   =       noise_pred.split(
               scaled_model_input.shape[2]						,    dim=2							)  # batch_size, num_embeddings, embedding_dim

           if do_classifier_free_guidance is not None:
             UpperCamelCase_   ,UpperCamelCase_:      str					   =       noise_pred.chunk(2							)
             UpperCamelCase_:      str					   =       noise_pred_uncond + guidance_scale * (noise_pred - noise_pred_uncond)

           UpperCamelCase_:      Optional[Any]					   =       self.scheduler.step(
               _lowerCamelCase						,    timestep=_lowerCamelCase						,    sample=_lowerCamelCase						,    ).prev_sample

         if output_type == "latent":
           return ShapEPipelineOutput(images=_lowerCamelCase							)

         UpperCamelCase_:      Dict					   =       []
         for i, latent in enumerate(_lowerCamelCase							):
           UpperCamelCase_:      List[str]					   =       self.renderer.decode(
               latent[None, :]						,    _lowerCamelCase						,    size=_lowerCamelCase						,    ray_batch_size=4_0_9_6						,    n_coarse_samples=6_4						,    n_fine_samples=1_2_8						,    )
           images.append(_lowerCamelCase							)

         UpperCamelCase_:      Dict					   =       torch.stack(_lowerCamelCase							)

         if output_type not in ["np", "pil"]:
           raise ValueError(f'''Only the output types `pil` and `np` are supported not output_type={output_type}'''							)

         UpperCamelCase_:      Tuple					   =       images.cpu().numpy()

         if output_type == "pil":
           UpperCamelCase_:      Dict					   =       [self.numpy_to_pil(_lowerCamelCase							) for image in images]

         # Offload last model to CPU
         if hasattr(self						,    'final_offload_hook'							) and self.final_offload_hook is not None:
           self.final_offload_hook.offload()

         if not return_dict:
           return (images,)

         return ShapEPipelineOutput(images=_lowerCamelCase							)







from __future__ import annotations

import unittest

from transformers import CTRLConfig, 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, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
   import tensorflow as tf

   from transformers.models.ctrl.modeling_tf_ctrl import (
       TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
       TFCTRLForSequenceClassification,
       TFCTRLLMHeadModel,
       TFCTRLModel,
   )




class        _lowerCAmelCase( UpperCAmelCase_      ):





       """simple docstring"""







       def __init__(      self						,    _lowerCamelCase						,    ):
         UpperCamelCase_:      Tuple					   =       parent
         UpperCamelCase_:      Optional[Any]					   =       1_3
         UpperCamelCase_:      Any					   =       7
         UpperCamelCase_:      Any					   =       True
         UpperCamelCase_:      List[Any]					   =       True
         UpperCamelCase_:      Dict					   =       True
         UpperCamelCase_:      Optional[Any]					   =       True
         UpperCamelCase_:      Tuple					   =       True
         UpperCamelCase_:      Any					   =       9_9
         UpperCamelCase_:      Dict					   =       3_2
         UpperCamelCase_:      Dict					   =       2
         UpperCamelCase_:      List[Any]					   =       4
         UpperCamelCase_:      int					   =       3_7
         UpperCamelCase_:      List[str]					   =       'gelu'
         UpperCamelCase_:      Union[str, Any]					   =       0.1
         UpperCamelCase_:      int					   =       0.1
         UpperCamelCase_:      int					   =       5_1_2
         UpperCamelCase_:      str					   =       1_6
         UpperCamelCase_:      List[str]					   =       2
         UpperCamelCase_:      Optional[int]					   =       0.0_2
         UpperCamelCase_:      int					   =       3
         UpperCamelCase_:      Tuple					   =       4
         UpperCamelCase_:      List[Any]					   =       None
         UpperCamelCase_:      Union[str, Any]					   =       self.vocab_size - 1





       def     _a					(      self							):
         UpperCamelCase_:      Optional[Any]					   =       ids_tensor([self.batch_size, self.seq_length]						,    self.vocab_size							)

         UpperCamelCase_:      List[str]					   =       None
         if self.use_input_mask:
           UpperCamelCase_:      str					   =       random_attention_mask([self.batch_size, self.seq_length]							)

         UpperCamelCase_:      Optional[Any]					   =       None
         if self.use_token_type_ids:
           UpperCamelCase_:      str					   =       ids_tensor([self.batch_size, self.seq_length]						,    self.type_vocab_size							)

         UpperCamelCase_:      Dict					   =       None
         if self.use_mc_token_ids:
           UpperCamelCase_:      str					   =       ids_tensor([self.batch_size, self.num_choices]						,    self.seq_length							)

         UpperCamelCase_:      Any					   =       None
         UpperCamelCase_:      Any					   =       None
         UpperCamelCase_:      Dict					   =       None
         if self.use_labels:
           UpperCamelCase_:      str					   =       ids_tensor([self.batch_size]						,    self.type_sequence_label_size							)
           UpperCamelCase_:      Dict					   =       ids_tensor([self.batch_size, self.seq_length]						,    self.num_labels							)
           UpperCamelCase_:      Union[str, Any]					   =       ids_tensor([self.batch_size]						,    self.num_choices							)

         UpperCamelCase_:      List[str]					   =       CTRLConfig(
             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						,    pad_token_id=self.pad_token_id						,    )

         UpperCamelCase_:      Tuple					   =       ids_tensor([self.num_hidden_layers, self.num_attention_heads]						,    2							)

         return (
             config,
             input_ids,
             input_mask,
             head_mask,
             token_type_ids,
             mc_token_ids,
             sequence_labels,
             token_labels,
             choice_labels,
         )





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    *_lowerCamelCase							):
         UpperCamelCase_:      Dict					   =       TFCTRLModel(config=_lowerCamelCase							)
         UpperCamelCase_:      int					   =       {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
         UpperCamelCase_:      Optional[int]					   =       model(_lowerCamelCase							)

         UpperCamelCase_:      Optional[int]					   =       [input_ids, None, input_mask]  # None is the input for 'past'
         UpperCamelCase_:      Dict					   =       model(_lowerCamelCase							)

         UpperCamelCase_:      List[str]					   =       model(_lowerCamelCase							)

         self.parent.assertEqual(result.last_hidden_state.shape						,    (self.batch_size, self.seq_length, self.hidden_size)							)





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    *_lowerCamelCase							):
         UpperCamelCase_:      int					   =       TFCTRLLMHeadModel(config=_lowerCamelCase							)
         UpperCamelCase_:      Optional[int]					   =       {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
         UpperCamelCase_:      List[Any]					   =       model(_lowerCamelCase							)
         self.parent.assertEqual(result.logits.shape						,    (self.batch_size, self.seq_length, self.vocab_size)							)





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    *_lowerCamelCase							):
         UpperCamelCase_:      List[str]					   =       self.num_labels
         UpperCamelCase_:      Dict					   =       ids_tensor([self.batch_size]						,    self.type_sequence_label_size							)
         UpperCamelCase_:      List[Any]					   =       {
             'input_ids': input_ids,
             'token_type_ids': token_type_ids,
             'labels': sequence_labels,
         }
         UpperCamelCase_:      List[str]					   =       TFCTRLForSequenceClassification(_lowerCamelCase							)
         UpperCamelCase_:      Tuple					   =       model(_lowerCamelCase							)
         self.parent.assertEqual(result.logits.shape						,    (self.batch_size, self.num_labels)							)





       def     _a					(      self							):
         UpperCamelCase_:      int					   =       self.prepare_config_and_inputs()

         (
             (
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,(
             UpperCamelCase_
         )   ,
         ):      str					   =       config_and_inputs

         UpperCamelCase_:      List[str]					   =       {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
         return config, inputs_dict







@require_tf
class        _lowerCAmelCase( UpperCAmelCase_							,			UpperCAmelCase_							,			unittest.TestCase      ):





       """simple docstring"""







       a       :	Tuple								=(TFCTRLModel, TFCTRLLMHeadModel, TFCTRLForSequenceClassification) if is_tf_available() else ()
       a       :	str								=(TFCTRLLMHeadModel,) if is_tf_available() else ()
       a       :	int								=(
           {
               '''feature-extraction''': TFCTRLModel,
               '''text-classification''': TFCTRLForSequenceClassification,
               '''text-generation''': TFCTRLLMHeadModel,
               '''zero-shot''': TFCTRLForSequenceClassification,
           }
           if is_tf_available()
           else {}
       )
       a       :	Tuple								=False
       a       :	str								=False





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase						,    _lowerCamelCase							):
         if pipeline_test_casse_name == "ZeroShotClassificationPipelineTests":
           # Get `tokenizer does not have a padding token` error for both fast/slow tokenizers.
           # `CTRLConfig` was never used in pipeline tests, either because of a missing checkpoint or because a tiny
           # config could not be created.
           return True

         return False





       def     _a					(      self							):
         UpperCamelCase_:      List[str]					   =       TFCTRLModelTester(self							)
         UpperCamelCase_:      List[Any]					   =       ConfigTester(self						,    config_class=_lowerCamelCase						,    n_embd=3_7							)





       def     _a					(      self							):
         self.config_tester.run_common_tests()





       def     _a					(      self							):
         UpperCamelCase_:      Dict					   =       self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_ctrl_model(*_lowerCamelCase							)





       def     _a					(      self							):
         UpperCamelCase_:      Optional[int]					   =       self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_ctrl_lm_head(*_lowerCamelCase							)





       def     _a					(      self							):
         UpperCamelCase_:      Union[str, Any]					   =       self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_ctrl_for_sequence_classification(*_lowerCamelCase							)





       def     _a					(      self							):
         UpperCamelCase_   ,UpperCamelCase_:      Union[str, Any]					   =       self.model_tester.prepare_config_and_inputs_for_common()
         UpperCamelCase_:      Optional[Any]					   =       [TFCTRLLMHeadModel]
         UpperCamelCase_:      Optional[Any]					   =       [TFCTRLForSequenceClassification]

         for model_class in self.all_model_classes:
           UpperCamelCase_:      Union[str, Any]					   =       model_class(_lowerCamelCase							)
           model.build()  # may be needed for the get_bias() call below
           assert isinstance(model.get_input_embeddings()						,    tf.keras.layers.Layer							)

           if model_class in list_lm_models:
             UpperCamelCase_:      str					   =       model.get_output_embeddings()
             assert isinstance(_lowerCamelCase						,    tf.keras.layers.Layer							)
             UpperCamelCase_:      List[Any]					   =       model.get_bias()
             assert isinstance(_lowerCamelCase						,    _lowerCamelCase							)
             for k, v in name.items():
               assert isinstance(_lowerCamelCase						,    tf.Variable							)
           elif model_class in list_other_models_with_output_ebd:
             UpperCamelCase_:      Any					   =       model.get_output_embeddings()
             assert isinstance(_lowerCamelCase						,    tf.keras.layers.Layer							)
             UpperCamelCase_:      List[Any]					   =       model.get_bias()
             assert name is None
           else:
             UpperCamelCase_:      Dict					   =       model.get_output_embeddings()
             assert x is None
             UpperCamelCase_:      Optional[int]					   =       model.get_bias()
             assert name is None





       @slow
       def     _a					(      self							):
         for model_name in TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
           UpperCamelCase_:      Optional[Any]					   =       TFCTRLModel.from_pretrained(_lowerCamelCase							)
           self.assertIsNotNone(_lowerCamelCase							)







@require_tf
class        _lowerCAmelCase( unittest.TestCase      ):





       """simple docstring"""







       @slow
       def     _a					(      self							):
         UpperCamelCase_:      Optional[int]					   =       TFCTRLLMHeadModel.from_pretrained('ctrl'							)
         UpperCamelCase_:      Any					   =       tf.convert_to_tensor([[1_1_8_5_9, 0, 1_6_1_1, 8]]						,    dtype=tf.intaa							)  # Legal the president is
         UpperCamelCase_:      Dict					   =       [
             1_1_8_5_9,
             0,
             1_6_1_1,
             8,
             5,
             1_5_0,
             2_6_4_4_9,
             2,
             1_9,
             3_4_8,
             4_6_9,
             3,
             2_5_9_5,
             4_8,
             2_0_7_4_0,
             2_4_6_5_3_3,
             2_4_6_5_3_3,
             1_9,
             3_0,
             5,
         ]  # Legal the president is a good guy and I don't want to lose my job. \n \n I have a

         UpperCamelCase_:      List[str]					   =       model.generate(_lowerCamelCase						,    do_sample=_lowerCamelCase							)
         self.assertListEqual(output_ids[0].numpy().tolist()						,    _lowerCamelCase							)