


import unittest

from transformers import (
    MODEL_FOR_OBJECT_DETECTION_MAPPING,
    AutoFeatureExtractor,
    AutoModelForObjectDetection,
    ObjectDetectionPipeline,
    is_vision_available,
    pipeline,
)
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_pytesseract,
    require_tf,
    require_timm,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
				from PIL import Image
else:






				class       _UpperCamelCase    :

								"""simple docstring"""







								@staticmethod
								def      _UpperCAmelCase					(						*a__				,   **a__   )	->				Optional[int]:
									pass






@is_pipeline_test
@require_vision
@require_timm
@require_torch
class       _UpperCamelCase    (					unittest.TestCase				):

				"""simple docstring"""







				lowerCAmelCase 		= MODEL_FOR_OBJECT_DETECTION_MAPPING

				def      _UpperCAmelCase					(						self				,   a__				,   a__				,   a__   )	->				Optional[int]:
					A								=				ObjectDetectionPipeline(model=a__				,   image_processor=a__   )
					return object_detector, ["./tests/fixtures/tests_samples/COCO/000000039769.png"]

				def      _UpperCAmelCase					(						self				,   a__				,   a__   )	->				Tuple:
					A								=				object_detector("""./tests/fixtures/tests_samples/COCO/000000039769.png"""				,   threshold=0.0   )

					self.assertGreater(len(a__   )				,   0   )
					for detected_object in outputs:
						self.assertEqual(
						    a__				,   {
						        """score""": ANY(a__   ),
						        """label""": ANY(a__   ),
						        """box""": {"""xmin""": ANY(a__   ), """ymin""": ANY(a__   ), """xmax""": ANY(a__   ), """ymax""": ANY(a__   )},
						    }				,   )

					import datasets

					A								=				datasets.load_dataset("""hf-internal-testing/fixtures_image_utils"""				,   """image"""				,   split="""test"""   )

					A								=				[
					    Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""   ),
					    """http://images.cocodataset.org/val2017/000000039769.jpg""",
					    # RGBA
					    dataset[0]["""file"""],
					    # LA
					    dataset[1]["""file"""],
					    # L
					    dataset[2]["""file"""],
					]
					A								=				object_detector(a__				,   threshold=0.0   )

					self.assertEqual(len(a__   )				,   len(a__   )   )
					for outputs in batch_outputs:
						self.assertGreater(len(a__   )				,   0   )
						for detected_object in outputs:
							self.assertEqual(
							    a__				,   {
							        """score""": ANY(a__   ),
							        """label""": ANY(a__   ),
							        """box""": {"""xmin""": ANY(a__   ), """ymin""": ANY(a__   ), """xmax""": ANY(a__   ), """ymax""": ANY(a__   )},
							    }				,   )

				@require_tf
				@unittest.skip("""Object detection not implemented in TF"""   )
				def      _UpperCAmelCase					(						self   )	->				List[Any]:
					pass

				@require_torch
				def      _UpperCAmelCase					(						self   )	->				Any:
					A								=				"""hf-internal-testing/tiny-detr-mobilenetsv3"""

					A								=				AutoModelForObjectDetection.from_pretrained(a__   )
					A								=				AutoFeatureExtractor.from_pretrained(a__   )
					A								=				ObjectDetectionPipeline(model=a__				,   feature_extractor=a__   )

					A								=				object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""				,   threshold=0.0   )

					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        {"""score""": 0.33_76, """label""": """LABEL_0""", """box""": {"""xmin""": 159, """ymin""": 120, """xmax""": 480, """ymax""": 359}},
					        {"""score""": 0.33_76, """label""": """LABEL_0""", """box""": {"""xmin""": 159, """ymin""": 120, """xmax""": 480, """ymax""": 359}},
					    ]				,   )

					A								=				object_detector(
					    [
					        """http://images.cocodataset.org/val2017/000000039769.jpg""",
					        """http://images.cocodataset.org/val2017/000000039769.jpg""",
					    ]				,   threshold=0.0				,   )

					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        [
					            {"""score""": 0.33_76, """label""": """LABEL_0""", """box""": {"""xmin""": 159, """ymin""": 120, """xmax""": 480, """ymax""": 359}},
					            {"""score""": 0.33_76, """label""": """LABEL_0""", """box""": {"""xmin""": 159, """ymin""": 120, """xmax""": 480, """ymax""": 359}},
					        ],
					        [
					            {"""score""": 0.33_76, """label""": """LABEL_0""", """box""": {"""xmin""": 159, """ymin""": 120, """xmax""": 480, """ymax""": 359}},
					            {"""score""": 0.33_76, """label""": """LABEL_0""", """box""": {"""xmin""": 159, """ymin""": 120, """xmax""": 480, """ymax""": 359}},
					        ],
					    ]				,   )

				@require_torch
				@slow
				def      _UpperCAmelCase					(						self   )	->				Optional[int]:
					A								=				"""facebook/detr-resnet-50"""

					A								=				AutoModelForObjectDetection.from_pretrained(a__   )
					A								=				AutoFeatureExtractor.from_pretrained(a__   )
					A								=				ObjectDetectionPipeline(model=a__				,   feature_extractor=a__   )

					A								=				object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""   )
					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        {"""score""": 0.99_82, """label""": """remote""", """box""": {"""xmin""": 40, """ymin""": 70, """xmax""": 175, """ymax""": 117}},
					        {"""score""": 0.99_60, """label""": """remote""", """box""": {"""xmin""": 333, """ymin""": 72, """xmax""": 368, """ymax""": 187}},
					        {"""score""": 0.99_55, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 639, """ymax""": 473}},
					        {"""score""": 0.99_88, """label""": """cat""", """box""": {"""xmin""": 13, """ymin""": 52, """xmax""": 314, """ymax""": 470}},
					        {"""score""": 0.99_87, """label""": """cat""", """box""": {"""xmin""": 345, """ymin""": 23, """xmax""": 640, """ymax""": 368}},
					    ]				,   )

					A								=				object_detector(
					    [
					        """http://images.cocodataset.org/val2017/000000039769.jpg""",
					        """http://images.cocodataset.org/val2017/000000039769.jpg""",
					    ]   )
					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        [
					            {"""score""": 0.99_82, """label""": """remote""", """box""": {"""xmin""": 40, """ymin""": 70, """xmax""": 175, """ymax""": 117}},
					            {"""score""": 0.99_60, """label""": """remote""", """box""": {"""xmin""": 333, """ymin""": 72, """xmax""": 368, """ymax""": 187}},
					            {"""score""": 0.99_55, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 639, """ymax""": 473}},
					            {"""score""": 0.99_88, """label""": """cat""", """box""": {"""xmin""": 13, """ymin""": 52, """xmax""": 314, """ymax""": 470}},
					            {"""score""": 0.99_87, """label""": """cat""", """box""": {"""xmin""": 345, """ymin""": 23, """xmax""": 640, """ymax""": 368}},
					        ],
					        [
					            {"""score""": 0.99_82, """label""": """remote""", """box""": {"""xmin""": 40, """ymin""": 70, """xmax""": 175, """ymax""": 117}},
					            {"""score""": 0.99_60, """label""": """remote""", """box""": {"""xmin""": 333, """ymin""": 72, """xmax""": 368, """ymax""": 187}},
					            {"""score""": 0.99_55, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 639, """ymax""": 473}},
					            {"""score""": 0.99_88, """label""": """cat""", """box""": {"""xmin""": 13, """ymin""": 52, """xmax""": 314, """ymax""": 470}},
					            {"""score""": 0.99_87, """label""": """cat""", """box""": {"""xmin""": 345, """ymin""": 23, """xmax""": 640, """ymax""": 368}},
					        ],
					    ]				,   )

				@require_torch
				@slow
				def      _UpperCAmelCase					(						self   )	->				int:
					A								=				"""facebook/detr-resnet-50"""

					A								=				pipeline("""object-detection"""				,   model=a__   )

					A								=				object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""   )
					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        {"""score""": 0.99_82, """label""": """remote""", """box""": {"""xmin""": 40, """ymin""": 70, """xmax""": 175, """ymax""": 117}},
					        {"""score""": 0.99_60, """label""": """remote""", """box""": {"""xmin""": 333, """ymin""": 72, """xmax""": 368, """ymax""": 187}},
					        {"""score""": 0.99_55, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 639, """ymax""": 473}},
					        {"""score""": 0.99_88, """label""": """cat""", """box""": {"""xmin""": 13, """ymin""": 52, """xmax""": 314, """ymax""": 470}},
					        {"""score""": 0.99_87, """label""": """cat""", """box""": {"""xmin""": 345, """ymin""": 23, """xmax""": 640, """ymax""": 368}},
					    ]				,   )

					A								=				object_detector(
					    [
					        """http://images.cocodataset.org/val2017/000000039769.jpg""",
					        """http://images.cocodataset.org/val2017/000000039769.jpg""",
					    ]   )
					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        [
					            {"""score""": 0.99_82, """label""": """remote""", """box""": {"""xmin""": 40, """ymin""": 70, """xmax""": 175, """ymax""": 117}},
					            {"""score""": 0.99_60, """label""": """remote""", """box""": {"""xmin""": 333, """ymin""": 72, """xmax""": 368, """ymax""": 187}},
					            {"""score""": 0.99_55, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 639, """ymax""": 473}},
					            {"""score""": 0.99_88, """label""": """cat""", """box""": {"""xmin""": 13, """ymin""": 52, """xmax""": 314, """ymax""": 470}},
					            {"""score""": 0.99_87, """label""": """cat""", """box""": {"""xmin""": 345, """ymin""": 23, """xmax""": 640, """ymax""": 368}},
					        ],
					        [
					            {"""score""": 0.99_82, """label""": """remote""", """box""": {"""xmin""": 40, """ymin""": 70, """xmax""": 175, """ymax""": 117}},
					            {"""score""": 0.99_60, """label""": """remote""", """box""": {"""xmin""": 333, """ymin""": 72, """xmax""": 368, """ymax""": 187}},
					            {"""score""": 0.99_55, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 639, """ymax""": 473}},
					            {"""score""": 0.99_88, """label""": """cat""", """box""": {"""xmin""": 13, """ymin""": 52, """xmax""": 314, """ymax""": 470}},
					            {"""score""": 0.99_87, """label""": """cat""", """box""": {"""xmin""": 345, """ymin""": 23, """xmax""": 640, """ymax""": 368}},
					        ],
					    ]				,   )

				@require_torch
				@slow
				def      _UpperCAmelCase					(						self   )	->				Tuple:
					A								=				0.99_85
					A								=				"""facebook/detr-resnet-50"""

					A								=				pipeline("""object-detection"""				,   model=a__   )

					A								=				object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""				,   threshold=a__   )
					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        {"""score""": 0.99_88, """label""": """cat""", """box""": {"""xmin""": 13, """ymin""": 52, """xmax""": 314, """ymax""": 470}},
					        {"""score""": 0.99_87, """label""": """cat""", """box""": {"""xmin""": 345, """ymin""": 23, """xmax""": 640, """ymax""": 368}},
					    ]				,   )

				@require_torch
				@require_pytesseract
				@slow
				def      _UpperCAmelCase					(						self   )	->				Optional[int]:
					A								=				"""Narsil/layoutlmv3-finetuned-funsd"""
					A								=				0.99_93

					A								=				pipeline("""object-detection"""				,   model=a__				,   threshold=a__   )

					A								=				object_detector(
					    """https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png"""   )
					self.assertEqual(
					    nested_simplify(a__				,   decimals=4   )				,   [
					        {"""score""": 0.99_93, """label""": """I-ANSWER""", """box""": {"""xmin""": 294, """ymin""": 254, """xmax""": 343, """ymax""": 264}},
					        {"""score""": 0.99_93, """label""": """I-ANSWER""", """box""": {"""xmin""": 294, """ymin""": 254, """xmax""": 343, """ymax""": 264}},
					    ]				,   )







import gc
import unittest

import numpy as np
import torch
from torch.backends.cuda import sdp_kernel

from diffusers import (
    CMStochasticIterativeScheduler,
    ConsistencyModelPipeline,
    UNetaDModel,
)
from diffusers.utils import randn_tensor, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_a, require_torch_gpu

from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE_GENERATION_PARAMS
from ..test_pipelines_common import PipelineTesterMixin


enable_full_determinism()






class       _UpperCamelCase    (					__snake_case    ,		unittest.TestCase				):

				"""simple docstring"""







				lowerCAmelCase 		= ConsistencyModelPipeline
				lowerCAmelCase 		= UNCONDITIONAL_IMAGE_GENERATION_PARAMS
				lowerCAmelCase 		= UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS

				# Override required_optional_params to remove num_images_per_prompt
				lowerCAmelCase 		= frozenset(
				    [
				        'num_inference_steps',
				        'generator',
				        'latents',
				        'output_type',
				        'return_dict',
				        'callback',
				        'callback_steps',
				    ]				)

				@property
				def      _UpperCAmelCase					(						self   )	->				Any:
					A								=				UNetaDModel.from_pretrained(
					    """diffusers/consistency-models-test"""				,   subfolder="""test_unet"""				,   )
					return unet

				@property
				def      _UpperCAmelCase					(						self   )	->				str:
					A								=				UNetaDModel.from_pretrained(
					    """diffusers/consistency-models-test"""				,   subfolder="""test_unet_class_cond"""				,   )
					return unet

				def      _UpperCAmelCase					(						self				,   a__=False   )	->				Tuple:
					if class_cond:
						A								=				self.dummy_cond_unet
					else:
						A								=				self.dummy_uncond_unet

					# Default to CM multistep sampler
					A								=				CMStochasticIterativeScheduler(
					    num_train_timesteps=40				,   sigma_min=0.0_02				,   sigma_max=80.0				,   )

					A								=				{
					    """unet""": unet,
					    """scheduler""": scheduler,
					}

					return components

				def      _UpperCAmelCase					(						self				,   a__				,   a__=0   )	->				Tuple:
					if str(a__   ).startswith("""mps"""   ):
						A								=				torch.manual_seed(a__   )
					else:
						A								=				torch.Generator(device=a__   ).manual_seed(a__   )

					A								=				{
					    """batch_size""": 1,
					    """num_inference_steps""": None,
					    """timesteps""": [22, 0],
					    """generator""": generator,
					    """output_type""": """np""",
					}

					return inputs

				def      _UpperCAmelCase					(						self   )	->				str:
					A								=				"""cpu"""  # ensure determinism for the device-dependent torch.Generator
					A								=				self.get_dummy_components()
					A								=				ConsistencyModelPipeline(**a__   )
					A								=				pipe.to(a__   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_dummy_inputs(a__   )
					A								=				pipe(**a__   ).images
					assert image.shape == (1, 32, 32, 3)

					A								=				image[0, -3:, -3:, -1]
					A								=				np.array([0.35_72, 0.62_73, 0.40_31, 0.39_61, 0.43_21, 0.57_30, 0.52_66, 0.47_80, 0.50_04]   )

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

				def      _UpperCAmelCase					(						self   )	->				Optional[int]:
					A								=				"""cpu"""  # ensure determinism for the device-dependent torch.Generator
					A								=				self.get_dummy_components(class_cond=a__   )
					A								=				ConsistencyModelPipeline(**a__   )
					A								=				pipe.to(a__   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_dummy_inputs(a__   )
					A								=				0
					A								=				pipe(**a__   ).images
					assert image.shape == (1, 32, 32, 3)

					A								=				image[0, -3:, -3:, -1]
					A								=				np.array([0.35_72, 0.62_73, 0.40_31, 0.39_61, 0.43_21, 0.57_30, 0.52_66, 0.47_80, 0.50_04]   )

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

				def      _UpperCAmelCase					(						self   )	->				Optional[int]:
					A								=				"""cpu"""  # ensure determinism for the device-dependent torch.Generator
					A								=				self.get_dummy_components()
					A								=				ConsistencyModelPipeline(**a__   )
					A								=				pipe.to(a__   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_dummy_inputs(a__   )
					A								=				1
					A								=				None
					A								=				pipe(**a__   ).images
					assert image.shape == (1, 32, 32, 3)

					A								=				image[0, -3:, -3:, -1]
					A								=				np.array([0.50_04, 0.50_04, 0.49_94, 0.50_08, 0.49_76, 0.50_18, 0.49_90, 0.49_82, 0.49_87]   )

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

				def      _UpperCAmelCase					(						self   )	->				str:
					A								=				"""cpu"""  # ensure determinism for the device-dependent torch.Generator
					A								=				self.get_dummy_components(class_cond=a__   )
					A								=				ConsistencyModelPipeline(**a__   )
					A								=				pipe.to(a__   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_dummy_inputs(a__   )
					A								=				1
					A								=				None
					A								=				0
					A								=				pipe(**a__   ).images
					assert image.shape == (1, 32, 32, 3)

					A								=				image[0, -3:, -3:, -1]
					A								=				np.array([0.50_04, 0.50_04, 0.49_94, 0.50_08, 0.49_76, 0.50_18, 0.49_90, 0.49_82, 0.49_87]   )

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






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

				"""simple docstring"""







				def      _UpperCAmelCase					(						self   )	->				Tuple:
					super().tearDown()
					gc.collect()
					torch.cuda.empty_cache()

				def      _UpperCAmelCase					(						self				,   a__=0				,   a__=False				,   a__="cpu"				,   a__=torch.floataa				,   a__=(1, 3, 64, 64)   )	->				str:
					A								=				torch.manual_seed(a__   )

					A								=				{
					    """num_inference_steps""": None,
					    """timesteps""": [22, 0],
					    """class_labels""": 0,
					    """generator""": generator,
					    """output_type""": """np""",
					}

					if get_fixed_latents:
						A								=				self.get_fixed_latents(seed=a__				,   device=a__				,   dtype=a__				,   shape=a__   )
						A								=				latents

					return inputs

				def      _UpperCAmelCase					(						self				,   a__=0				,   a__="cpu"				,   a__=torch.floataa				,   a__=(1, 3, 64, 64)   )	->				Optional[Any]:
					if type(a__   ) == str:
						A								=				torch.device(a__   )
					A								=				torch.Generator(device=a__   ).manual_seed(a__   )
					A								=				randn_tensor(a__				,   generator=a__				,   device=a__				,   dtype=a__   )
					return latents

				def      _UpperCAmelCase					(						self   )	->				Tuple:
					A								=				UNetaDModel.from_pretrained("""diffusers/consistency_models"""				,   subfolder="""diffusers_cd_imagenet64_l2"""   )
					A								=				CMStochasticIterativeScheduler(
					    num_train_timesteps=40				,   sigma_min=0.0_02				,   sigma_max=80.0				,   )
					A								=				ConsistencyModelPipeline(unet=a__				,   scheduler=a__   )
					pipe.to(torch_device=a__   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_inputs()
					A								=				pipe(**a__   ).images
					assert image.shape == (1, 64, 64, 3)

					A								=				image[0, -3:, -3:, -1]

					A								=				np.array([0.08_88, 0.08_81, 0.06_66, 0.04_79, 0.02_92, 0.01_95, 0.02_01, 0.01_63, 0.02_54]   )

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

				def      _UpperCAmelCase					(						self   )	->				Dict:
					A								=				UNetaDModel.from_pretrained("""diffusers/consistency_models"""				,   subfolder="""diffusers_cd_imagenet64_l2"""   )
					A								=				CMStochasticIterativeScheduler(
					    num_train_timesteps=40				,   sigma_min=0.0_02				,   sigma_max=80.0				,   )
					A								=				ConsistencyModelPipeline(unet=a__				,   scheduler=a__   )
					pipe.to(torch_device=a__   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_inputs()
					A								=				1
					A								=				None
					A								=				pipe(**a__   ).images
					assert image.shape == (1, 64, 64, 3)

					A								=				image[0, -3:, -3:, -1]

					A								=				np.array([0.03_40, 0.01_52, 0.00_63, 0.02_67, 0.02_21, 0.01_07, 0.04_16, 0.01_86, 0.02_17]   )

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

				@require_torch_a
				def      _UpperCAmelCase					(						self   )	->				Union[str, Any]:
					A								=				UNetaDModel.from_pretrained("""diffusers/consistency_models"""				,   subfolder="""diffusers_cd_imagenet64_l2"""   )
					A								=				CMStochasticIterativeScheduler(
					    num_train_timesteps=40				,   sigma_min=0.0_02				,   sigma_max=80.0				,   )
					A								=				ConsistencyModelPipeline(unet=a__				,   scheduler=a__   )
					pipe.to(torch_device=a__				,   torch_dtype=torch.floataa   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_inputs(get_fixed_latents=a__				,   device=a__   )
					# Ensure usage of flash attention in torch 2.0
					with sdp_kernel(enable_flash=a__				,   enable_math=a__				,   enable_mem_efficient=a__   ):
						A								=				pipe(**a__   ).images
					assert image.shape == (1, 64, 64, 3)

					A								=				image[0, -3:, -3:, -1]

					A								=				np.array([0.18_75, 0.14_28, 0.12_89, 0.21_51, 0.20_92, 0.14_77, 0.18_77, 0.16_41, 0.13_53]   )

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

				@require_torch_a
				def      _UpperCAmelCase					(						self   )	->				List[Any]:
					A								=				UNetaDModel.from_pretrained("""diffusers/consistency_models"""				,   subfolder="""diffusers_cd_imagenet64_l2"""   )
					A								=				CMStochasticIterativeScheduler(
					    num_train_timesteps=40				,   sigma_min=0.0_02				,   sigma_max=80.0				,   )
					A								=				ConsistencyModelPipeline(unet=a__				,   scheduler=a__   )
					pipe.to(torch_device=a__				,   torch_dtype=torch.floataa   )
					pipe.set_progress_bar_config(disable=a__   )

					A								=				self.get_inputs(get_fixed_latents=a__				,   device=a__   )
					A								=				1
					A								=				None
					# Ensure usage of flash attention in torch 2.0
					with sdp_kernel(enable_flash=a__				,   enable_math=a__				,   enable_mem_efficient=a__   ):
						A								=				pipe(**a__   ).images
					assert image.shape == (1, 64, 64, 3)

					A								=				image[0, -3:, -3:, -1]

					A								=				np.array([0.16_63, 0.19_48, 0.22_75, 0.16_80, 0.12_04, 0.12_45, 0.18_58, 0.13_38, 0.20_95]   )

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



