




from __future__ import annotations

import unittest

from transformers import AutoTokenizer, PegasusConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
from transformers.utils import cached_property

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
			import tensorflow as tf

			from transformers import TFAutoModelForSeqaSeqLM, TFPegasusForConditionalGeneration, TFPegasusModel







@require_tf
class a :
						"""simple docstring"""

						UpperCamelCase_	:       List[Any]       	=		PegasusConfig
						UpperCamelCase_	:       List[Any]       	=		{}
						UpperCamelCase_	:       List[str]       	=		'gelu'






						def __init__( self :     Any				,							lowerCamelCase__ :     Dict				,							lowerCamelCase__ :     Dict=13				,							lowerCamelCase__ :     Union[str, Any]=7				,							lowerCamelCase__ :     Dict=True				,							lowerCamelCase__ :     List[Any]=False				,							lowerCamelCase__ :     Optional[int]=99				,							lowerCamelCase__ :     List[str]=32				,							lowerCamelCase__ :     Union[str, Any]=2				,							lowerCamelCase__ :     Optional[Any]=4				,							lowerCamelCase__ :     Tuple=37				,							lowerCamelCase__ :     str=0.1				,							lowerCamelCase__ :     Any=0.1				,							lowerCamelCase__ :     Dict=40				,							lowerCamelCase__ :     str=2				,							lowerCamelCase__ :     Any=1				,							lowerCamelCase__ :     Optional[Any]=0				,							)    ->						Tuple:
													"""simple docstring"""


													__lowercase      =    parent
													__lowercase      =    batch_size
													__lowercase      =    seq_length
													__lowercase      =    is_training
													__lowercase      =    use_labels
													__lowercase      =    vocab_size
													__lowercase      =    hidden_size
													__lowercase      =    num_hidden_layers
													__lowercase      =    num_attention_heads
													__lowercase      =    intermediate_size

													__lowercase      =    hidden_dropout_prob
													__lowercase      =    attention_probs_dropout_prob
													__lowercase      =    max_position_embeddings
													__lowercase      =    eos_token_id
													__lowercase      =    pad_token_id
													__lowercase      =    bos_token_id






						def     UpperCAmelCase_      ( self :     Dict				)    ->						Tuple:
													"""simple docstring"""


													__lowercase      =    ids_tensor([self.batch_size, self.seq_length - 1]				,							self.vocab_size				)
													__lowercase      =    tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size				)				,							1				)
													__lowercase      =    tf.concat([input_ids, eos_tensor]				,							axis=1				)

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

													__lowercase      =    self.config_cls(
													    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_ids=[2]				,							bos_token_id=self.bos_token_id				,							pad_token_id=self.pad_token_id				,							decoder_start_token_id=self.pad_token_id				,							**self.config_updates				,							)
													__lowercase      =    prepare_pegasus_inputs_dict(lowerCamelCase__				,							lowerCamelCase__				,							lowerCamelCase__				)
													return config, inputs_dict






						def     UpperCAmelCase_      ( self :     int				,							lowerCamelCase__ :     Union[str, Any]				,							lowerCamelCase__ :     Dict				)    ->						Any:
													"""simple docstring"""


													__lowercase      =    TFPegasusModel(config=lowerCamelCase__				).get_decoder()
													__lowercase      =    inputs_dict['''input_ids''']

													__lowercase      =    input_ids[:1, :]
													__lowercase      =    inputs_dict['''attention_mask'''][:1, :]
													__lowercase      =    inputs_dict['''head_mask''']
													__lowercase      =    1

													# first forward pass
													__lowercase      =    model(lowerCamelCase__				,							attention_mask=lowerCamelCase__				,							head_mask=lowerCamelCase__				,							use_cache=lowerCamelCase__				)

													__lowercase     ,     __lowercase      =    outputs.to_tuple()

													# create hypothetical next token and extent to next_input_ids
													__lowercase      =    ids_tensor((self.batch_size, 3)				,							config.vocab_size				)
													__lowercase      =    tf.cast(ids_tensor((self.batch_size, 3)				,							2				)				,							tf.inta				)

													# append to next input_ids and
													__lowercase      =    tf.concat([input_ids, next_tokens]				,							axis=-1				)
													__lowercase      =    tf.concat([attention_mask, next_attn_mask]				,							axis=-1				)

													__lowercase      =    model(lowerCamelCase__				,							attention_mask=lowerCamelCase__				)[0]
													__lowercase      =    model(lowerCamelCase__				,							attention_mask=lowerCamelCase__				,							past_key_values=lowerCamelCase__				)[0]

													self.parent.assertEqual(next_tokens.shape[1]				,							output_from_past.shape[1]				)

													# select random slice
													__lowercase      =    int(ids_tensor((1,)				,							output_from_past.shape[-1]				)				)
													__lowercase      =    output_from_no_past[:, -3:, random_slice_idx]
													__lowercase      =    output_from_past[:, :, random_slice_idx]

													# test that outputs are equal for slice
													tf.debugging.assert_near(lowerCamelCase__				,							lowerCamelCase__				,							rtol=1e-3				)







def 		_A(       UpperCamelCase__							:			Optional[Any]				,       UpperCamelCase__							:			int				,       UpperCamelCase__							:			List[str]				,       UpperCamelCase__							:			Tuple=None				,       UpperCamelCase__							:			int=None				,       UpperCamelCase__							:			str=None				,       UpperCamelCase__							:			Union[str, Any]=None				,       UpperCamelCase__							:			Optional[Any]=None				,       )    -> List[str]:
							'''simple docstring'''


							if attention_mask is None:
														__lowercase      =    tf.cast(tf.math.not_equal(UpperCamelCase__				,       config.pad_token_id				)				,       tf.inta				)
							if decoder_attention_mask is None:
														__lowercase      =    tf.concat(
														    [
														        tf.ones(decoder_input_ids[:, :1].shape				,       dtype=tf.inta				),
														        tf.cast(tf.math.not_equal(decoder_input_ids[:, 1:]				,       config.pad_token_id				)				,       tf.inta				),
														    ]				,       axis=-1				,       )
							if head_mask is None:
														__lowercase      =    tf.ones((config.encoder_layers, config.encoder_attention_heads)				)
							if decoder_head_mask is None:
														__lowercase      =    tf.ones((config.decoder_layers, config.decoder_attention_heads)				)
							if cross_attn_head_mask is None:
														__lowercase      =    tf.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": decoder_attention_mask,
							    "head_mask": head_mask,
							    "decoder_head_mask": decoder_head_mask,
							    "cross_attn_head_mask": cross_attn_head_mask,
							}







@require_tf
class a (     __SCREAMING_SNAKE_CASE       ,						__SCREAMING_SNAKE_CASE       ,						unittest.TestCase  ):
						"""simple docstring"""

						UpperCamelCase_	:       Any       	=		(TFPegasusForConditionalGeneration, TFPegasusModel) if is_tf_available() else ()
						UpperCamelCase_	:       Any       	=		(TFPegasusForConditionalGeneration,) if is_tf_available() else ()
						UpperCamelCase_	:       Dict       	=		(
						    {
						        'conversational': TFPegasusForConditionalGeneration,
						        'feature-extraction': TFPegasusModel,
						        'summarization': TFPegasusForConditionalGeneration,
						        'text2text-generation': TFPegasusForConditionalGeneration,
						        'translation': TFPegasusForConditionalGeneration,
						    }
						    if is_tf_available()
						    else {}
						)
						UpperCamelCase_	:       str       	=		True
						UpperCamelCase_	:       Optional[int]       	=		False
						UpperCamelCase_	:       Union[str, Any]       	=		False






						def     UpperCAmelCase_      ( self :     Tuple				)    ->						str:
													"""simple docstring"""


													__lowercase      =    TFPegasusModelTester(self				)
													__lowercase      =    ConfigTester(self				,							config_class=lowerCamelCase__				)






						def     UpperCAmelCase_      ( self :     int				)    ->						Tuple:
													"""simple docstring"""


													self.config_tester.run_common_tests()






						def     UpperCAmelCase_      ( self :     Tuple				)    ->						Tuple:
													"""simple docstring"""


													__lowercase      =    self.model_tester.prepare_config_and_inputs_for_common()
													self.model_tester.check_decoder_model_past_large_inputs(*lowerCamelCase__				)







@require_sentencepiece
@require_tokenizers
@require_tf
class a (     unittest.TestCase  ):
						"""simple docstring"""

						UpperCamelCase_	:       Tuple       	=		[
						    ' PG&E stated it scheduled the blackouts in response to forecasts for high winds amid dry conditions. The aim is to reduce the risk of wildfires. Nearly 800 thousand customers were scheduled to be affected by the shutoffs which were expected to last through at least midday tomorrow.',
						    ' The London trio are up for best UK act and best album, as well as getting two nominations in the best song category."We got told like this morning \'Oh I think you\'re nominated\'", said Dappy."And I was like \'Oh yeah, which one?\' And now we\'ve got nominated for four awards. I mean, wow!"Bandmate Fazer added: "We thought it\'s best of us to come down and mingle with everyone and say hello to the cameras. And now we find we\'ve got four nominations."The band have two shots at the best song prize, getting the nod for their Tynchy Stryder collaboration Number One, and single Strong Again.Their album Uncle B will also go up against records by the likes of Beyonce and Kanye West.N-Dubz picked up the best newcomer Mobo in 2007, but female member Tulisa said they wouldn\'t be too disappointed if they didn\'t win this time around."At the end of the day we\'re grateful to be where we are in our careers."If it don\'t happen then it don\'t happen - live to fight another day and keep on making albums and hits for the fans."Dappy also revealed they could be performing live several times on the night.The group will be doing Number One and also a possible rendition of the War Child single, I Got Soul.The charity song is a  re-working of The Killers\' All These Things That I\'ve Done and is set to feature artists like Chipmunk, Ironik and Pixie Lott.This year\'s Mobos will be held outside of London for the first time, in Glasgow on 30 September.N-Dubz said they were looking forward to performing for their Scottish fans and boasted about their recent shows north of the border."We just done Edinburgh the other day," said Dappy."We smashed up an N-Dubz show over there. We done Aberdeen about three or four months ago - we smashed up that show over there! Everywhere we go we smash it up!" ',
						]
						UpperCamelCase_	:       int       	=		[
						    'California\'s largest electricity provider has cut power to hundreds of thousands of customers in an effort to'
						    ' reduce the risk of wildfires.',
						    'N-Dubz have revealed they\'re "grateful" to have been nominated for four Mobo Awards.',
						]  # differs slightly from pytorch, likely due to numerical differences in linear layers
						UpperCamelCase_	:       List[Any]       	=		'google/pegasus-xsum'






						@cached_property
						def     UpperCAmelCase_      ( self :     int				)    ->						Union[str, Any]:
													"""simple docstring"""


													return AutoTokenizer.from_pretrained(self.model_name				)






						@cached_property
						def     UpperCAmelCase_      ( self :     List[str]				)    ->						Dict:
													"""simple docstring"""


													__lowercase      =    TFAutoModelForSeqaSeqLM.from_pretrained(self.model_name				)
													return model






						def     UpperCAmelCase_      ( self :     Optional[Any]				,							**lowerCamelCase__ :     Any				)    ->						Dict:
													"""simple docstring"""


													__lowercase      =    self.translate_src_text(**lowerCamelCase__				)
													assert self.expected_text == generated_words






						def     UpperCAmelCase_      ( self :     List[str]				,							**lowerCamelCase__ :     List[str]				)    ->						int:
													"""simple docstring"""


													__lowercase      =    self.tokenizer(self.src_text				,							**lowerCamelCase__				,							padding=lowerCamelCase__				,							return_tensors='''tf'''				)
													__lowercase      =    self.model.generate(
													    model_inputs.input_ids				,							attention_mask=model_inputs.attention_mask				,							num_beams=2				,							use_cache=lowerCamelCase__				,							)
													__lowercase      =    self.tokenizer.batch_decode(generated_ids.numpy()				,							skip_special_tokens=lowerCamelCase__				)
													return generated_words






						@slow
						def     UpperCAmelCase_      ( self :     List[str]				)    ->						Optional[int]:
													"""simple docstring"""


													self._assert_generated_batch_equal_expected()












import gc
import random
import unittest

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

from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel
from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps

from ..pipeline_params import (
    IMAGE_TO_IMAGE_IMAGE_PARAMS,
    TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_VARIATION_PARAMS,
)
from ..test_pipelines_common import PipelineLatentTesterMixin, PipelineTesterMixin


enable_full_determinism()







class a (     __SCREAMING_SNAKE_CASE       ,						__SCREAMING_SNAKE_CASE       ,						unittest.TestCase  ):
						"""simple docstring"""

						UpperCamelCase_	:       Any       	=		CycleDiffusionPipeline
						UpperCamelCase_	:       List[str]       	=		TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {
						    'negative_prompt',
						    'height',
						    'width',
						    'negative_prompt_embeds',
						}
						UpperCamelCase_	:       int       	=		PipelineTesterMixin.required_optional_params - {'latents'}
						UpperCamelCase_	:       Dict       	=		TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS.union({'source_prompt'}  )
						UpperCamelCase_	:       Dict       	=		IMAGE_TO_IMAGE_IMAGE_PARAMS
						UpperCamelCase_	:       Optional[Any]       	=		IMAGE_TO_IMAGE_IMAGE_PARAMS






						def     UpperCAmelCase_      ( self :     int				)    ->						Dict:
													"""simple docstring"""


													torch.manual_seed(0				)
													__lowercase      =    UNetaDConditionModel(
													    block_out_channels=(32, 64)				,							layers_per_block=2				,							sample_size=32				,							in_channels=4				,							out_channels=4				,							down_block_types=('''DownBlock2D''', '''CrossAttnDownBlock2D''')				,							up_block_types=('''CrossAttnUpBlock2D''', '''UpBlock2D''')				,							cross_attention_dim=32				,							)
													__lowercase      =    DDIMScheduler(
													    beta_start=0.0_0_0_8_5				,							beta_end=0.0_1_2				,							beta_schedule='''scaled_linear'''				,							num_train_timesteps=1_000				,							clip_sample=lowerCamelCase__				,							set_alpha_to_one=lowerCamelCase__				,							)
													torch.manual_seed(0				)
													__lowercase      =    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				,							)
													torch.manual_seed(0				)
													__lowercase      =    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=1_000				,							)
													__lowercase      =    CLIPTextModel(lowerCamelCase__				)
													__lowercase      =    CLIPTokenizer.from_pretrained('''hf-internal-testing/tiny-random-clip'''				)

													__lowercase      =    {
													    '''unet''': unet,
													    '''scheduler''': scheduler,
													    '''vae''': vae,
													    '''text_encoder''': text_encoder,
													    '''tokenizer''': tokenizer,
													    '''safety_checker''': None,
													    '''feature_extractor''': None,
													}
													return components






						def     UpperCAmelCase_      ( self :     Any				,							lowerCamelCase__ :     int				,							lowerCamelCase__ :     List[str]=0				)    ->						Any:
													"""simple docstring"""


													__lowercase      =    floats_tensor((1, 3, 32, 32)				,							rng=random.Random(lowerCamelCase__				)				).to(lowerCamelCase__				)
													__lowercase      =    image / 2 + 0.5
													if str(lowerCamelCase__				).startswith('''mps'''				):
																				__lowercase      =    torch.manual_seed(lowerCamelCase__				)
													else:
																				__lowercase      =    torch.Generator(device=lowerCamelCase__				).manual_seed(lowerCamelCase__				)
													__lowercase      =    {
													    '''prompt''': '''An astronaut riding an elephant''',
													    '''source_prompt''': '''An astronaut riding a horse''',
													    '''image''': image,
													    '''generator''': generator,
													    '''num_inference_steps''': 2,
													    '''eta''': 0.1,
													    '''strength''': 0.8,
													    '''guidance_scale''': 3,
													    '''source_guidance_scale''': 1,
													    '''output_type''': '''numpy''',
													}
													return inputs






						def     UpperCAmelCase_      ( self :     List[Any]				)    ->						Optional[Any]:
													"""simple docstring"""


													__lowercase      =    '''cpu'''  # ensure determinism for the device-dependent torch.Generator

													__lowercase      =    self.get_dummy_components()
													__lowercase      =    CycleDiffusionPipeline(**lowerCamelCase__				)
													__lowercase      =    pipe.to(lowerCamelCase__				)
													pipe.set_progress_bar_config(disable=lowerCamelCase__				)

													__lowercase      =    self.get_dummy_inputs(lowerCamelCase__				)
													__lowercase      =    pipe(**lowerCamelCase__				)
													__lowercase      =    output.images

													__lowercase      =    images[0, -3:, -3:, -1]

													assert images.shape == (1, 32, 32, 3)
													__lowercase      =    np.array([0.4_4_5_9, 0.4_9_4_3, 0.4_5_4_4, 0.6_6_4_3, 0.5_4_7_4, 0.4_3_2_7, 0.5_7_0_1, 0.5_9_5_9, 0.5_1_7_9]				)

													assert np.abs(image_slice.flatten() - expected_slice				).max() < 1e-2






						@unittest.skipIf(torch_device != '''cuda'''				,							'''This test requires a GPU'''				)
						def     UpperCAmelCase_      ( self :     str				)    ->						Optional[Any]:
													"""simple docstring"""


													__lowercase      =    self.get_dummy_components()
													for name, module in components.items():
																				if hasattr(lowerCamelCase__				,							'''half'''				):
																											__lowercase      =    module.half()
													__lowercase      =    CycleDiffusionPipeline(**lowerCamelCase__				)
													__lowercase      =    pipe.to(lowerCamelCase__				)
													pipe.set_progress_bar_config(disable=lowerCamelCase__				)

													__lowercase      =    self.get_dummy_inputs(lowerCamelCase__				)
													__lowercase      =    pipe(**lowerCamelCase__				)
													__lowercase      =    output.images

													__lowercase      =    images[0, -3:, -3:, -1]

													assert images.shape == (1, 32, 32, 3)
													__lowercase      =    np.array([0.3_5_0_6, 0.4_5_4_3, 0.4_4_6, 0.4_5_7_5, 0.5_1_9_5, 0.4_1_5_5, 0.5_2_7_3, 0.5_1_8, 0.4_1_1_6]				)

													assert np.abs(image_slice.flatten() - expected_slice				).max() < 1e-2






						@skip_mps
						def     UpperCAmelCase_      ( self :     str				)    ->						int:
													"""simple docstring"""


													return super().test_save_load_local()






						@unittest.skip('''non-deterministic pipeline'''				)
						def     UpperCAmelCase_      ( self :     int				)    ->						Union[str, Any]:
													"""simple docstring"""


													return super().test_inference_batch_single_identical()






						@skip_mps
						def     UpperCAmelCase_      ( self :     int				)    ->						Optional[int]:
													"""simple docstring"""


													return super().test_dict_tuple_outputs_equivalent()






						@skip_mps
						def     UpperCAmelCase_      ( self :     List[Any]				)    ->						List[str]:
													"""simple docstring"""


													return super().test_save_load_optional_components()






						@skip_mps
						def     UpperCAmelCase_      ( self :     Union[str, Any]				)    ->						Tuple:
													"""simple docstring"""


													return super().test_attention_slicing_forward_pass()







@slow
@require_torch_gpu
class a (     unittest.TestCase  ):
						"""simple docstring"""

						def     UpperCAmelCase_      ( self :     Optional[Any]				)    ->						Union[str, Any]:
													"""simple docstring"""


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






						def     UpperCAmelCase_      ( self :     Optional[int]				)    ->						List[str]:
													"""simple docstring"""


													__lowercase      =    load_image(
													    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
													    '''/cycle-diffusion/black_colored_car.png'''				)
													__lowercase      =    load_numpy(
													    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/cycle-diffusion/blue_colored_car_fp16.npy'''				)
													__lowercase      =    init_image.resize((512, 512)				)

													__lowercase      =    '''CompVis/stable-diffusion-v1-4'''
													__lowercase      =    DDIMScheduler.from_pretrained(lowerCamelCase__				,							subfolder='''scheduler'''				)
													__lowercase      =    CycleDiffusionPipeline.from_pretrained(
													    lowerCamelCase__				,							scheduler=lowerCamelCase__				,							safety_checker=lowerCamelCase__				,							torch_dtype=torch.floataa				,							revision='''fp16'''				)

													pipe.to(lowerCamelCase__				)
													pipe.set_progress_bar_config(disable=lowerCamelCase__				)
													pipe.enable_attention_slicing()

													__lowercase      =    '''A black colored car'''
													__lowercase      =    '''A blue colored car'''

													__lowercase      =    torch.manual_seed(0				)
													__lowercase      =    pipe(
													    prompt=lowerCamelCase__				,							source_prompt=lowerCamelCase__				,							image=lowerCamelCase__				,							num_inference_steps=100				,							eta=0.1				,							strength=0.8_5				,							guidance_scale=3				,							source_guidance_scale=1				,							generator=lowerCamelCase__				,							output_type='''np'''				,							)
													__lowercase      =    output.images

													# the values aren't exactly equal, but the images look the same visually
													assert np.abs(image - expected_image				).max() < 5e-1






						def     UpperCAmelCase_      ( self :     Tuple				)    ->						List[str]:
													"""simple docstring"""


													__lowercase      =    load_image(
													    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
													    '''/cycle-diffusion/black_colored_car.png'''				)
													__lowercase      =    load_numpy(
													    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/cycle-diffusion/blue_colored_car.npy'''				)
													__lowercase      =    init_image.resize((512, 512)				)

													__lowercase      =    '''CompVis/stable-diffusion-v1-4'''
													__lowercase      =    DDIMScheduler.from_pretrained(lowerCamelCase__				,							subfolder='''scheduler'''				)
													__lowercase      =    CycleDiffusionPipeline.from_pretrained(lowerCamelCase__				,							scheduler=lowerCamelCase__				,							safety_checker=lowerCamelCase__				)

													pipe.to(lowerCamelCase__				)
													pipe.set_progress_bar_config(disable=lowerCamelCase__				)
													pipe.enable_attention_slicing()

													__lowercase      =    '''A black colored car'''
													__lowercase      =    '''A blue colored car'''

													__lowercase      =    torch.manual_seed(0				)
													__lowercase      =    pipe(
													    prompt=lowerCamelCase__				,							source_prompt=lowerCamelCase__				,							image=lowerCamelCase__				,							num_inference_steps=100				,							eta=0.1				,							strength=0.8_5				,							guidance_scale=3				,							source_guidance_scale=1				,							generator=lowerCamelCase__				,							output_type='''np'''				,							)
													__lowercase      =    output.images

													assert np.abs(image - expected_image				).max() < 2e-2






