



'''simple docstring'''






import unittest

import numpy as np
import timeout_decorator  # noqa

from transformers import BlenderbotSmallConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

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


if is_flax_available():
     import os

     # The slow tests are often failing with OOM error on GPU
     # This makes JAX allocate exactly what is needed on demand, and deallocate memory that is no longer needed
     # but will be slower as stated here https://jax.readthedocs.io/en/latest/gpu_memory_allocation.html
     lowerCAmelCase:      Dict		 =		'platform'

     import jax
     import jax.numpy as jnp

     from transformers.models.blenderbot_small.modeling_flax_blenderbot_small import (
         FlaxBlenderbotSmallForConditionalGeneration,
         FlaxBlenderbotSmallModel,
         shift_tokens_right,
     )
def    lowerCamelCase__ (		_A				,    _A				,    _A=None				,    _A=None				,    _A=None				,    _A=None				,    _A=None				,    _A=None				,    ):
  if attention_mask is None:
    a		:      Tuple       =  np.where(input_ids != config.pad_token_id				,    1				,    0       )
  if decoder_attention_mask is None:
    a		:      Dict       =  np.where(decoder_input_ids != config.pad_token_id				,    1				,    0       )
  if head_mask is None:
    a		:      Optional[Any]       =  np.ones((config.encoder_layers, config.encoder_attention_heads)       )
  if decoder_head_mask is None:
    a		:      Optional[Any]       =  np.ones((config.decoder_layers, config.decoder_attention_heads)       )
  if cross_attn_head_mask is None:
    a		:      int       =  np.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": attention_mask,
  }

class 							a__:







    def __init__(   self				:						List[str]		,    __snake_case				:						Optional[Any]		,    __snake_case				:						Optional[int]=13		,    __snake_case				:						Dict=7		,    __snake_case				:						Union[str, Any]=True		,    __snake_case				:						Optional[int]=False		,    __snake_case				:						int=99		,    __snake_case				:						Optional[Any]=16		,    __snake_case				:						List[str]=2		,    __snake_case				:						Union[str, Any]=4		,    __snake_case				:						Optional[int]=4		,    __snake_case				:						Optional[Any]="gelu"		,    __snake_case				:						int=0.1		,    __snake_case				:						Dict=0.1		,    __snake_case				:						Union[str, Any]=32		,    __snake_case				:						List[Any]=2		,    __snake_case				:						Union[str, Any]=1		,    __snake_case				:						int=0		,    __snake_case				:						Optional[int]=0.02		,    ):
      a		:      List[Any]       =  parent
      a		:      Union[str, Any]       =  batch_size
      a		:      Optional[int]       =  seq_length
      a		:      Dict       =  is_training
      a		:      Union[str, Any]       =  use_labels
      a		:      Optional[Any]       =  vocab_size
      a		:      List[str]       =  hidden_size
      a		:      Union[str, Any]       =  num_hidden_layers
      a		:      Union[str, Any]       =  num_attention_heads
      a		:      Any       =  intermediate_size
      a		:      Dict       =  hidden_act
      a		:      Any       =  hidden_dropout_prob
      a		:      Union[str, Any]       =  attention_probs_dropout_prob
      a		:      List[Any]       =  max_position_embeddings
      a		:      Optional[int]       =  eos_token_id
      a		:      Any       =  pad_token_id
      a		:      Optional[int]       =  bos_token_id
      a		:      List[Any]       =  initializer_range







    def     lowercase_ (   self				:						Union[str, Any]			):
      a		:      Tuple       =  np.clip(ids_tensor([self.batch_size, self.seq_length - 1]		,    self.vocab_size			)		,    3		,    self.vocab_size			)
      a		:      Tuple       =  np.concatenate((input_ids, 2 * np.ones((self.batch_size, 1)		,    dtype=np.intaa			))		,    -1			)

      a		:      Any       =  shift_tokens_right(__snake_case		,    1		,    2			)

      a		:      List[str]       =  BlenderbotSmallConfig(
          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_id=self.eos_token_id		,    bos_token_id=self.bos_token_id		,    pad_token_id=self.pad_token_id		,    initializer_range=self.initializer_range		,    use_cache=__snake_case		,    )
      a		:      str       =  prepare_blenderbot_inputs_dict(__snake_case		,    __snake_case		,    __snake_case			)
      return config, inputs_dict







    def     lowercase_ (   self				:						Any			):
      a     ,			a		:      Union[str, Any]       =  self.prepare_config_and_inputs()
      return config, inputs_dict







    def     lowercase_ (   self				:						Tuple		,    __snake_case				:						int		,    __snake_case				:						Optional[Any]		,    __snake_case				:						int			):
      a		:      Optional[int]       =  20
      a		:      str       =  model_class_name(__snake_case			)

      a		:      Tuple       =  model.encode(inputs_dict['input_ids']			)

      a     ,			a		:      List[str]       =  (
          inputs_dict['decoder_input_ids'],
          inputs_dict['decoder_attention_mask'],
      )

      a		:      str       =  model.init_cache(decoder_input_ids.shape[0]		,    __snake_case		,    __snake_case			)
      a		:      Optional[int]       =  jnp.ones((decoder_input_ids.shape[0], max_decoder_length)		,    dtype='i4'			)

      a		:      Union[str, Any]       =  jnp.broadcast_to(
          jnp.arange(decoder_input_ids.shape[-1] - 1			)[None, :]		,    (decoder_input_ids.shape[0], decoder_input_ids.shape[-1] - 1)		,    )
      a		:      Any       =  model.decode(
          decoder_input_ids[:, :-1]		,    __snake_case		,    decoder_attention_mask=__snake_case		,    past_key_values=__snake_case		,    decoder_position_ids=__snake_case		,    )

      a		:      str       =  jnp.array(decoder_input_ids.shape[0] * [[decoder_input_ids.shape[-1] - 1]]		,    dtype='i4'			)
      a		:      int       =  model.decode(
          decoder_input_ids[:, -1:]		,    __snake_case		,    decoder_attention_mask=__snake_case		,    past_key_values=outputs_cache.past_key_values		,    decoder_position_ids=__snake_case		,    )

      a		:      str       =  model.decode(__snake_case		,    __snake_case			)

      a		:      Union[str, Any]       =  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     lowercase_ (   self				:						Tuple		,    __snake_case				:						Optional[Any]		,    __snake_case				:						Optional[Any]		,    __snake_case				:						List[str]			):
      a		:      Dict       =  20
      a		:      Any       =  model_class_name(__snake_case			)

      a		:      Any       =  model.encode(inputs_dict['input_ids']			)

      a     ,			a		:      Any       =  (
          inputs_dict['decoder_input_ids'],
          inputs_dict['decoder_attention_mask'],
      )

      a		:      Tuple       =  jnp.concatenate(
          [
              decoder_attention_mask,
              jnp.zeros((decoder_attention_mask.shape[0], max_decoder_length - decoder_attention_mask.shape[1])			),
          ]		,    axis=-1		,    )

      a		:      List[str]       =  model.init_cache(decoder_input_ids.shape[0]		,    __snake_case		,    __snake_case			)
      a		:      Any       =  jnp.broadcast_to(
          jnp.arange(decoder_input_ids.shape[-1] - 1			)[None, :]		,    (decoder_input_ids.shape[0], decoder_input_ids.shape[-1] - 1)		,    )

      a		:      str       =  model.decode(
          decoder_input_ids[:, :-1]		,    __snake_case		,    decoder_attention_mask=__snake_case		,    past_key_values=__snake_case		,    decoder_position_ids=__snake_case		,    )
      a		:      Dict       =  jnp.array(decoder_input_ids.shape[0] * [[decoder_input_ids.shape[-1] - 1]]		,    dtype='i4'			)
      a		:      Optional[Any]       =  model.decode(
          decoder_input_ids[:, -1:]		,    __snake_case		,    past_key_values=outputs_cache.past_key_values		,    decoder_attention_mask=__snake_case		,    decoder_position_ids=__snake_case		,    )

      a		:      Dict       =  model.decode(__snake_case		,    __snake_case		,    decoder_attention_mask=__snake_case			)

      a		:      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__(      unittest.TestCase			):
    lowercase__				=					99







    def     lowercase_ (   self				:						int			):
      a		:      List[str]       =  np.array(
          [
              [71, 82, 18, 33, 46, 91, 2],
              [68, 34, 26, 58, 30, 82, 2],
              [5, 97, 17, 39, 94, 40, 2],
              [76, 83, 94, 25, 70, 78, 2],
              [87, 59, 41, 35, 48, 66, 2],
              [55, 13, 16, 58, 5, 2, 1],  # note padding
              [64, 27, 31, 51, 12, 75, 2],
              [52, 64, 86, 17, 83, 39, 2],
              [48, 61, 9, 24, 71, 82, 2],
              [26, 1, 60, 48, 22, 13, 2],
              [21, 5, 62, 28, 14, 76, 2],
              [45, 98, 37, 86, 59, 48, 2],
              [70, 70, 50, 9, 28, 0, 2],
          ]		,    dtype=np.intaa		,    )

      a		:      List[Any]       =  input_ids.shape[0]
      a		:      Optional[Any]       =  BlenderbotSmallConfig(
          vocab_size=self.vocab_size		,    d_model=24		,    encoder_layers=2		,    decoder_layers=2		,    encoder_attention_heads=2		,    decoder_attention_heads=2		,    encoder_ffn_dim=32		,    decoder_ffn_dim=32		,    max_position_embeddings=48		,    eos_token_id=2		,    pad_token_id=1		,    bos_token_id=0		,    )
      return config, input_ids, batch_size







    def     lowercase_ (   self				:						Optional[Any]			):
      a     ,			a     ,			a		:      List[str]       =  self._get_config_and_data()
      a		:      Optional[int]       =  FlaxBlenderbotSmallForConditionalGeneration(__snake_case			)
      a		:      int       =  lm_model(input_ids=__snake_case			)
      a		:      Any       =  (batch_size, input_ids.shape[1], config.vocab_size)
      self.assertEqual(outputs['logits'].shape		,    __snake_case			)







    def     lowercase_ (   self				:						List[str]			):
      a		:      int       =  BlenderbotSmallConfig(
          vocab_size=self.vocab_size		,    d_model=14		,    encoder_layers=2		,    decoder_layers=2		,    encoder_attention_heads=2		,    decoder_attention_heads=2		,    encoder_ffn_dim=8		,    decoder_ffn_dim=8		,    max_position_embeddings=48		,    )
      a		:      int       =  FlaxBlenderbotSmallForConditionalGeneration(__snake_case			)
      a		:      Optional[Any]       =  np.array([[71, 82, 18, 33, 46, 91, 2], [68, 34, 26, 58, 30, 2, 1]]		,    dtype=np.intaa			)
      a		:      int       =  np.array([[82, 71, 82, 18, 2], [58, 68, 2, 1, 1]]		,    dtype=np.intaa			)
      a		:      Union[str, Any]       =  lm_model(input_ids=__snake_case		,    decoder_input_ids=__snake_case			)
      a		:      Tuple       =  (*summary.shape, config.vocab_size)
      self.assertEqual(outputs['logits'].shape		,    __snake_case			)







    def     lowercase_ (   self				:						List[str]			):
      a		:      int       =  np.array([[71, 82, 18, 33, 2, 1, 1], [68, 34, 26, 58, 30, 82, 2]]		,    dtype=np.intaa			)
      a		:      str       =  shift_tokens_right(__snake_case		,    1		,    2			)
      a		:      Tuple       =  np.equal(__snake_case		,    1			).astype(np.floataa			).sum()
      a		:      Optional[Any]       =  np.equal(__snake_case		,    1			).astype(np.floataa			).sum()
      self.assertEqual(shifted.shape		,    input_ids.shape			)
      self.assertEqual(__snake_case		,    n_pad_before - 1			)
      self.assertTrue(np.equal(shifted[:, 0]		,    2			).all()			)

@require_flax
class 							a__(      lowerCamelCase__	,				unittest.TestCase	,				lowerCamelCase__			):
    lowercase__				=					True
    lowercase__				=					(
        (
            FlaxBlenderbotSmallModel,
            FlaxBlenderbotSmallForConditionalGeneration,
        )
        if is_flax_available()
        else ()
    )
    lowercase__				=					(FlaxBlenderbotSmallForConditionalGeneration,) if is_flax_available() else ()







    def     lowercase_ (   self				:						Union[str, Any]			):
      a		:      List[Any]       =  FlaxBlenderbotSmallModelTester(self			)







    def     lowercase_ (   self				:						Tuple			):
      a     ,			a		:      Dict       =  self.model_tester.prepare_config_and_inputs()
      for model_class in self.all_model_classes:
        self.model_tester.check_use_cache_forward(__snake_case		,    __snake_case		,    __snake_case			)







    def     lowercase_ (   self				:						Optional[Any]			):
      a     ,			a		:      Union[str, Any]       =  self.model_tester.prepare_config_and_inputs()
      for model_class in self.all_model_classes:
        self.model_tester.check_use_cache_forward_with_attn_mask(__snake_case		,    __snake_case		,    __snake_case			)







    def     lowercase_ (   self				:						Dict			):
      a     ,			a		:      List[str]       =  self.model_tester.prepare_config_and_inputs_for_common()

      for model_class in self.all_model_classes:
        with self.subTest(model_class.__name__			):
          a		:      List[str]       =  self._prepare_for_class(__snake_case		,    __snake_case			)
          a		:      Optional[int]       =  model_class(__snake_case			)

          @jax.jit
          def encode_jitted(__snake_case				:						Dict		,    __snake_case				:						Tuple=None		,    **__snake_case				:						Optional[Any]			):
            return model.encode(input_ids=__snake_case		,    attention_mask=__snake_case			)

          with self.subTest('JIT Enabled'			):
            a		:      int       =  encode_jitted(**__snake_case			).to_tuple()

          with self.subTest('JIT Disabled'			):
            with jax.disable_jit():
              a		:      List[str]       =  encode_jitted(**__snake_case			).to_tuple()

          self.assertEqual(len(__snake_case			)		,    len(__snake_case			)			)
          for jitted_output, output in zip(__snake_case		,    __snake_case			):
            self.assertEqual(jitted_output.shape		,    output.shape			)







    def     lowercase_ (   self				:						List[Any]			):
      a     ,			a		:      Any       =  self.model_tester.prepare_config_and_inputs_for_common()

      for model_class in self.all_model_classes:
        with self.subTest(model_class.__name__			):
          a		:      Union[str, Any]       =  model_class(__snake_case			)
          a		:      Union[str, Any]       =  model.encode(inputs_dict['input_ids']		,    inputs_dict['attention_mask']			)

          a		:      str       =  {
              'decoder_input_ids': inputs_dict['decoder_input_ids'],
              'decoder_attention_mask': inputs_dict['decoder_attention_mask'],
              'encoder_outputs': encoder_outputs,
          }

          @jax.jit
          def decode_jitted(__snake_case				:						Any		,    __snake_case				:						Union[str, Any]		,    __snake_case				:						Optional[int]			):
            return model.decode(
                decoder_input_ids=__snake_case		,    decoder_attention_mask=__snake_case		,    encoder_outputs=__snake_case		,    )

          with self.subTest('JIT Enabled'			):
            a		:      str       =  decode_jitted(**__snake_case			).to_tuple()

          with self.subTest('JIT Disabled'			):
            with jax.disable_jit():
              a		:      List[str]       =  decode_jitted(**__snake_case			).to_tuple()

          self.assertEqual(len(__snake_case			)		,    len(__snake_case			)			)
          for jitted_output, output in zip(__snake_case		,    __snake_case			):
            self.assertEqual(jitted_output.shape		,    output.shape			)







    @slow
    def     lowercase_ (   self				:						Tuple			):
      for model_class_name in self.all_model_classes:
        a		:      Dict       =  model_class_name.from_pretrained('facebook/blenderbot_small-90M'			)
        # FlaxBlenderbotForSequenceClassification expects eos token in input_ids
        a		:      int       =  np.ones((1, 1)			) * model.config.eos_token_id
        a		:      List[str]       =  model(__snake_case			)
        self.assertIsNotNone(__snake_case			)




'''simple docstring'''






import gc
import unittest

import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    StableDiffusionAttendAndExcitePipeline,
    UNetaDConditionModel,
)
from diffusers.utils import load_numpy, skip_mps, slow
from diffusers.utils.testing_utils import require_torch_gpu

from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS
from ..test_pipelines_common import PipelineKarrasSchedulerTesterMixin, PipelineLatentTesterMixin, PipelineTesterMixin


lowerCAmelCase:      Any		 =		False

@skip_mps
class 							a__(      lowerCamelCase__	,				lowerCamelCase__	,				lowerCamelCase__	,				unittest.TestCase			):
    lowercase__				=					StableDiffusionAttendAndExcitePipeline
    lowercase__				=					False
    lowercase__				=					TEXT_TO_IMAGE_PARAMS
    lowercase__				=					TEXT_TO_IMAGE_BATCH_PARAMS.union({"""token_indices"""}			)
    lowercase__				=					TEXT_TO_IMAGE_IMAGE_PARAMS
    lowercase__				=					TEXT_TO_IMAGE_IMAGE_PARAMS







    @classmethod
    def     lowercase_ (   cls				:						Union[str, Any]			):
      super().setUpClass()
      torch.use_deterministic_algorithms(__snake_case			)







    @classmethod
    def     lowercase_ (   cls				:						Optional[Any]			):
      super().tearDownClass()
      torch.use_deterministic_algorithms(__snake_case			)







    def     lowercase_ (   self				:						List[Any]			):
      torch.manual_seed(0			)
      a		:      List[Any]       =  UNetaDConditionModel(
          block_out_channels=(32, 64)		,    layers_per_block=1		,    sample_size=32		,    in_channels=4		,    out_channels=4		,    down_block_types=('DownBlock2D', 'CrossAttnDownBlock2D')		,    up_block_types=('CrossAttnUpBlock2D', 'UpBlock2D')		,    cross_attention_dim=32		,    attention_head_dim=(2, 4)		,    use_linear_projection=__snake_case		,    )
      a		:      Optional[int]       =  DDIMScheduler(
          beta_start=0.00085		,    beta_end=0.012		,    beta_schedule='scaled_linear'		,    clip_sample=__snake_case		,    set_alpha_to_one=__snake_case		,    )
      torch.manual_seed(0			)
      a		:      str       =  AutoencoderKL(
          block_out_channels=[32, 64]		,    in_channels=3		,    out_channels=3		,    down_block_types=['DownEncoderBlock2D', 'DownEncoderBlock2D']		,    up_block_types=['UpDecoderBlock2D', 'UpDecoderBlock2D']		,    latent_channels=4		,    sample_size=1_28		,    )
      torch.manual_seed(0			)
      a		:      str       =  CLIPTextConfig(
          bos_token_id=0		,    eos_token_id=2		,    hidden_size=32		,    intermediate_size=37		,    layer_norm_eps=1e-0_5		,    num_attention_heads=4		,    num_hidden_layers=5		,    pad_token_id=1		,    vocab_size=10_00		,    hidden_act='gelu'		,    projection_dim=5_12		,    )
      a		:      Any       =  CLIPTextModel(__snake_case			)
      a		:      Tuple       =  CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip'			)

      a		:      List[str]       =  {
          'unet': unet,
          'scheduler': scheduler,
          'vae': vae,
          'text_encoder': text_encoder,
          'tokenizer': tokenizer,
          'safety_checker': None,
          'feature_extractor': None,
      }

      return components







    def     lowercase_ (   self				:						str		,    __snake_case				:						Tuple		,    __snake_case				:						Optional[int]=0			):
      if str(__snake_case			).startswith('mps'			):
        a		:      Any       =  torch.manual_seed(__snake_case			)
      else:
        a		:      Any       =  torch.Generator(device=__snake_case			).manual_seed(__snake_case			)
      a		:      int       =  {
          'prompt': 'a cat and a frog',
          'token_indices': [2, 5],
          'generator': generator,
          'num_inference_steps': 1,
          'guidance_scale': 6.0,
          'output_type': 'numpy',
          'max_iter_to_alter': 2,
          'thresholds': {0: 0.7},
      }
      return inputs







    def     lowercase_ (   self				:						List[Any]			):
      a		:      Union[str, Any]       =  'cpu'

      a		:      Any       =  self.get_dummy_components()
      a		:      List[str]       =  self.pipeline_class(**__snake_case			)
      pipe.to(__snake_case			)
      pipe.set_progress_bar_config(disable=__snake_case			)

      a		:      Any       =  self.get_dummy_inputs(__snake_case			)
      a		:      int       =  pipe(**__snake_case			).images
      a		:      int       =  image[0, -3:, -3:, -1]

      self.assertEqual(image.shape		,    (1, 64, 64, 3)			)
      a		:      str       =  np.array(
          [0.63905364, 0.62897307, 0.48599017, 0.5133624, 0.5550048, 0.45769516, 0.50326973, 0.5023139, 0.45384496]			)
      a		:      int       =  np.abs(image_slice.flatten() - expected_slice			).max()
      self.assertLessEqual(__snake_case		,    1e-3			)







    def     lowercase_ (   self				:						Dict			):
      super().test_cpu_offload_forward_pass(expected_max_diff=5e-4			)







    def     lowercase_ (   self				:						Tuple			):
      # NOTE: Larger batch sizes cause this test to timeout, only test on smaller batches
      self._test_inference_batch_consistent(batch_sizes=[1, 2]			)







    def     lowercase_ (   self				:						Union[str, Any]			):
      self._test_inference_batch_single_identical(batch_size=2		,    expected_max_diff=7e-4			)







    def     lowercase_ (   self				:						Tuple			):
      super().test_dict_tuple_outputs_equivalent(expected_max_difference=3e-3			)







    def     lowercase_ (   self				:						str			):
      super().test_pt_np_pil_outputs_equivalent(expected_max_diff=5e-4			)







    def     lowercase_ (   self				:						Any			):
      super().test_save_load_local(expected_max_difference=5e-4			)







    def     lowercase_ (   self				:						List[Any]			):
      super().test_save_load_optional_components(expected_max_difference=4e-4			)

@require_torch_gpu
@slow
class 							a__(      unittest.TestCase			):







    @classmethod
    def     lowercase_ (   cls				:						Union[str, Any]			):
      super().setUpClass()
      torch.use_deterministic_algorithms(__snake_case			)







    @classmethod
    def     lowercase_ (   cls				:						Union[str, Any]			):
      super().tearDownClass()
      torch.use_deterministic_algorithms(__snake_case			)







    def     lowercase_ (   self				:						Union[str, Any]			):
      super().tearDown()
      gc.collect()
      torch.cuda.empty_cache()







    def     lowercase_ (   self				:						Optional[Any]			):
      a		:      List[Any]       =  torch.manual_seed(51			)

      a		:      Dict       =  StableDiffusionAttendAndExcitePipeline.from_pretrained(
          'CompVis/stable-diffusion-v1-4'		,    safety_checker=__snake_case		,    torch_dtype=torch.floataa			)
      pipe.to('cuda'			)

      a		:      Optional[Any]       =  'a painting of an elephant with glasses'
      a		:      Any       =  [5, 7]

      a		:      Tuple       =  pipe(
          prompt=__snake_case		,    token_indices=__snake_case		,    guidance_scale=7.5		,    generator=__snake_case		,    num_inference_steps=5		,    max_iter_to_alter=5		,    output_type='numpy'		,    ).images[0]

      a		:      str       =  load_numpy(
          'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/attend-and-excite/elephant_glasses.npy'			)
      assert np.abs((expected_image - image).max()			) < 5e-1