

"""simple docstring"""




import inspect
import unittest

from transformers import EfficientNetConfig
from transformers.testing_utils import is_pipeline_test, 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 EfficientNetForImageClassification, EfficientNetModel
						from transformers.models.efficientnet.modeling_efficientnet import EFFICIENTNET_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
						from PIL import Image

						from transformers import AutoImageProcessor





class 				lowerCamelCase  :

			def __init__(   self			:  Tuple      ,			__UpperCAmelCase			:  List[Any]      ,			__UpperCAmelCase			:  List[Any]=1_3      ,			__UpperCAmelCase			:  int=3_2      ,			__UpperCAmelCase			:  List[Any]=3      ,			__UpperCAmelCase			:  List[str]=[3, 3, 5]      ,			__UpperCAmelCase			:  Dict=[3_2, 1_6, 2_4]      ,			__UpperCAmelCase			:  str=[1_6, 2_4, 4_0]      ,			__UpperCAmelCase			:  Dict=[1, 1, 2]      ,			__UpperCAmelCase			:  Union[str, Any]=[1, 1, 2]      ,			__UpperCAmelCase			:  Dict=[1, 6, 6]      ,			__UpperCAmelCase			:  Optional[Any]=True      ,			__UpperCAmelCase			:  Union[str, Any]=True      ,			__UpperCAmelCase			:  Optional[Any]=3_7      ,			__UpperCAmelCase			:  Any="gelu"      ,			__UpperCAmelCase			:  Any=1_0      ,			)				->      List[Any]:
						SCREAMING_SNAKE_CASE__									= parent
						SCREAMING_SNAKE_CASE__									= batch_size
						SCREAMING_SNAKE_CASE__									= image_size
						SCREAMING_SNAKE_CASE__									= num_channels
						SCREAMING_SNAKE_CASE__									= kernel_sizes
						SCREAMING_SNAKE_CASE__									= in_channels
						SCREAMING_SNAKE_CASE__									= out_channels
						SCREAMING_SNAKE_CASE__									= strides
						SCREAMING_SNAKE_CASE__									= num_block_repeats
						SCREAMING_SNAKE_CASE__									= expand_ratios
						SCREAMING_SNAKE_CASE__									= is_training
						SCREAMING_SNAKE_CASE__									= hidden_act
						SCREAMING_SNAKE_CASE__									= num_labels
						SCREAMING_SNAKE_CASE__									= use_labels

			def    SCREAMING_SNAKE_CASE			(   self			:  Optional[int]    )				->      str:
						SCREAMING_SNAKE_CASE__									= floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]    )

						SCREAMING_SNAKE_CASE__									= None
						if self.use_labels:
									SCREAMING_SNAKE_CASE__									= ids_tensor([self.batch_size]      ,			self.num_labels    )

						SCREAMING_SNAKE_CASE__									= self.get_config()
						return config, pixel_values, labels

			def    SCREAMING_SNAKE_CASE			(   self			:  List[str]    )				->      str:
						return EfficientNetConfig(
						    num_channels=self.num_channels      ,			kernel_sizes=self.kernel_sizes      ,			in_channels=self.in_channels      ,			out_channels=self.out_channels      ,			strides=self.strides      ,			num_block_repeats=self.num_block_repeats      ,			expand_ratios=self.expand_ratios      ,			hidden_act=self.hidden_act      ,			num_labels=self.num_labels      ,			)

			def    SCREAMING_SNAKE_CASE			(   self			:  List[Any]      ,			__UpperCAmelCase			:  Optional[int]      ,			__UpperCAmelCase			:  int      ,			__UpperCAmelCase			:  Dict    )				->      str:
						SCREAMING_SNAKE_CASE__									= EfficientNetModel(config=__UpperCAmelCase    )
						model.to(__UpperCAmelCase    )
						model.eval()
						SCREAMING_SNAKE_CASE__									= model(__UpperCAmelCase    )
						# expected last hidden states: B, C, H // 4, W // 4
						self.parent.assertEqual(
						    result.last_hidden_state.shape      ,			(self.batch_size, config.hidden_dim, self.image_size // 4, self.image_size // 4)      ,			)

			def    SCREAMING_SNAKE_CASE			(   self			:  str      ,			__UpperCAmelCase			:  Optional[int]      ,			__UpperCAmelCase			:  Optional[int]      ,			__UpperCAmelCase			:  Any    )				->      Optional[int]:
						SCREAMING_SNAKE_CASE__									= EfficientNetForImageClassification(__UpperCAmelCase    )
						model.to(__UpperCAmelCase    )
						model.eval()
						SCREAMING_SNAKE_CASE__									= model(__UpperCAmelCase      ,			labels=__UpperCAmelCase    )
						self.parent.assertEqual(result.logits.shape      ,			(self.batch_size, self.num_labels)    )





			def    SCREAMING_SNAKE_CASE			(   self			:  Any    )				->      str:
						SCREAMING_SNAKE_CASE__									= self.prepare_config_and_inputs()
						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__									= config_and_inputs
						SCREAMING_SNAKE_CASE__									= {"""pixel_values""": pixel_values}
						return config, inputs_dict





@require_torch
class 				lowerCamelCase  (A__     ,A__     ,unittest.TestCase     ):
			lowerCamelCase__				:						Optional[int]   						=							(EfficientNetModel, EfficientNetForImageClassification) if is_torch_available() else ()
			lowerCamelCase__				:						Dict   						=							(
			    {'feature-extraction': EfficientNetModel, 'image-classification': EfficientNetForImageClassification}
			    if is_torch_available()
			    else {}
			)

			lowerCamelCase__				:						Optional[int]   						=							False
			lowerCamelCase__				:						Optional[int]   						=							False
			lowerCamelCase__				:						List[Any]   						=							False
			lowerCamelCase__				:						str   						=							False
			lowerCamelCase__				:						Dict   						=							False

			def    SCREAMING_SNAKE_CASE			(   self			:  List[Any]    )				->      Dict:
						SCREAMING_SNAKE_CASE__									= EfficientNetModelTester(self    )
						SCREAMING_SNAKE_CASE__									= ConfigTester(
						    self      ,			config_class=__UpperCAmelCase      ,			has_text_modality=__UpperCAmelCase      ,			hidden_size=3_7    )

			def    SCREAMING_SNAKE_CASE			(   self			:  List[str]    )				->      List[str]:
						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    SCREAMING_SNAKE_CASE			(   self			:  Dict    )				->      Optional[Any]:
						return

			@unittest.skip(reason="""EfficientNet does not use inputs_embeds"""    )
			def    SCREAMING_SNAKE_CASE			(   self			:  Dict    )				->      Optional[Any]:
						pass

			@unittest.skip(reason="""EfficientNet does not support input and output embeddings"""    )
			def    SCREAMING_SNAKE_CASE			(   self			:  Optional[int]    )				->      Dict:
						pass

			@unittest.skip(reason="""EfficientNet does not use feedforward chunking"""    )
			def    SCREAMING_SNAKE_CASE			(   self			:  Union[str, Any]    )				->      str:
						pass

			def    SCREAMING_SNAKE_CASE			(   self			:  Optional[Any]    )				->      str:
						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__									= self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
									SCREAMING_SNAKE_CASE__									= model_class(__UpperCAmelCase    )
									SCREAMING_SNAKE_CASE__									= inspect.signature(model.forward    )
									# signature.parameters is an OrderedDict => so arg_names order is deterministic
									SCREAMING_SNAKE_CASE__									= [*signature.parameters.keys()]

									SCREAMING_SNAKE_CASE__									= ["""pixel_values"""]
									self.assertListEqual(arg_names[:1]      ,			__UpperCAmelCase    )

			def    SCREAMING_SNAKE_CASE			(   self			:  Dict    )				->      str:
						SCREAMING_SNAKE_CASE__									= self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_model(*__UpperCAmelCase    )

			def    SCREAMING_SNAKE_CASE			(   self			:  Optional[int]    )				->      int:
						def check_hidden_states_output(__UpperCAmelCase			:  Optional[Any]      ,			__UpperCAmelCase			:  Dict      ,			__UpperCAmelCase			:  Optional[int]    ):
									SCREAMING_SNAKE_CASE__									= model_class(__UpperCAmelCase    )
									model.to(__UpperCAmelCase    )
									model.eval()

									with torch.no_grad():
												SCREAMING_SNAKE_CASE__									= model(**self._prepare_for_class(__UpperCAmelCase      ,			__UpperCAmelCase    )    )

									SCREAMING_SNAKE_CASE__									= outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states
									SCREAMING_SNAKE_CASE__									= sum(config.num_block_repeats    ) * 4
									self.assertEqual(len(__UpperCAmelCase    )      ,			__UpperCAmelCase    )

									# EfficientNet'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 // 2, self.model_tester.image_size // 2]      ,			)

						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__									= self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
									SCREAMING_SNAKE_CASE__									= True
									check_hidden_states_output(__UpperCAmelCase      ,			__UpperCAmelCase      ,			__UpperCAmelCase    )

									# check that output_hidden_states also work using config
									del inputs_dict["output_hidden_states"]
									SCREAMING_SNAKE_CASE__									= True

									check_hidden_states_output(__UpperCAmelCase      ,			__UpperCAmelCase      ,			__UpperCAmelCase    )

			def    SCREAMING_SNAKE_CASE			(   self			:  Dict    )				->      List[str]:
						SCREAMING_SNAKE_CASE__									= self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_image_classification(*__UpperCAmelCase    )

			@unittest.skip("""Will be fixed soon by reducing the size of the model used for common tests."""    )
			def    SCREAMING_SNAKE_CASE			(   self			:  int    )				->      Union[str, Any]:
						pass

			@slow
			def    SCREAMING_SNAKE_CASE			(   self			:  List[Any]    )				->      str:
						for model_name in EFFICIENTNET_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									SCREAMING_SNAKE_CASE__									= EfficientNetModel.from_pretrained(__UpperCAmelCase    )
									self.assertIsNotNone(__UpperCAmelCase    )





			@is_pipeline_test
			@require_vision
			@slow
			def    SCREAMING_SNAKE_CASE			(   self			:  Union[str, Any]    )				->      int:
						super().test_pipeline_image_classification()

def 		A    (       ):




			'''simple docstring'''


			SCREAMING_SNAKE_CASE__									= Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""      )
			return image





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

			@cached_property
			def    SCREAMING_SNAKE_CASE			(   self			:  List[Any]    )				->      Any:
						return AutoImageProcessor.from_pretrained("""google/efficientnet-b7"""    ) if is_vision_available() else None





			@slow
			def    SCREAMING_SNAKE_CASE			(   self			:  List[Any]    )				->      str:
						SCREAMING_SNAKE_CASE__									= EfficientNetForImageClassification.from_pretrained("""google/efficientnet-b7"""    ).to(__UpperCAmelCase    )

						SCREAMING_SNAKE_CASE__									= self.default_image_processor
						SCREAMING_SNAKE_CASE__									= prepare_img()
						SCREAMING_SNAKE_CASE__									= image_processor(images=__UpperCAmelCase      ,			return_tensors="""pt"""    ).to(__UpperCAmelCase    )

						# forward pass
						with torch.no_grad():
									SCREAMING_SNAKE_CASE__									= model(**__UpperCAmelCase    )

						# verify the logits
						SCREAMING_SNAKE_CASE__									= torch.Size((1, 1_0_0_0)    )
						self.assertEqual(outputs.logits.shape      ,			__UpperCAmelCase    )

						SCREAMING_SNAKE_CASE__									= torch.tensor([0.0_001, 0.0_002, 0.0_002]    ).to(__UpperCAmelCase    )
						self.assertTrue(torch.allclose(outputs.logits[0, :3]      ,			__UpperCAmelCase      ,			atol=1e-4    )    )





"""simple docstring"""




import gc
import random
import unittest

import numpy as np
import torch
from transformers import XLMRobertaTokenizerFast

from diffusers import DDIMScheduler, KandinskyPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky.text_encoder import MCLIPConfig, MultilingualCLIP
from diffusers.utils import floats_tensor, 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     ):
			lowerCamelCase__				:						Optional[Any]   						=							KandinskyPipeline
			lowerCamelCase__				:						Union[str, Any]   						=							[
			    'prompt',
			    'image_embeds',
			    'negative_image_embeds',
			]
			lowerCamelCase__				:						Optional[Any]   						=							['prompt', 'negative_prompt', 'image_embeds', 'negative_image_embeds']
			lowerCamelCase__				:						Union[str, Any]   						=							[
			    'generator',
			    'height',
			    'width',
			    'latents',
			    'guidance_scale',
			    'negative_prompt',
			    'num_inference_steps',
			    'return_dict',
			    'guidance_scale',
			    'num_images_per_prompt',
			    'output_type',
			    'return_dict',
			]
			lowerCamelCase__				:						Optional[Any]   						=							False

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  List[str]    )				->      List[str]:
						return 3_2

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  Any    )				->      int:
						return 3_2

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  Union[str, Any]    )				->      Any:
						return self.time_input_dim

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  List[str]    )				->      Any:
						return self.time_input_dim * 4

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  List[str]    )				->      Optional[Any]:
						return 1_0_0

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

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  Any    )				->      Dict:
						torch.manual_seed(0    )
						SCREAMING_SNAKE_CASE__									= MCLIPConfig(
						    numDims=self.cross_attention_dim      ,			transformerDimensions=self.text_embedder_hidden_size      ,			hidden_size=self.text_embedder_hidden_size      ,			intermediate_size=3_7      ,			num_attention_heads=4      ,			num_hidden_layers=5      ,			vocab_size=1_0_0_5      ,			)

						SCREAMING_SNAKE_CASE__									= MultilingualCLIP(__UpperCAmelCase    )
						SCREAMING_SNAKE_CASE__									= text_encoder.eval()

						return text_encoder

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  str    )				->      int:
						torch.manual_seed(0    )

						SCREAMING_SNAKE_CASE__									= {
						    """in_channels""": 4,
						    # 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,
						}

						SCREAMING_SNAKE_CASE__									= UNetaDConditionModel(**__UpperCAmelCase    )
						return model

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  List[Any]    )				->      Union[str, Any]:
						return {
						    "block_out_channels": [3_2, 6_4],
						    "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": 1_2,
						    "out_channels": 3,
						    "up_block_types": [
						        "AttnUpDecoderBlock2D",
						        "UpDecoderBlock2D",
						    ],
						    "vq_embed_dim": 4,
						}

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  int    )				->      List[str]:
						torch.manual_seed(0    )
						SCREAMING_SNAKE_CASE__									= VQModel(**self.dummy_movq_kwargs    )
						return model

			def    SCREAMING_SNAKE_CASE			(   self			:  Any    )				->      Tuple:
						SCREAMING_SNAKE_CASE__									= self.dummy_text_encoder
						SCREAMING_SNAKE_CASE__									= self.dummy_tokenizer
						SCREAMING_SNAKE_CASE__									= self.dummy_unet
						SCREAMING_SNAKE_CASE__									= self.dummy_movq

						SCREAMING_SNAKE_CASE__									= DDIMScheduler(
						    num_train_timesteps=1_0_0_0      ,			beta_schedule="""linear"""      ,			beta_start=0.00_085      ,			beta_end=0.012      ,			clip_sample=__UpperCAmelCase      ,			set_alpha_to_one=__UpperCAmelCase      ,			steps_offset=1      ,			prediction_type="""epsilon"""      ,			thresholding=__UpperCAmelCase      ,			)

						SCREAMING_SNAKE_CASE__									= {
						    """text_encoder""": text_encoder,
						    """tokenizer""": tokenizer,
						    """unet""": unet,
						    """scheduler""": scheduler,
						    """movq""": movq,
						}
						return components

			def    SCREAMING_SNAKE_CASE			(   self			:  Optional[Any]      ,			__UpperCAmelCase			:  Dict      ,			__UpperCAmelCase			:  Optional[Any]=0    )				->      str:
						SCREAMING_SNAKE_CASE__									= floats_tensor((1, self.cross_attention_dim)      ,			rng=random.Random(__UpperCAmelCase    )    ).to(__UpperCAmelCase    )
						SCREAMING_SNAKE_CASE__									= floats_tensor((1, self.cross_attention_dim)      ,			rng=random.Random(seed + 1    )    ).to(__UpperCAmelCase    )
						if str(__UpperCAmelCase    ).startswith("""mps"""    ):
									SCREAMING_SNAKE_CASE__									= torch.manual_seed(__UpperCAmelCase    )
						else:
									SCREAMING_SNAKE_CASE__									= torch.Generator(device=__UpperCAmelCase    ).manual_seed(__UpperCAmelCase    )
						SCREAMING_SNAKE_CASE__									= {
						    """prompt""": """horse""",
						    """image_embeds""": image_embeds,
						    """negative_image_embeds""": negative_image_embeds,
						    """generator""": generator,
						    """height""": 6_4,
						    """width""": 6_4,
						    """guidance_scale""": 4.0,
						    """num_inference_steps""": 2,
						    """output_type""": """np""",
						}
						return inputs





			def    SCREAMING_SNAKE_CASE			(   self			:  List[str]    )				->      int:
						SCREAMING_SNAKE_CASE__									= """cpu"""

						SCREAMING_SNAKE_CASE__									= self.get_dummy_components()

						SCREAMING_SNAKE_CASE__									= self.pipeline_class(**__UpperCAmelCase    )
						SCREAMING_SNAKE_CASE__									= pipe.to(__UpperCAmelCase    )

						pipe.set_progress_bar_config(disable=__UpperCAmelCase    )

						SCREAMING_SNAKE_CASE__									= pipe(**self.get_dummy_inputs(__UpperCAmelCase    )    )
						SCREAMING_SNAKE_CASE__									= output.images

						SCREAMING_SNAKE_CASE__									= pipe(
						    **self.get_dummy_inputs(__UpperCAmelCase    )      ,			return_dict=__UpperCAmelCase      ,			)[0]

						SCREAMING_SNAKE_CASE__									= image[0, -3:, -3:, -1]
						SCREAMING_SNAKE_CASE__									= image_from_tuple[0, -3:, -3:, -1]

						assert image.shape == (1, 6_4, 6_4, 3)

						SCREAMING_SNAKE_CASE__									= np.array(
						    [0.328_663, 1.0, 0.23_216_873, 1.0, 0.92_717_564, 0.4_639_046, 0.96_894_777, 0.31_713_378, 0.6_293_953]    )

						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()}"""





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

			def    SCREAMING_SNAKE_CASE			(   self			:  Optional[Any]    )				->      List[str]:
						# clean up the VRAM after each test
						super().tearDown()
						gc.collect()
						torch.cuda.empty_cache()





			def    SCREAMING_SNAKE_CASE			(   self			:  List[str]    )				->      Optional[int]:
						SCREAMING_SNAKE_CASE__									= load_numpy(
						    """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"""
						    """/kandinsky/kandinsky_text2img_cat_fp16.npy"""    )

						SCREAMING_SNAKE_CASE__									= KandinskyPriorPipeline.from_pretrained(
						    """kandinsky-community/kandinsky-2-1-prior"""      ,			torch_dtype=torch.floataa    )
						pipe_prior.to(__UpperCAmelCase    )

						SCREAMING_SNAKE_CASE__									= KandinskyPipeline.from_pretrained("""kandinsky-community/kandinsky-2-1"""      ,			torch_dtype=torch.floataa    )
						SCREAMING_SNAKE_CASE__									= pipeline.to(__UpperCAmelCase    )
						pipeline.set_progress_bar_config(disable=__UpperCAmelCase    )

						SCREAMING_SNAKE_CASE__									= """red cat, 4k photo"""

						SCREAMING_SNAKE_CASE__									= torch.Generator(device="""cuda"""    ).manual_seed(0    )
						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__									= pipe_prior(
						    __UpperCAmelCase      ,			generator=__UpperCAmelCase      ,			num_inference_steps=5      ,			negative_prompt=""""""      ,			).to_tuple()

						SCREAMING_SNAKE_CASE__									= torch.Generator(device="""cuda"""    ).manual_seed(0    )
						SCREAMING_SNAKE_CASE__									= pipeline(
						    __UpperCAmelCase      ,			image_embeds=__UpperCAmelCase      ,			negative_image_embeds=__UpperCAmelCase      ,			generator=__UpperCAmelCase      ,			num_inference_steps=1_0_0      ,			output_type="""np"""      ,			)

						SCREAMING_SNAKE_CASE__									= output.images[0]

						assert image.shape == (5_1_2, 5_1_2, 3)

						assert_mean_pixel_difference(__UpperCAmelCase      ,			__UpperCAmelCase    )


