






import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
      import torch

if is_vision_available():
      from PIL import Image

      from transformers import MobileNetVaImageProcessor


class        __UpperCamelCase    (     unittest.TestCase   ):







 def __init__(  self      :							Tuple       ,				_lowerCAmelCase      :							Union[str, Any]       ,				_lowerCAmelCase      :							Dict=7       ,				_lowerCAmelCase      :							Optional[Any]=3       ,				_lowerCAmelCase      :							Dict=18       ,				_lowerCAmelCase      :							str=30       ,				_lowerCAmelCase      :							Tuple=400       ,				_lowerCAmelCase      :							List[Any]=True       ,				_lowerCAmelCase      :							Tuple=None       ,				_lowerCAmelCase      :							Tuple=True       ,				_lowerCAmelCase      :							List[Any]=None       ,				)		-> str:
  """simple docstring"""







  __lowercase             =  size if size is not None else {"""shortest_edge""": 20}
  __lowercase             =  crop_size if crop_size is not None else {"""height""": 18, """width""": 18}
  __lowercase             =  parent
  __lowercase             =  batch_size
  __lowercase             =  num_channels
  __lowercase             =  image_size
  __lowercase             =  min_resolution
  __lowercase             =  max_resolution
  __lowercase             =  do_resize
  __lowercase             =  size
  __lowercase             =  do_center_crop
  __lowercase             =  crop_size







 def  _a   (  self      :							Dict			)		-> List[str]:
  """simple docstring"""







  return {
      "do_resize": self.do_resize,
      "size": self.size,
      "do_center_crop": self.do_center_crop,
      "crop_size": self.crop_size,
  }


@require_torch
@require_vision
class        __UpperCamelCase    (     _lowerCAmelCase   ,			unittest.TestCase   ):
 __snake_case	:List[Any]   =       MobileNetVaImageProcessor if is_vision_available() else None







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







  __lowercase             =  MobileNetVaImageProcessingTester(self			)







 @property
 def  _a   (  self      :							Tuple			)		-> Optional[int]:
  """simple docstring"""







  return self.image_processor_tester.prepare_image_processor_dict()







 def  _a   (  self      :							Optional[int]			)		-> Any:
  """simple docstring"""







  __lowercase             =  self.image_processing_class(**self.image_processor_dict			)
  self.assertTrue(hasattr(_lowerCAmelCase       ,				"""do_resize"""			)			)
  self.assertTrue(hasattr(_lowerCAmelCase       ,				"""size"""			)			)
  self.assertTrue(hasattr(_lowerCAmelCase       ,				"""do_center_crop"""			)			)
  self.assertTrue(hasattr(_lowerCAmelCase       ,				"""crop_size"""			)			)







 def  _a   (  self      :							int			)		-> int:
  """simple docstring"""







  __lowercase             =  self.image_processing_class.from_dict(self.image_processor_dict			)
  self.assertEqual(image_processor.size       ,				{"""shortest_edge""": 20}			)
  self.assertEqual(image_processor.crop_size       ,				{"""height""": 18, """width""": 18}			)

  __lowercase             =  self.image_processing_class.from_dict(self.image_processor_dict       ,				size=42       ,				crop_size=84			)
  self.assertEqual(image_processor.size       ,				{"""shortest_edge""": 42}			)
  self.assertEqual(image_processor.crop_size       ,				{"""height""": 84, """width""": 84}			)







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







  pass







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







  __lowercase             =  self.image_processing_class(**self.image_processor_dict			)
  # create random PIL images
  __lowercase             =  prepare_image_inputs(self.image_processor_tester       ,				equal_resolution=_lowerCAmelCase			)
  for image in image_inputs:
   self.assertIsInstance(_lowerCAmelCase       ,				Image.Image			)

  # Test not batched input
  __lowercase             =  image_processing(image_inputs[0]       ,				return_tensors="""pt"""			).pixel_values
  self.assertEqual(
      encoded_images.shape       ,				(
          1,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size["""height"""],
          self.image_processor_tester.crop_size["""width"""],
      )       ,				)

  # Test batched
  __lowercase             =  image_processing(_lowerCAmelCase       ,				return_tensors="""pt"""			).pixel_values
  self.assertEqual(
      encoded_images.shape       ,				(
          self.image_processor_tester.batch_size,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size["""height"""],
          self.image_processor_tester.crop_size["""width"""],
      )       ,				)







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







  __lowercase             =  self.image_processing_class(**self.image_processor_dict			)
  # create random numpy tensors
  __lowercase             =  prepare_image_inputs(self.image_processor_tester       ,				equal_resolution=_lowerCAmelCase       ,				numpify=_lowerCAmelCase			)
  for image in image_inputs:
   self.assertIsInstance(_lowerCAmelCase       ,				np.ndarray			)

  # Test not batched input
  __lowercase             =  image_processing(image_inputs[0]       ,				return_tensors="""pt"""			).pixel_values
  self.assertEqual(
      encoded_images.shape       ,				(
          1,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size["""height"""],
          self.image_processor_tester.crop_size["""width"""],
      )       ,				)

  # Test batched
  __lowercase             =  image_processing(_lowerCAmelCase       ,				return_tensors="""pt"""			).pixel_values
  self.assertEqual(
      encoded_images.shape       ,				(
          self.image_processor_tester.batch_size,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size["""height"""],
          self.image_processor_tester.crop_size["""width"""],
      )       ,				)







 def  _a   (  self      :							Optional[Any]			)		-> Dict:
  """simple docstring"""







  __lowercase             =  self.image_processing_class(**self.image_processor_dict			)
  # create random PyTorch tensors
  __lowercase             =  prepare_image_inputs(self.image_processor_tester       ,				equal_resolution=_lowerCAmelCase       ,				torchify=_lowerCAmelCase			)
  for image in image_inputs:
   self.assertIsInstance(_lowerCAmelCase       ,				torch.Tensor			)

  # Test not batched input
  __lowercase             =  image_processing(image_inputs[0]       ,				return_tensors="""pt"""			).pixel_values
  self.assertEqual(
      encoded_images.shape       ,				(
          1,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size["""height"""],
          self.image_processor_tester.crop_size["""width"""],
      )       ,				)

  # Test batched
  __lowercase             =  image_processing(_lowerCAmelCase       ,				return_tensors="""pt"""			).pixel_values
  self.assertEqual(
      encoded_images.shape       ,				(
          self.image_processor_tester.batch_size,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size["""height"""],
          self.image_processor_tester.crop_size["""width"""],
      )       ,				)









import tempfile
import unittest

import numpy as np

from diffusers import (
    DDIMScheduler,
    DPMSolverMultistepScheduler,
    EulerAncestralDiscreteScheduler,
    EulerDiscreteScheduler,
    LMSDiscreteScheduler,
    OnnxStableDiffusionPipeline,
    PNDMScheduler,
)
from diffusers.utils.testing_utils import is_onnx_available, nightly, require_onnxruntime, require_torch_gpu

from ..test_pipelines_onnx_common import OnnxPipelineTesterMixin


if is_onnx_available():
						import onnxruntime as ort


class        __UpperCamelCase    (     _lowerCAmelCase   ,			unittest.TestCase   ):
	__snake_case	:Union[str, Any]   =       'hf-internal-testing/tiny-random-OnnxStableDiffusionPipeline'







	def  _a   (  self      :							Any       ,				_lowerCAmelCase      :							str=0			)		-> str:
		"""simple docstring"""







		__lowercase             =  np.random.RandomState(_lowerCAmelCase			)
		__lowercase             =  {
		    """prompt""": """A painting of a squirrel eating a burger""",
		    """generator""": generator,
		    """num_inference_steps""": 2,
		    """guidance_scale""": 7.5,
		    """output_type""": """numpy""",
		}
		return inputs







	def  _a   (  self      :							int			)		-> List[Any]:
		"""simple docstring"""







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  pipe(**_lowerCAmelCase			).images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 128, 128, 3)
		__lowercase             =  np.array([0.65_072, 0.58_492, 0.48_219, 0.55_521, 0.53_180, 0.55_939, 0.50_697, 0.39_800, 0.46_455]			)

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







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







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		__lowercase             =  PNDMScheduler.from_config(pipe.scheduler.config       ,				skip_prk_steps=_lowerCAmelCase			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  pipe(**_lowerCAmelCase			).images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 128, 128, 3)
		__lowercase             =  np.array([0.65_863, 0.59_425, 0.49_326, 0.56_313, 0.53_875, 0.56_627, 0.51_065, 0.39_777, 0.46_330]			)

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







	def  _a   (  self      :							Optional[int]			)		-> Optional[int]:
		"""simple docstring"""







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		__lowercase             =  LMSDiscreteScheduler.from_config(pipe.scheduler.config			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  pipe(**_lowerCAmelCase			).images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 128, 128, 3)
		__lowercase             =  np.array([0.53_755, 0.60_786, 0.47_402, 0.49_488, 0.51_869, 0.49_819, 0.47_985, 0.38_957, 0.44_279]			)

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







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







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		__lowercase             =  EulerDiscreteScheduler.from_config(pipe.scheduler.config			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  pipe(**_lowerCAmelCase			).images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 128, 128, 3)
		__lowercase             =  np.array([0.53_755, 0.60_786, 0.47_402, 0.49_488, 0.51_869, 0.49_819, 0.47_985, 0.38_957, 0.44_279]			)

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







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







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		__lowercase             =  EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  pipe(**_lowerCAmelCase			).images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 128, 128, 3)
		__lowercase             =  np.array([0.53_817, 0.60_812, 0.47_384, 0.49_530, 0.51_894, 0.49_814, 0.47_984, 0.38_958, 0.44_271]			)

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







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







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		__lowercase             =  DPMSolverMultistepScheduler.from_config(pipe.scheduler.config			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  pipe(**_lowerCAmelCase			).images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 128, 128, 3)
		__lowercase             =  np.array([0.53_895, 0.60_808, 0.47_933, 0.49_608, 0.51_886, 0.49_950, 0.48_053, 0.38_957, 0.44_200]			)

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







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







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  3 * [inputs["""prompt"""]]

		# forward
		__lowercase             =  pipe(**_lowerCAmelCase			)
		__lowercase             =  output.images[0, -3:, -3:, -1]

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  3 * [inputs.pop("""prompt"""			)]

		__lowercase             =  pipe.tokenizer(
		    _lowerCAmelCase       ,				padding="""max_length"""       ,				max_length=pipe.tokenizer.model_max_length       ,				truncation=_lowerCAmelCase       ,				return_tensors="""np"""       ,				)
		__lowercase             =  text_inputs["""input_ids"""]

		__lowercase             =  pipe.text_encoder(input_ids=text_inputs.astype(np.intaa			)			)[0]

		__lowercase             =  prompt_embeds

		# forward
		__lowercase             =  pipe(**_lowerCAmelCase			)
		__lowercase             =  output.images[0, -3:, -3:, -1]

		assert np.abs(image_slice_a.flatten() - image_slice_a.flatten()			).max() < 1e-4







	def  _a   (  self      :							int			)		-> str:
		"""simple docstring"""







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(self.hub_checkpoint       ,				provider="""CPUExecutionProvider"""			)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  3 * ["""this is a negative prompt"""]
		__lowercase             =  negative_prompt
		__lowercase             =  3 * [inputs["""prompt"""]]

		# forward
		__lowercase             =  pipe(**_lowerCAmelCase			)
		__lowercase             =  output.images[0, -3:, -3:, -1]

		__lowercase             =  self.get_dummy_inputs()
		__lowercase             =  3 * [inputs.pop("""prompt"""			)]

		__lowercase             =  []
		for p in [prompt, negative_prompt]:
			__lowercase             =  pipe.tokenizer(
			    _lowerCAmelCase       ,				padding="""max_length"""       ,				max_length=pipe.tokenizer.model_max_length       ,				truncation=_lowerCAmelCase       ,				return_tensors="""np"""       ,				)
			__lowercase             =  text_inputs["""input_ids"""]

			embeds.append(pipe.text_encoder(input_ids=text_inputs.astype(np.intaa			)			)[0]			)

		__lowercase       ,						__lowercase             =  embeds

		# forward
		__lowercase             =  pipe(**_lowerCAmelCase			)
		__lowercase             =  output.images[0, -3:, -3:, -1]

		assert np.abs(image_slice_a.flatten() - image_slice_a.flatten()			).max() < 1e-4


@nightly
@require_onnxruntime
@require_torch_gpu
class        __UpperCamelCase    (     unittest.TestCase   ):







	@property
	def  _a   (  self      :							Dict			)		-> str:
		"""simple docstring"""







		return (
		    "CUDAExecutionProvider",
		    {
		        "gpu_mem_limit": "15000000000",  # 15GB
		        "arena_extend_strategy": "kSameAsRequested",
		    },
		)







	@property
	def  _a   (  self      :							Optional[Any]			)		-> Optional[Any]:
		"""simple docstring"""







		__lowercase             =  ort.SessionOptions()
		__lowercase             =  False
		return options







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







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(
		    """CompVis/stable-diffusion-v1-4"""       ,				revision="""onnx"""       ,				safety_checker=_lowerCAmelCase       ,				feature_extractor=_lowerCAmelCase       ,				provider=self.gpu_provider       ,				sess_options=self.gpu_options       ,				)
		sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  """A painting of a squirrel eating a burger"""
		np.random.seed(0			)
		__lowercase             =  sd_pipe([prompt]       ,				guidance_scale=6.0       ,				num_inference_steps=10       ,				output_type="""np"""			)
		__lowercase             =  output.images

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

		assert image.shape == (1, 512, 512, 3)
		__lowercase             =  np.array([0.0_452, 0.0_390, 0.0_087, 0.0_350, 0.0_617, 0.0_364, 0.0_544, 0.0_523, 0.0_720]			)

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







	def  _a   (  self      :							Tuple			)		-> Any:
		"""simple docstring"""







		__lowercase             =  DDIMScheduler.from_pretrained(
		    """runwayml/stable-diffusion-v1-5"""       ,				subfolder="""scheduler"""       ,				revision="""onnx"""			)
		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(
		    """runwayml/stable-diffusion-v1-5"""       ,				revision="""onnx"""       ,				scheduler=_lowerCAmelCase       ,				safety_checker=_lowerCAmelCase       ,				feature_extractor=_lowerCAmelCase       ,				provider=self.gpu_provider       ,				sess_options=self.gpu_options       ,				)
		sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  """open neural network exchange"""
		__lowercase             =  np.random.RandomState(0			)
		__lowercase             =  sd_pipe([prompt]       ,				guidance_scale=7.5       ,				num_inference_steps=10       ,				generator=_lowerCAmelCase       ,				output_type="""np"""			)
		__lowercase             =  output.images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 512, 512, 3)
		__lowercase             =  np.array([0.2_867, 0.1_974, 0.1_481, 0.7_294, 0.7_251, 0.6_667, 0.4_194, 0.5_642, 0.6_486]			)

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







	def  _a   (  self      :							Dict			)		-> Dict:
		"""simple docstring"""







		__lowercase             =  LMSDiscreteScheduler.from_pretrained(
		    """runwayml/stable-diffusion-v1-5"""       ,				subfolder="""scheduler"""       ,				revision="""onnx"""			)
		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(
		    """runwayml/stable-diffusion-v1-5"""       ,				revision="""onnx"""       ,				scheduler=_lowerCAmelCase       ,				safety_checker=_lowerCAmelCase       ,				feature_extractor=_lowerCAmelCase       ,				provider=self.gpu_provider       ,				sess_options=self.gpu_options       ,				)
		sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  """open neural network exchange"""
		__lowercase             =  np.random.RandomState(0			)
		__lowercase             =  sd_pipe([prompt]       ,				guidance_scale=7.5       ,				num_inference_steps=10       ,				generator=_lowerCAmelCase       ,				output_type="""np"""			)
		__lowercase             =  output.images
		__lowercase             =  image[0, -3:, -3:, -1]

		assert image.shape == (1, 512, 512, 3)
		__lowercase             =  np.array([0.2_306, 0.1_959, 0.1_593, 0.6_549, 0.6_394, 0.5_408, 0.5_065, 0.6_010, 0.6_161]			)

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







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







		__lowercase             =  0

		def test_callback_fn(_lowerCAmelCase      :							int       ,				_lowerCAmelCase      :							int       ,				_lowerCAmelCase      :							np.ndarray			) -> None:
			__lowercase             =  True
			nonlocal number_of_steps
			number_of_steps += 1
			if step == 0:
				assert latents.shape == (1, 4, 64, 64)
				__lowercase             =  latents[0, -3:, -3:, -1]
				__lowercase             =  np.array(
				    [-0.6_772, -0.3_835, -1.2_456, 0.1_905, -1.0_974, 0.6_967, -1.9_353, 0.0_178, 1.0_167]			)

				assert np.abs(latents_slice.flatten() - expected_slice			).max() < 1e-3
			elif step == 5:
				assert latents.shape == (1, 4, 64, 64)
				__lowercase             =  latents[0, -3:, -3:, -1]
				__lowercase             =  np.array(
				    [-0.3_351, 0.2_241, -0.1_837, -0.2_325, -0.6_577, 0.3_393, -0.0_241, 0.5_899, 1.3_875]			)

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

		__lowercase             =  False

		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(
		    """runwayml/stable-diffusion-v1-5"""       ,				revision="""onnx"""       ,				safety_checker=_lowerCAmelCase       ,				feature_extractor=_lowerCAmelCase       ,				provider=self.gpu_provider       ,				sess_options=self.gpu_options       ,				)
		pipe.set_progress_bar_config(disable=_lowerCAmelCase			)

		__lowercase             =  """Andromeda galaxy in a bottle"""

		__lowercase             =  np.random.RandomState(0			)
		pipe(
		    prompt=_lowerCAmelCase       ,				num_inference_steps=5       ,				guidance_scale=7.5       ,				generator=_lowerCAmelCase       ,				callback=_lowerCAmelCase       ,				callback_steps=1       ,				)
		assert test_callback_fn.has_been_called
		assert number_of_steps == 6







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







		__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(
		    """runwayml/stable-diffusion-v1-5"""       ,				revision="""onnx"""       ,				safety_checker=_lowerCAmelCase       ,				feature_extractor=_lowerCAmelCase       ,				provider=self.gpu_provider       ,				sess_options=self.gpu_options       ,				)
		assert isinstance(_lowerCAmelCase       ,				_lowerCAmelCase			)
		assert pipe.safety_checker is None

		__lowercase             =  pipe("""example prompt"""       ,				num_inference_steps=2			).images[0]
		assert image is not None

		# check that there's no error when saving a pipeline with one of the models being None
		with tempfile.TemporaryDirectory() as tmpdirname:
			pipe.save_pretrained(_lowerCAmelCase			)
			__lowercase             =  OnnxStableDiffusionPipeline.from_pretrained(_lowerCAmelCase			)

		# sanity check that the pipeline still works
		assert pipe.safety_checker is None
		__lowercase             =  pipe("""example prompt"""       ,				num_inference_steps=2			).images[0]
		assert image is not None

