


from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_tf, slow

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


if is_tf_available():
 import numpy
 import tensorflow as tf

 from transformers import (
     TF_DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
     TF_DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
     TF_DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST,
     BertConfig,
     DPRConfig,
     TFDPRContextEncoder,
     TFDPRQuestionEncoder,
     TFDPRReader,
 )


class 		_SCREAMING_SNAKE_CASE     :


     def __init__(  self							,					A_							,					A_=13							,					A_=7							,					A_=True							,					A_=True							,					A_=True							,					A_=True							,					A_=99							,					A_=32							,					A_=2							,					A_=4							,					A_=37							,					A_="gelu"							,					A_=0.1							,					A_=0.1							,					A_=5_12							,					A_=16							,					A_=2							,					A_=0.0_2							,					A_=3							,					A_=4							,					A_=None							,					A_=0							,					):
       _UpperCAmelCase		:							Optional[Any]							=     parent
       _UpperCAmelCase		:							Optional[int]							=     batch_size
       _UpperCAmelCase		:							Optional[int]							=     seq_length
       _UpperCAmelCase		:							Optional[int]							=     is_training
       _UpperCAmelCase		:							List[Any]							=     use_input_mask
       _UpperCAmelCase		:							Dict							=     use_token_type_ids
       _UpperCAmelCase		:							int							=     use_labels
       _UpperCAmelCase		:							List[Any]							=     vocab_size
       _UpperCAmelCase		:							Any							=     hidden_size
       _UpperCAmelCase		:							Any							=     num_hidden_layers
       _UpperCAmelCase		:							int							=     num_attention_heads
       _UpperCAmelCase		:							str							=     intermediate_size
       _UpperCAmelCase		:							Optional[Any]							=     hidden_act
       _UpperCAmelCase		:							Union[str, Any]							=     hidden_dropout_prob
       _UpperCAmelCase		:							Union[str, Any]							=     attention_probs_dropout_prob
       _UpperCAmelCase		:							str							=     max_position_embeddings
       _UpperCAmelCase		:							str							=     type_vocab_size
       _UpperCAmelCase		:							Tuple							=     type_sequence_label_size
       _UpperCAmelCase		:							Any							=     initializer_range
       _UpperCAmelCase		:							List[str]							=     num_labels
       _UpperCAmelCase		:							List[Any]							=     num_choices
       _UpperCAmelCase		:							Dict							=     scope
       _UpperCAmelCase		:							int							=     projection_dim


     def        __snake_case(  self    ):
       _UpperCAmelCase		:							int							=     ids_tensor([self.batch_size, self.seq_length]							,					self.vocab_size    )

       _UpperCAmelCase		:							List[str]							=     None
       if self.use_input_mask:
         # follow test_modeling_tf_ctrl.py
         _UpperCAmelCase		:							Optional[int]							=     random_attention_mask([self.batch_size, self.seq_length]    )

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

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

       _UpperCAmelCase		:							List[Any]							=     BertConfig(
           vocab_size=self.vocab_size							,					hidden_size=self.hidden_size							,					num_hidden_layers=self.num_hidden_layers							,					num_attention_heads=self.num_attention_heads							,					intermediate_size=self.intermediate_size							,					hidden_act=self.hidden_act							,					hidden_dropout_prob=self.hidden_dropout_prob							,					attention_probs_dropout_prob=self.attention_probs_dropout_prob							,					max_position_embeddings=self.max_position_embeddings							,					type_vocab_size=self.type_vocab_size							,					is_decoder=A_							,					initializer_range=self.initializer_range							,					)
       _UpperCAmelCase		:							Dict							=     DPRConfig(projection_dim=self.projection_dim							,					**config.to_dict()    )

       return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels


     def        __snake_case(  self							,					A_							,					A_							,					A_							,					A_							,					A_							,					A_							,					A_    ):
       _UpperCAmelCase		:							int							=     TFDPRContextEncoder(config=A_    )
       _UpperCAmelCase		:							Tuple							=     model(A_							,					attention_mask=A_							,					token_type_ids=A_    )
       _UpperCAmelCase		:							Optional[Any]							=     model(A_							,					token_type_ids=A_    )
       _UpperCAmelCase		:							Optional[int]							=     model(A_    )
       self.parent.assertEqual(result.pooler_output.shape							,					(self.batch_size, self.projection_dim or self.hidden_size)    )


     def        __snake_case(  self							,					A_							,					A_							,					A_							,					A_							,					A_							,					A_							,					A_    ):
       _UpperCAmelCase		:							str							=     TFDPRQuestionEncoder(config=A_    )
       _UpperCAmelCase		:							List[str]							=     model(A_							,					attention_mask=A_							,					token_type_ids=A_    )
       _UpperCAmelCase		:							Tuple							=     model(A_							,					token_type_ids=A_    )
       _UpperCAmelCase		:							str							=     model(A_    )
       self.parent.assertEqual(result.pooler_output.shape							,					(self.batch_size, self.projection_dim or self.hidden_size)    )


     def        __snake_case(  self							,					A_							,					A_							,					A_							,					A_							,					A_							,					A_							,					A_    ):
       _UpperCAmelCase		:							Tuple							=     TFDPRReader(config=A_    )
       _UpperCAmelCase		:							Union[str, Any]							=     model(A_							,					attention_mask=A_    )

       self.parent.assertEqual(result.start_logits.shape							,					(self.batch_size, self.seq_length)    )
       self.parent.assertEqual(result.end_logits.shape							,					(self.batch_size, self.seq_length)    )
       self.parent.assertEqual(result.relevance_logits.shape							,					(self.batch_size,)    )




     def        __snake_case(  self    ):
       _UpperCAmelCase		:							Optional[Any]							=     self.prepare_config_and_inputs()
       (
           (
           _UpperCAmelCase
       ),(
           _UpperCAmelCase
       ),(
           _UpperCAmelCase
       ),(
           _UpperCAmelCase
       ),(
           _UpperCAmelCase
       ),(
           _UpperCAmelCase
       ),(
           _UpperCAmelCase
       ),
       )		:							Tuple							=     config_and_inputs
       _UpperCAmelCase		:							int							=     {"""input_ids""": input_ids}
       return config, inputs_dict


@require_tf
class 		_SCREAMING_SNAKE_CASE     (						A							,	A							,	unittest.TestCase     ):
     __SCREAMING_SNAKE_CASE     					=    (
         (
             TFDPRContextEncoder,
             TFDPRQuestionEncoder,
             TFDPRReader,
         )
         if is_tf_available()
         else ()
     )
     __SCREAMING_SNAKE_CASE     					=    {'''feature-extraction''': TFDPRQuestionEncoder} if is_tf_available() else {}

     __SCREAMING_SNAKE_CASE     					=    False
     __SCREAMING_SNAKE_CASE     					=    False
     __SCREAMING_SNAKE_CASE     					=    False
     __SCREAMING_SNAKE_CASE     					=    False
     __SCREAMING_SNAKE_CASE     					=    False


     def        __snake_case(  self    ):
       _UpperCAmelCase		:							Union[str, Any]							=     TFDPRModelTester(self    )
       _UpperCAmelCase		:							Optional[Any]							=     ConfigTester(self							,					config_class=A_							,					hidden_size=37    )


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


     def        __snake_case(  self    ):
       _UpperCAmelCase		:							Any							=     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_dpr_context_encoder(*A_    )


     def        __snake_case(  self    ):
       _UpperCAmelCase		:							Dict							=     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_dpr_question_encoder(*A_    )


     def        __snake_case(  self    ):
       _UpperCAmelCase		:							List[Any]							=     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_dpr_reader(*A_    )




     @slow
     def        __snake_case(  self    ):
       for model_name in TF_DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _UpperCAmelCase		:							Tuple							=     TFDPRContextEncoder.from_pretrained(A_    )
         self.assertIsNotNone(A_    )

       for model_name in TF_DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _UpperCAmelCase		:							str							=     TFDPRContextEncoder.from_pretrained(A_    )
         self.assertIsNotNone(A_    )

       for model_name in TF_DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _UpperCAmelCase		:							int							=     TFDPRQuestionEncoder.from_pretrained(A_    )
         self.assertIsNotNone(A_    )

       for model_name in TF_DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _UpperCAmelCase		:							Dict							=     TFDPRReader.from_pretrained(A_    )
         self.assertIsNotNone(A_    )


@require_tf
class 		_SCREAMING_SNAKE_CASE     (						unittest.TestCase     ):


     @slow
     def        __snake_case(  self    ):
       _UpperCAmelCase		:							Optional[int]							=     TFDPRQuestionEncoder.from_pretrained("""facebook/dpr-question_encoder-single-nq-base"""    )

       _UpperCAmelCase		:							Optional[int]							=     tf.constant(
           [[1_01, 75_92, 10_10, 20_03, 20_26, 38_99, 1_01_40, 10_29, 1_02]]    )  # [CLS] hello, is my dog cute? [SEP]
       _UpperCAmelCase		:							Tuple							=     model(A_    )[0]  # embedding shape = (1, 768)
       # compare the actual values for a slice.
       _UpperCAmelCase		:							Union[str, Any]							=     tf.constant(
           [
               [
                   0.0_3_2_3_6_2_5_3,
                   0.1_2_7_5_3_3_3_5,
                   0.1_6_8_1_8_5_0_9,
                   0.0_0_2_7_9_7_8_6,
                   0.3_8_9_6_9_3_3,
                   0.2_4_2_6_4_9_4_5,
                   0.2_1_7_8_9_7_1,
                   -0.0_2_3_3_5_2_2_7,
                   -0.0_8_4_8_1_9_5_9,
                   -0.1_4_3_2_4_1_1_7,
               ]
           ]    )
       self.assertTrue(numpy.allclose(output[:, :10].numpy()							,					expected_slice.numpy()							,					atol=1e-4    )    )









import gc
import random
import unittest

import torch

from diffusers import (
    IFImgaImgPipeline,
    IFImgaImgSuperResolutionPipeline,
    IFInpaintingPipeline,
    IFInpaintingSuperResolutionPipeline,
    IFPipeline,
    IFSuperResolutionPipeline,
)
from diffusers.models.attention_processor import AttnAddedKVProcessor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import floats_tensor, load_numpy, require_torch_gpu, skip_mps, slow, torch_device

from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference
from . import IFPipelineTesterMixin


@skip_mps
class 		_SCREAMING_SNAKE_CASE     (						A							,	A							,	unittest.TestCase     ):
     __SCREAMING_SNAKE_CASE     					=    IFPipeline
     __SCREAMING_SNAKE_CASE     					=    TEXT_TO_IMAGE_PARAMS - {'''width''', '''height''', '''latents'''}
     __SCREAMING_SNAKE_CASE     					=    TEXT_TO_IMAGE_BATCH_PARAMS
     __SCREAMING_SNAKE_CASE     					=    PipelineTesterMixin.required_optional_params - {'''latents'''}


     def        __snake_case(  self    ):
       return self._get_dummy_components()


     def        __snake_case(  self							,					A_							,					A_=0    ):
       if str(A_    ).startswith("""mps"""    ):
         _UpperCAmelCase		:							Tuple							=     torch.manual_seed(A_    )
       else:
         _UpperCAmelCase		:							Optional[Any]							=     torch.Generator(device=A_    ).manual_seed(A_    )

       _UpperCAmelCase		:							Any							=     {
           """prompt""": """A painting of a squirrel eating a burger""",
           """generator""": generator,
           """num_inference_steps""": 2,
           """output_type""": """numpy""",
       }

       return inputs


     def        __snake_case(  self    ):
       self._test_save_load_optional_components()


     @unittest.skipIf(torch_device != """cuda"""							,					reason="""float16 requires CUDA"""    )
     def        __snake_case(  self    ):
       # Due to non-determinism in save load of the hf-internal-testing/tiny-random-t5 text encoder
       super().test_save_load_floataa(expected_max_diff=1e-1    )


     def        __snake_case(  self    ):
       self._test_attention_slicing_forward_pass(expected_max_diff=1e-2    )


     def        __snake_case(  self    ):
       self._test_save_load_local()


     def        __snake_case(  self    ):
       self._test_inference_batch_single_identical(
           expected_max_diff=1e-2							,					)




     @unittest.skipIf(
         torch_device != """cuda""" or not is_xformers_available()							,					reason="""XFormers attention is only available with CUDA and `xformers` installed"""							,					)
     def        __snake_case(  self    ):
       self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3    )


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


     def        __snake_case(  self    ):
       # clean up the VRAM after each test
       super().tearDown()
       gc.collect()
       torch.cuda.empty_cache()


     def        __snake_case(  self    ):
       # if

       _UpperCAmelCase		:							List[str]							=     IFPipeline.from_pretrained("""DeepFloyd/IF-I-XL-v1.0"""							,					variant="""fp16"""							,					torch_dtype=torch.floataa    )

       _UpperCAmelCase		:							Dict							=     IFSuperResolutionPipeline.from_pretrained(
           """DeepFloyd/IF-II-L-v1.0"""							,					variant="""fp16"""							,					torch_dtype=torch.floataa							,					text_encoder=A_							,					tokenizer=A_    )

       # pre compute text embeddings and remove T5 to save memory

       pipe_a.text_encoder.to("""cuda"""    )

       _UpperCAmelCase,_UpperCAmelCase		:							Dict							=     pipe_a.encode_prompt("""anime turtle"""							,					device="""cuda"""    )

       del pipe_a.tokenizer
       del pipe_a.text_encoder
       gc.collect()

       _UpperCAmelCase		:							List[Any]							=     None
       _UpperCAmelCase		:							Any							=     None

       pipe_a.enable_model_cpu_offload()
       pipe_a.enable_model_cpu_offload()

       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()    )
       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()    )

       self._test_if(A_							,					A_							,					A_							,					A_    )

       pipe_a.remove_all_hooks()
       pipe_a.remove_all_hooks()

       # img2img

       _UpperCAmelCase		:							Any							=     IFImgaImgPipeline(**pipe_a.components    )
       _UpperCAmelCase		:							Union[str, Any]							=     IFImgaImgSuperResolutionPipeline(**pipe_a.components    )

       pipe_a.enable_model_cpu_offload()
       pipe_a.enable_model_cpu_offload()

       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()    )
       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()    )

       self._test_if_imgaimg(A_							,					A_							,					A_							,					A_    )

       pipe_a.remove_all_hooks()
       pipe_a.remove_all_hooks()

       # inpainting

       _UpperCAmelCase		:							Optional[int]							=     IFInpaintingPipeline(**pipe_a.components    )
       _UpperCAmelCase		:							Union[str, Any]							=     IFInpaintingSuperResolutionPipeline(**pipe_a.components    )

       pipe_a.enable_model_cpu_offload()
       pipe_a.enable_model_cpu_offload()

       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()    )
       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()    )

       self._test_if_inpainting(A_							,					A_							,					A_							,					A_    )


     def        __snake_case(  self							,					A_							,					A_							,					A_							,					A_    ):
       # pipeline 1

       _start_torch_memory_measurement()

       _UpperCAmelCase		:							Optional[Any]							=     torch.Generator(device="""cpu"""    ).manual_seed(0    )
       _UpperCAmelCase		:							List[str]							=     pipe_a(
           prompt_embeds=A_							,					negative_prompt_embeds=A_							,					num_inference_steps=2							,					generator=A_							,					output_type="""np"""							,					)

       _UpperCAmelCase		:							int							=     output.images[0]

       assert image.shape == (64, 64, 3)

       _UpperCAmelCase		:							Dict							=     torch.cuda.max_memory_allocated()
       assert mem_bytes < 13 * 10**9

       _UpperCAmelCase		:							str							=     load_numpy(
           """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if.npy"""    )
       assert_mean_pixel_difference(A_							,					A_    )

       # pipeline 2

       _start_torch_memory_measurement()

       _UpperCAmelCase		:							List[Any]							=     torch.Generator(device="""cpu"""    ).manual_seed(0    )

       _UpperCAmelCase		:							str							=     floats_tensor((1, 3, 64, 64)							,					rng=random.Random(0    )    ).to(A_    )

       _UpperCAmelCase		:							str							=     pipe_a(
           prompt_embeds=A_							,					negative_prompt_embeds=A_							,					image=A_							,					generator=A_							,					num_inference_steps=2							,					output_type="""np"""							,					)

       _UpperCAmelCase		:							int							=     output.images[0]

       assert image.shape == (2_56, 2_56, 3)

       _UpperCAmelCase		:							Any							=     torch.cuda.max_memory_allocated()
       assert mem_bytes < 4 * 10**9

       _UpperCAmelCase		:							List[Any]							=     load_numpy(
           """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_superresolution_stage_II.npy"""    )
       assert_mean_pixel_difference(A_							,					A_    )


     def        __snake_case(  self							,					A_							,					A_							,					A_							,					A_    ):
       # pipeline 1

       _start_torch_memory_measurement()

       _UpperCAmelCase		:							Optional[int]							=     floats_tensor((1, 3, 64, 64)							,					rng=random.Random(0    )    ).to(A_    )

       _UpperCAmelCase		:							Dict							=     torch.Generator(device="""cpu"""    ).manual_seed(0    )

       _UpperCAmelCase		:							List[str]							=     pipe_a(
           prompt_embeds=A_							,					negative_prompt_embeds=A_							,					image=A_							,					num_inference_steps=2							,					generator=A_							,					output_type="""np"""							,					)

       _UpperCAmelCase		:							int							=     output.images[0]

       assert image.shape == (64, 64, 3)

       _UpperCAmelCase		:							str							=     torch.cuda.max_memory_allocated()
       assert mem_bytes < 10 * 10**9

       _UpperCAmelCase		:							str							=     load_numpy(
           """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_img2img.npy"""    )
       assert_mean_pixel_difference(A_							,					A_    )

       # pipeline 2

       _start_torch_memory_measurement()

       _UpperCAmelCase		:							List[str]							=     torch.Generator(device="""cpu"""    ).manual_seed(0    )

       _UpperCAmelCase		:							Union[str, Any]							=     floats_tensor((1, 3, 2_56, 2_56)							,					rng=random.Random(0    )    ).to(A_    )
       _UpperCAmelCase		:							Optional[int]							=     floats_tensor((1, 3, 64, 64)							,					rng=random.Random(0    )    ).to(A_    )

       _UpperCAmelCase		:							Optional[int]							=     pipe_a(
           prompt_embeds=A_							,					negative_prompt_embeds=A_							,					image=A_							,					original_image=A_							,					generator=A_							,					num_inference_steps=2							,					output_type="""np"""							,					)

       _UpperCAmelCase		:							Dict							=     output.images[0]

       assert image.shape == (2_56, 2_56, 3)

       _UpperCAmelCase		:							Any							=     torch.cuda.max_memory_allocated()
       assert mem_bytes < 4 * 10**9

       _UpperCAmelCase		:							int							=     load_numpy(
           """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_img2img_superresolution_stage_II.npy"""    )
       assert_mean_pixel_difference(A_							,					A_    )




     def        __snake_case(  self							,					A_							,					A_							,					A_							,					A_    ):
       # pipeline 1

       _start_torch_memory_measurement()

       _UpperCAmelCase		:							List[Any]							=     floats_tensor((1, 3, 64, 64)							,					rng=random.Random(0    )    ).to(A_    )
       _UpperCAmelCase		:							Dict							=     floats_tensor((1, 3, 64, 64)							,					rng=random.Random(1    )    ).to(A_    )

       _UpperCAmelCase		:							Optional[Any]							=     torch.Generator(device="""cpu"""    ).manual_seed(0    )
       _UpperCAmelCase		:							str							=     pipe_a(
           prompt_embeds=A_							,					negative_prompt_embeds=A_							,					image=A_							,					mask_image=A_							,					num_inference_steps=2							,					generator=A_							,					output_type="""np"""							,					)

       _UpperCAmelCase		:							Optional[Any]							=     output.images[0]

       assert image.shape == (64, 64, 3)

       _UpperCAmelCase		:							List[str]							=     torch.cuda.max_memory_allocated()
       assert mem_bytes < 10 * 10**9

       _UpperCAmelCase		:							Dict							=     load_numpy(
           """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_inpainting.npy"""    )
       assert_mean_pixel_difference(A_							,					A_    )

       # pipeline 2

       _start_torch_memory_measurement()

       _UpperCAmelCase		:							str							=     torch.Generator(device="""cpu"""    ).manual_seed(0    )

       _UpperCAmelCase		:							Optional[int]							=     floats_tensor((1, 3, 64, 64)							,					rng=random.Random(0    )    ).to(A_    )
       _UpperCAmelCase		:							Tuple							=     floats_tensor((1, 3, 2_56, 2_56)							,					rng=random.Random(0    )    ).to(A_    )
       _UpperCAmelCase		:							str							=     floats_tensor((1, 3, 2_56, 2_56)							,					rng=random.Random(1    )    ).to(A_    )

       _UpperCAmelCase		:							Union[str, Any]							=     pipe_a(
           prompt_embeds=A_							,					negative_prompt_embeds=A_							,					image=A_							,					mask_image=A_							,					original_image=A_							,					generator=A_							,					num_inference_steps=2							,					output_type="""np"""							,					)

       _UpperCAmelCase		:							Any							=     output.images[0]

       assert image.shape == (2_56, 2_56, 3)

       _UpperCAmelCase		:							Optional[int]							=     torch.cuda.max_memory_allocated()
       assert mem_bytes < 4 * 10**9

       _UpperCAmelCase		:							Tuple							=     load_numpy(
           """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_inpainting_superresolution_stage_II.npy"""    )
       assert_mean_pixel_difference(A_							,					A_    )




def    a__    (		):
  torch.cuda.empty_cache()
  torch.cuda.reset_max_memory_allocated()
  torch.cuda.reset_peak_memory_stats()





