





import inspect
import unittest

from transformers import ConvNextVaConfig
from transformers.models.auto import get_values
from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
		import torch

		from transformers import ConvNextVaBackbone, ConvNextVaForImageClassification, ConvNextVaModel
		from transformers.models.convnextva.modeling_convnextva import CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
		from PIL import Image

		from transformers import AutoImageProcessor






class 						UpperCamelCase_  :



					def __init__(		self     :     Optional[Any]       ,      lowerCamelCase     :     Union[str, Any]       ,      lowerCamelCase     :     str=13       ,      lowerCamelCase     :     Tuple=32       ,      lowerCamelCase     :     Union[str, Any]=3       ,      lowerCamelCase     :     List[Any]=4       ,      lowerCamelCase     :     Tuple=[10, 20, 30, 40]       ,      lowerCamelCase     :     Tuple=[2, 2, 3, 2]       ,      lowerCamelCase     :     Tuple=True       ,      lowerCamelCase     :     Optional[int]=True       ,      lowerCamelCase     :     Union[str, Any]=37       ,      lowerCamelCase     :     Union[str, Any]="gelu"       ,      lowerCamelCase     :     int=10       ,      lowerCamelCase     :     int=0.02       ,      lowerCamelCase     :     Union[str, Any]=["stage2", "stage3", "stage4"]       ,      lowerCamelCase     :     Any=[2, 3, 4]       ,      lowerCamelCase     :     str=None       ,      ):
							lowerCamelCase_	:     List[Any] 						=      parent
							lowerCamelCase_	:     List[Any] 						=      batch_size
							lowerCamelCase_	:     List[str] 						=      image_size
							lowerCamelCase_	:     Dict 						=      num_channels
							lowerCamelCase_	:     Any 						=      num_stages
							lowerCamelCase_	:     Optional[int] 						=      hidden_sizes
							lowerCamelCase_	:     str 						=      depths
							lowerCamelCase_	:     Optional[Any] 						=      is_training
							lowerCamelCase_	:     Union[str, Any] 						=      use_labels
							lowerCamelCase_	:     List[str] 						=      intermediate_size
							lowerCamelCase_	:     List[Any] 						=      hidden_act
							lowerCamelCase_	:     Tuple 						=      num_labels
							lowerCamelCase_	:     Union[str, Any] 						=      initializer_range
							lowerCamelCase_	:     Union[str, Any] 						=      out_features
							lowerCamelCase_	:     List[str] 						=      out_indices
							lowerCamelCase_	:     Optional[Any] 						=      scope



					def   __a     (		self     :     List[str]						):
							lowerCamelCase_	:     Any 						=      floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)

							lowerCamelCase_	:     str 						=      None
							if self.use_labels:
									lowerCamelCase_	:     int 						=      ids_tensor([self.batch_size]       ,      self.num_labels						)

							lowerCamelCase_	:     Dict 						=      self.get_config()

							return config, pixel_values, labels



					def   __a     (		self     :     Optional[int]						):
							return ConvNextVaConfig(
							    num_channels=self.num_channels       ,      hidden_sizes=self.hidden_sizes       ,      depths=self.depths       ,      num_stages=self.num_stages       ,      hidden_act=self.hidden_act       ,      is_decoder=lowerCamelCase       ,      initializer_range=self.initializer_range       ,      out_features=self.out_features       ,      out_indices=self.out_indices       ,      num_labels=self.num_labels       ,      )



					def   __a     (		self     :     str       ,      lowerCamelCase     :     Optional[Any]       ,      lowerCamelCase     :     int       ,      lowerCamelCase     :     Optional[Any]						):
							lowerCamelCase_	:     str 						=      ConvNextVaModel(config=lowerCamelCase						)
							model.to(lowerCamelCase						)
							model.eval()
							lowerCamelCase_	:     Optional[int] 						=      model(lowerCamelCase						)
							# expected last hidden states: B, C, H // 32, W // 32
							self.parent.assertEqual(
							    result.last_hidden_state.shape       ,      (self.batch_size, self.hidden_sizes[-1], self.image_size // 32, self.image_size // 32)       ,      )



					def   __a     (		self     :     Optional[Any]       ,      lowerCamelCase     :     Optional[Any]       ,      lowerCamelCase     :     List[str]       ,      lowerCamelCase     :     Union[str, Any]						):
							lowerCamelCase_	:     int 						=      ConvNextVaForImageClassification(lowerCamelCase						)
							model.to(lowerCamelCase						)
							model.eval()
							lowerCamelCase_	:     Dict 						=      model(lowerCamelCase       ,      labels=lowerCamelCase						)
							self.parent.assertEqual(result.logits.shape       ,      (self.batch_size, self.num_labels)						)



					def   __a     (		self     :     Union[str, Any]       ,      lowerCamelCase     :     Union[str, Any]       ,      lowerCamelCase     :     Dict       ,      lowerCamelCase     :     Optional[int]						):
							lowerCamelCase_	:     Union[str, Any] 						=      ConvNextVaBackbone(config=lowerCamelCase						)
							model.to(lowerCamelCase						)
							model.eval()
							lowerCamelCase_	:     Union[str, Any] 						=      model(lowerCamelCase						)

							# verify hidden states
							self.parent.assertEqual(len(result.feature_maps						)       ,      len(config.out_features						)						)
							self.parent.assertListEqual(list(result.feature_maps[0].shape						)       ,      [self.batch_size, self.hidden_sizes[1], 4, 4]						)

							# verify channels
							self.parent.assertEqual(len(model.channels						)       ,      len(config.out_features						)						)
							self.parent.assertListEqual(model.channels       ,      config.hidden_sizes[1:]						)

							# verify backbone works with out_features=None
							lowerCamelCase_	:     Dict 						=      None
							lowerCamelCase_	:     int 						=      ConvNextVaBackbone(config=lowerCamelCase						)
							model.to(lowerCamelCase						)
							model.eval()
							lowerCamelCase_	:     str 						=      model(lowerCamelCase						)

							# verify feature maps
							self.parent.assertEqual(len(result.feature_maps						)       ,      1						)
							self.parent.assertListEqual(list(result.feature_maps[0].shape						)       ,      [self.batch_size, self.hidden_sizes[-1], 1, 1]						)

							# verify channels
							self.parent.assertEqual(len(model.channels						)       ,      1						)
							self.parent.assertListEqual(model.channels       ,      [config.hidden_sizes[-1]]						)



					def   __a     (		self     :     Union[str, Any]						):
							lowerCamelCase_	:     Optional[int] 						=      self.prepare_config_and_inputs()
							lowerCamelCase_						,      lowerCamelCase_						,      lowerCamelCase_	:     str 						=      config_and_inputs
							lowerCamelCase_	:     Union[str, Any] 						=      {'pixel_values': pixel_values}
							return config, inputs_dict





					def   __a     (		self     :     int						):
							lowerCamelCase_	:     Any 						=      self.prepare_config_and_inputs()
							lowerCamelCase_						,      lowerCamelCase_						,      lowerCamelCase_	:     Dict 						=      config_and_inputs
							lowerCamelCase_	:     Union[str, Any] 						=      {'pixel_values': pixel_values, 'labels': labels}
							return config, inputs_dict






@require_torch
class 						UpperCamelCase_  (  snake_case__  ,     snake_case__  ,     unittest.TestCase							):
					_a      :						Any						    =					(
					    (
					        ConvNextVaModel,
					        ConvNextVaForImageClassification,
					        ConvNextVaBackbone,
					    )
					    if is_torch_available()
					    else ()
					)
					_a      :						str						    =					(
					    {'feature-extraction': ConvNextVaModel, 'image-classification': ConvNextVaForImageClassification}
					    if is_torch_available()
					    else {}
					)

					_a      :						Optional[Any]						    =					False
					_a      :						List[Any]						    =					False
					_a      :						List[str]						    =					False
					_a      :						Dict						    =					False
					_a      :						str						    =					False



					def   __a     (		self     :     Any						):
							lowerCamelCase_	:     Tuple 						=      ConvNextVaModelTester(self						)
							lowerCamelCase_	:     Optional[int] 						=      ConfigTester(self       ,      config_class=lowerCamelCase       ,      has_text_modality=lowerCamelCase       ,      hidden_size=37						)



					def   __a     (		self     :     Tuple						):
							self.create_and_test_config_common_properties()
							self.config_tester.create_and_test_config_to_json_string()
							self.config_tester.create_and_test_config_to_json_file()
							self.config_tester.create_and_test_config_from_and_save_pretrained()
							self.config_tester.create_and_test_config_with_num_labels()
							self.config_tester.check_config_can_be_init_without_params()
							self.config_tester.check_config_arguments_init()



					def   __a     (		self     :     Tuple						):
							return



					@unittest.skip(reason='ConvNextV2 does not use inputs_embeds'						)
					def   __a     (		self     :     Optional[Any]						):
							pass



					@unittest.skip(reason='ConvNextV2 does not support input and output embeddings'						)
					def   __a     (		self     :     Optional[Any]						):
							pass



					@unittest.skip(reason='ConvNextV2 does not use feedforward chunking'						)
					def   __a     (		self     :     Optional[int]						):
							pass



					def   __a     (		self     :     Optional[int]						):
							if not self.model_tester.is_training:
									return

							for model_class in self.all_model_classes:
									lowerCamelCase_						,      lowerCamelCase_	:     Optional[int] 						=      self.model_tester.prepare_config_and_inputs_with_labels()
									lowerCamelCase_	:     Tuple 						=      True

									if model_class.__name__ in [
									    *get_values(lowerCamelCase						),
									    *get_values(lowerCamelCase						),
									]:
											continue

									lowerCamelCase_	:     List[Any] 						=      model_class(lowerCamelCase						)
									model.to(lowerCamelCase						)
									model.train()
									lowerCamelCase_	:     Optional[Any] 						=      self._prepare_for_class(lowerCamelCase       ,      lowerCamelCase       ,      return_labels=lowerCamelCase						)
									lowerCamelCase_	:     Any 						=      model(**lowerCamelCase						).loss
									loss.backward()



					def   __a     (		self     :     Tuple						):
							if not self.model_tester.is_training:
									return

							for model_class in self.all_model_classes:
									lowerCamelCase_						,      lowerCamelCase_	:     Any 						=      self.model_tester.prepare_config_and_inputs_with_labels()
									lowerCamelCase_	:     Any 						=      False
									lowerCamelCase_	:     str 						=      True

									if (
									    model_class.__name__
									    in [*get_values(lowerCamelCase						), *get_values(lowerCamelCase						)]
									    or not model_class.supports_gradient_checkpointing
									):
											continue

									lowerCamelCase_	:     Optional[int] 						=      model_class(lowerCamelCase						)
									model.to(lowerCamelCase						)
									model.gradient_checkpointing_enable()
									model.train()
									lowerCamelCase_	:     Union[str, Any] 						=      self._prepare_for_class(lowerCamelCase       ,      lowerCamelCase       ,      return_labels=lowerCamelCase						)
									lowerCamelCase_	:     Tuple 						=      model(**lowerCamelCase						).loss
									loss.backward()



					def   __a     (		self     :     Optional[Any]						):
							lowerCamelCase_						,      lowerCamelCase_	:     Union[str, Any] 						=      self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
									lowerCamelCase_	:     str 						=      model_class(lowerCamelCase						)
									lowerCamelCase_	:     Union[str, Any] 						=      inspect.signature(model.forward						)
									# signature.parameters is an OrderedDict => so arg_names order is deterministic
									lowerCamelCase_	:     Union[str, Any] 						=      [*signature.parameters.keys()]

									lowerCamelCase_	:     Any 						=      ['pixel_values']
									self.assertListEqual(arg_names[:1]       ,      lowerCamelCase						)



					def   __a     (		self     :     Tuple						):
							lowerCamelCase_	:     str 						=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*lowerCamelCase						)



					def   __a     (		self     :     int						):
							def check_hidden_states_output(lowerCamelCase     :     Optional[int]       ,      lowerCamelCase     :     Any       ,      lowerCamelCase     :     Tuple						):
									lowerCamelCase_	:     List[Any] 						=      model_class(lowerCamelCase						)
									model.to(lowerCamelCase						)
									model.eval()

									with torch.no_grad():
											lowerCamelCase_	:     List[Any] 						=      model(**self._prepare_for_class(lowerCamelCase       ,      lowerCamelCase						)						)

									lowerCamelCase_	:     List[Any] 						=      outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

									lowerCamelCase_	:     Any 						=      self.model_tester.num_stages
									self.assertEqual(len(lowerCamelCase						)       ,      expected_num_stages + 1						)

									# ConvNextV2's feature maps are of shape (batch_size, num_channels, height, width)
									self.assertListEqual(
									    list(hidden_states[0].shape[-2:]						)       ,      [self.model_tester.image_size // 4, self.model_tester.image_size // 4]       ,      )

							lowerCamelCase_						,      lowerCamelCase_	:     List[str] 						=      self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
									lowerCamelCase_	:     List[Any] 						=      True
									check_hidden_states_output(lowerCamelCase       ,      lowerCamelCase       ,      lowerCamelCase						)

									# check that output_hidden_states also work using config
									del inputs_dict["output_hidden_states"]
									lowerCamelCase_	:     Tuple 						=      True

									check_hidden_states_output(lowerCamelCase       ,      lowerCamelCase       ,      lowerCamelCase						)



					def   __a     (		self     :     List[str]						):
							lowerCamelCase_	:     Optional[Any] 						=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_image_classification(*lowerCamelCase						)





					@slow
					def   __a     (		self     :     Tuple						):
							for model_name in CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									lowerCamelCase_	:     Optional[Any] 						=      ConvNextVaModel.from_pretrained(lowerCamelCase						)
									self.assertIsNotNone(lowerCamelCase						)


def 		_SCREAMING_SNAKE_CASE     ( ):
		lowerCamelCase_	:     Any 						=      Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'						)
		return image






@require_torch
@require_vision
class 						UpperCamelCase_  (  unittest.TestCase							):



					@cached_property
					def   __a     (		self     :     Optional[int]						):
							return AutoImageProcessor.from_pretrained('facebook/convnextv2-tiny-1k-224'						) if is_vision_available() else None





					@slow
					def   __a     (		self     :     List[str]						):
							lowerCamelCase_	:     Tuple 						=      ConvNextVaForImageClassification.from_pretrained('facebook/convnextv2-tiny-1k-224'						).to(lowerCamelCase						)

							lowerCamelCase_	:     Union[str, Any] 						=      self.default_image_processor
							lowerCamelCase_	:     Any 						=      prepare_img()
							lowerCamelCase_	:     int 						=      preprocessor(images=lowerCamelCase       ,      return_tensors='pt'						).to(lowerCamelCase						)

							# forward pass
							with torch.no_grad():
									lowerCamelCase_	:     int 						=      model(**lowerCamelCase						)

							# verify the logits
							lowerCamelCase_	:     Any 						=      torch.Size((1, 10_00)						)
							self.assertEqual(outputs.logits.shape       ,      lowerCamelCase						)

							lowerCamelCase_	:     Any 						=      torch.tensor([0.9_996, 0.1_966, -0.4_386]						).to(lowerCamelCase						)
							self.assertTrue(torch.allclose(outputs.logits[0, :3]       ,      lowerCamelCase       ,      atol=1E-4						)						)







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


_lowercase		:  Any			       =False






@skip_mps
class 						UpperCamelCase_  (  snake_case__  ,     snake_case__  ,     snake_case__  ,     unittest.TestCase							):
					_a      :						Optional[int]						    =					StableDiffusionAttendAndExcitePipeline
					_a      :						Union[str, Any]						    =					False
					_a      :						Dict						    =					TEXT_TO_IMAGE_PARAMS
					_a      :						List[str]						    =					TEXT_TO_IMAGE_BATCH_PARAMS.union({'token_indices'}							)
					_a      :						Optional[int]						    =					TEXT_TO_IMAGE_IMAGE_PARAMS
					_a      :						List[Any]						    =					TEXT_TO_IMAGE_IMAGE_PARAMS



					@classmethod
					def   __a     (		cls     :     Tuple						):
							super().setUpClass()
							torch.use_deterministic_algorithms(lowerCamelCase						)



					@classmethod
					def   __a     (		cls     :     Tuple						):
							super().tearDownClass()
							torch.use_deterministic_algorithms(lowerCamelCase						)



					def   __a     (		self     :     Dict						):
							torch.manual_seed(0						)
							lowerCamelCase_	:     int 						=      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=lowerCamelCase       ,      )
							lowerCamelCase_	:     Dict 						=      DDIMScheduler(
							    beta_start=0.00_085       ,      beta_end=0.012       ,      beta_schedule='scaled_linear'       ,      clip_sample=lowerCamelCase       ,      set_alpha_to_one=lowerCamelCase       ,      )
							torch.manual_seed(0						)
							lowerCamelCase_	:     int 						=      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						)
							lowerCamelCase_	:     List[Any] 						=      CLIPTextConfig(
							    bos_token_id=0       ,      eos_token_id=2       ,      hidden_size=32       ,      intermediate_size=37       ,      layer_norm_eps=1E-05       ,      num_attention_heads=4       ,      num_hidden_layers=5       ,      pad_token_id=1       ,      vocab_size=10_00       ,      hidden_act='gelu'       ,      projection_dim=5_12       ,      )
							lowerCamelCase_	:     Any 						=      CLIPTextModel(lowerCamelCase						)
							lowerCamelCase_	:     int 						=      CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip'						)

							lowerCamelCase_	:     Optional[Any] 						=      {
							    'unet': unet,
							    'scheduler': scheduler,
							    'vae': vae,
							    'text_encoder': text_encoder,
							    'tokenizer': tokenizer,
							    'safety_checker': None,
							    'feature_extractor': None,
							}

							return components



					def   __a     (		self     :     List[str]       ,      lowerCamelCase     :     Tuple       ,      lowerCamelCase     :     List[Any]=0						):
							if str(lowerCamelCase						).startswith('mps'						):
									lowerCamelCase_	:     Union[str, Any] 						=      torch.manual_seed(lowerCamelCase						)
							else:
									lowerCamelCase_	:     Optional[Any] 						=      torch.Generator(device=lowerCamelCase						).manual_seed(lowerCamelCase						)
							lowerCamelCase_	:     Dict 						=      {
							    '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   __a     (		self     :     Union[str, Any]						):
							lowerCamelCase_	:     List[Any] 						=      'cpu'

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

							lowerCamelCase_	:     List[Any] 						=      self.get_dummy_inputs(lowerCamelCase						)
							lowerCamelCase_	:     List[str] 						=      pipe(**lowerCamelCase						).images
							lowerCamelCase_	:     Optional[Any] 						=      image[0, -3:, -3:, -1]

							self.assertEqual(image.shape       ,      (1, 64, 64, 3)						)
							lowerCamelCase_	:     Dict 						=      np.array(
							    [0.63_905_364, 0.62_897_307, 0.48_599_017, 0.5_133_624, 0.5_550_048, 0.45_769_516, 0.50_326_973, 0.5_023_139, 0.45_384_496]						)
							lowerCamelCase_	:     Any 						=      np.abs(image_slice.flatten() - expected_slice						).max()
							self.assertLessEqual(lowerCamelCase       ,      1E-3						)



					def   __a     (		self     :     Tuple						):
							super().test_cpu_offload_forward_pass(expected_max_diff=5E-4						)



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



					def   __a     (		self     :     List[str]						):
							self._test_inference_batch_single_identical(batch_size=2       ,      expected_max_diff=7E-4						)



					def   __a     (		self     :     str						):
							super().test_dict_tuple_outputs_equivalent(expected_max_difference=3E-3						)



					def   __a     (		self     :     Optional[Any]						):
							super().test_pt_np_pil_outputs_equivalent(expected_max_diff=5E-4						)



					def   __a     (		self     :     Tuple						):
							super().test_save_load_local(expected_max_difference=5E-4						)





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






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



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



					@classmethod
					def   __a     (		cls     :     List[Any]						):
							super().tearDownClass()
							torch.use_deterministic_algorithms(lowerCamelCase						)



					def   __a     (		self     :     List[str]						):
							super().tearDown()
							gc.collect()
							torch.cuda.empty_cache()





					def   __a     (		self     :     str						):
							lowerCamelCase_	:     Optional[Any] 						=      torch.manual_seed(51						)

							lowerCamelCase_	:     Any 						=      StableDiffusionAttendAndExcitePipeline.from_pretrained(
							    'CompVis/stable-diffusion-v1-4'       ,      safety_checker=lowerCamelCase       ,      torch_dtype=torch.floataa						)
							pipe.to('cuda'						)

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

							lowerCamelCase_	:     List[str] 						=      pipe(
							    prompt=lowerCamelCase       ,      token_indices=lowerCamelCase       ,      guidance_scale=7.5       ,      generator=lowerCamelCase       ,      num_inference_steps=5       ,      max_iter_to_alter=5       ,      output_type='numpy'       ,      ).images[0]

							lowerCamelCase_	:     Optional[Any] 						=      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
