
from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    is_valid_image,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
   import PIL


__lowerCamelCase							=       logging.get_logger(__name__)


def 			UpperCamelCase					(    __lowerCamelCase     : int    ):
       if isinstance(__lowerCamelCase				,					(list, tuple)    ) and isinstance(videos[0]				,					(list, tuple)    ) and is_valid_image(videos[0][0]    ):
              return videos

       elif isinstance(__lowerCamelCase				,					(list, tuple)    ) and is_valid_image(videos[0]    ):
              return [videos]

       elif is_valid_image(__lowerCamelCase    ):
              return [[videos]]

       raise ValueError(f"""Could not make batched video from {videos}"""    )






class   UpperCAmelCase		(						A_ ):
   A__					:		int						     =     ["pixel_values"]



   def __init__(self		:					Any    ,						snake_case__		:					bool = True    ,						snake_case__		:					Dict[str, int] = None    ,						snake_case__		:					PILImageResampling = PILImageResampling.BILINEAR    ,						snake_case__		:					bool = True    ,						snake_case__		:					Dict[str, int] = None    ,						snake_case__		:					bool = True    ,						snake_case__		:					Union[int, float] = 1 / 2_55    ,						snake_case__		:					bool = True    ,						snake_case__		:					Optional[Union[float, List[float]]] = None    ,						snake_case__		:					Optional[Union[float, List[float]]] = None    ,						**snake_case__		:					int    ,						)		->	None:


          '''simple docstring'''


          super().__init__(**snake_case__ )
          snake_case       :   Dict							=      size if size is not None else {"shortest_edge": 2_24}
          snake_case       :   Optional[Any]							=      get_size_dict(snake_case__    ,						default_to_square=snake_case__ )
          snake_case       :   Optional[Any]							=      crop_size if crop_size is not None else {"height": 2_24, "width": 2_24}
          snake_case       :   str							=      get_size_dict(snake_case__    ,						param_name="crop_size" )

          snake_case       :   Any							=      do_resize
          snake_case       :   Optional[Any]							=      size
          snake_case       :   Tuple							=      do_center_crop
          snake_case       :   Dict							=      crop_size
          snake_case       :   Tuple							=      resample
          snake_case       :   Dict							=      do_rescale
          snake_case       :   Any							=      rescale_factor
          snake_case       :   Optional[int]							=      do_normalize
          snake_case       :   List[str]							=      image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
          snake_case       :   List[str]							=      image_std if image_std is not None else IMAGENET_STANDARD_STD



   def 				_SCREAMING_SNAKE_CASE   (self		:					Tuple    ,						snake_case__		:					np.ndarray    ,						snake_case__		:					Dict[str, int]    ,						snake_case__		:					PILImageResampling = PILImageResampling.BILINEAR    ,						snake_case__		:					Optional[Union[str, ChannelDimension]] = None    ,						**snake_case__		:					Union[str, Any]    ,						)		->	np.ndarray:


          '''simple docstring'''


          snake_case       :   Optional[int]							=      get_size_dict(snake_case__    ,						default_to_square=snake_case__ )
          if "shortest_edge" in size:
                 snake_case       :   Union[str, Any]							=      get_resize_output_image_size(snake_case__    ,						size["shortest_edge"]    ,						default_to_square=snake_case__ )
          elif "height" in size and "width" in size:
                 snake_case       :   Optional[int]							=      (size["height"], size["width"])
          else:
                 raise ValueError(f"""Size must have 'height' and 'width' or 'shortest_edge' as keys. Got {size.keys()}""" )
          return resize(snake_case__    ,						size=snake_case__    ,						resample=snake_case__    ,						data_format=snake_case__    ,						**snake_case__ )



   def 				_SCREAMING_SNAKE_CASE   (self		:					Tuple    ,						snake_case__		:					np.ndarray    ,						snake_case__		:					Dict[str, int]    ,						snake_case__		:					Optional[Union[str, ChannelDimension]] = None    ,						**snake_case__		:					Any    ,						)		->	np.ndarray:


          '''simple docstring'''


          snake_case       :   Optional[Any]							=      get_size_dict(snake_case__ )
          if "height" not in size or "width" not in size:
                 raise ValueError(f"""Size must have 'height' and 'width' as keys. Got {size.keys()}""" )
          return center_crop(snake_case__    ,						size=(size["height"], size["width"])    ,						data_format=snake_case__    ,						**snake_case__ )



   def 				_SCREAMING_SNAKE_CASE   (self		:					int    ,						snake_case__		:					np.ndarray    ,						snake_case__		:					Union[int, float]    ,						snake_case__		:					Optional[Union[str, ChannelDimension]] = None    ,						**snake_case__		:					List[str]    ,						)		->	List[str]:


          '''simple docstring'''


          return rescale(snake_case__    ,						scale=snake_case__    ,						data_format=snake_case__    ,						**snake_case__ )



   def 				_SCREAMING_SNAKE_CASE   (self		:					Optional[Any]    ,						snake_case__		:					np.ndarray    ,						snake_case__		:					Union[float, List[float]]    ,						snake_case__		:					Union[float, List[float]]    ,						snake_case__		:					Optional[Union[str, ChannelDimension]] = None    ,						**snake_case__		:					List[str]    ,						)		->	np.ndarray:


          '''simple docstring'''


          return normalize(snake_case__    ,						mean=snake_case__    ,						std=snake_case__    ,						data_format=snake_case__    ,						**snake_case__ )



   def 				_SCREAMING_SNAKE_CASE   (self		:					Optional[Any]    ,						snake_case__		:					ImageInput    ,						snake_case__		:					bool = None    ,						snake_case__		:					Dict[str, int] = None    ,						snake_case__		:					PILImageResampling = None    ,						snake_case__		:					bool = None    ,						snake_case__		:					Dict[str, int] = None    ,						snake_case__		:					bool = None    ,						snake_case__		:					float = None    ,						snake_case__		:					bool = None    ,						snake_case__		:					Optional[Union[float, List[float]]] = None    ,						snake_case__		:					Optional[Union[float, List[float]]] = None    ,						snake_case__		:					Optional[ChannelDimension] = ChannelDimension.FIRST    ,						)		->	np.ndarray:


          '''simple docstring'''


          if do_resize and size is None or resample is None:
                 raise ValueError("Size and resample must be specified if do_resize is True." )

          if do_center_crop and crop_size is None:
                 raise ValueError("Crop size must be specified if do_center_crop is True." )

          if do_rescale and rescale_factor is None:
                 raise ValueError("Rescale factor must be specified if do_rescale is True." )

          if do_normalize and (image_mean is None or image_std is None):
                 raise ValueError("Image mean and std must be specified if do_normalize is True." )

          # All transformations expect numpy arrays.
          snake_case       :   List[Any]							=      to_numpy_array(snake_case__ )

          if do_resize:
                 snake_case       :   int							=      self.resize(image=snake_case__    ,						size=snake_case__    ,						resample=snake_case__ )

          if do_center_crop:
                 snake_case       :   List[str]							=      self.center_crop(snake_case__    ,						size=snake_case__ )

          if do_rescale:
                 snake_case       :   int							=      self.rescale(image=snake_case__    ,						scale=snake_case__ )

          if do_normalize:
                 snake_case       :   Union[str, Any]							=      self.normalize(image=snake_case__    ,						mean=snake_case__    ,						std=snake_case__ )

          snake_case       :   List[str]							=      to_channel_dimension_format(snake_case__    ,						snake_case__ )
          return image



   def 				_SCREAMING_SNAKE_CASE   (self		:					Dict    ,						snake_case__		:					ImageInput    ,						snake_case__		:					bool = None    ,						snake_case__		:					Dict[str, int] = None    ,						snake_case__		:					PILImageResampling = None    ,						snake_case__		:					bool = None    ,						snake_case__		:					Dict[str, int] = None    ,						snake_case__		:					bool = None    ,						snake_case__		:					float = None    ,						snake_case__		:					bool = None    ,						snake_case__		:					Optional[Union[float, List[float]]] = None    ,						snake_case__		:					Optional[Union[float, List[float]]] = None    ,						snake_case__		:					Optional[Union[str, TensorType]] = None    ,						snake_case__		:					ChannelDimension = ChannelDimension.FIRST    ,						**snake_case__		:					List[Any]    ,						)		->	PIL.Image.Image:


          '''simple docstring'''


          snake_case       :   Union[str, Any]							=      do_resize if do_resize is not None else self.do_resize
          snake_case       :   Union[str, Any]							=      resample if resample is not None else self.resample
          snake_case       :   List[str]							=      do_center_crop if do_center_crop is not None else self.do_center_crop
          snake_case       :   Dict							=      do_rescale if do_rescale is not None else self.do_rescale
          snake_case       :   List[Any]							=      rescale_factor if rescale_factor is not None else self.rescale_factor
          snake_case       :   Any							=      do_normalize if do_normalize is not None else self.do_normalize
          snake_case       :   Tuple							=      image_mean if image_mean is not None else self.image_mean
          snake_case       :   Tuple							=      image_std if image_std is not None else self.image_std

          snake_case       :   Dict							=      size if size is not None else self.size
          snake_case       :   Any							=      get_size_dict(snake_case__    ,						default_to_square=snake_case__ )
          snake_case       :   Union[str, Any]							=      crop_size if crop_size is not None else self.crop_size
          snake_case       :   List[Any]							=      get_size_dict(snake_case__    ,						param_name="crop_size" )

          if not valid_images(snake_case__ ):
                 raise ValueError(
                     "Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
                     "torch.Tensor, tf.Tensor or jax.ndarray." )

          snake_case       :   Tuple							=      make_batched(snake_case__ )

          snake_case       :   Optional[Any]							=      [
              [
                  self._preprocess_image(
                      image=snake_case__    ,						do_resize=snake_case__    ,						size=snake_case__    ,						resample=snake_case__    ,						do_center_crop=snake_case__    ,						crop_size=snake_case__    ,						do_rescale=snake_case__    ,						rescale_factor=snake_case__    ,						do_normalize=snake_case__    ,						image_mean=snake_case__    ,						image_std=snake_case__    ,						data_format=snake_case__    ,						)
                  for img in video
              ]
              for video in videos
          ]

          snake_case       :   List[str]							=      {"pixel_values": videos}
          return BatchFeature(data=snake_case__    ,						tensor_type=snake_case__ )













"""simple docstring"""





from typing import Any, Callable, Dict, List, Optional, Union

import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    DiffusionPipeline,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionPipeline,
    UNetaDConditionModel,
)
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker


_SCREAMING_SNAKE_CASE					:				Union[str, Any]					    =						'''CompVis/stable-diffusion-v1-1'''
_SCREAMING_SNAKE_CASE					:				Optional[Any]					    =						'''CompVis/stable-diffusion-v1-2'''
_SCREAMING_SNAKE_CASE					:				int					    =						'''CompVis/stable-diffusion-v1-3'''
_SCREAMING_SNAKE_CASE					:				str					    =						'''CompVis/stable-diffusion-v1-4'''






class      a						(					__snake_case		):






    def __init__(       self     :							int       ,						__SCREAMING_SNAKE_CASE     :							AutoencoderKL       ,						__SCREAMING_SNAKE_CASE     :							CLIPTextModel       ,						__SCREAMING_SNAKE_CASE     :							CLIPTokenizer       ,						__SCREAMING_SNAKE_CASE     :							UNetaDConditionModel       ,						__SCREAMING_SNAKE_CASE     :							Union[DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler]       ,						__SCREAMING_SNAKE_CASE     :							StableDiffusionSafetyChecker       ,						__SCREAMING_SNAKE_CASE     :							CLIPImageProcessor       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						)     ->		List[str]:
      super()._init_()

      lowerCamelCase_         =						StableDiffusionPipeline.from_pretrained(__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						StableDiffusionPipeline.from_pretrained(__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						StableDiffusionPipeline.from_pretrained(__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						StableDiffusionPipeline(
          vae=__SCREAMING_SNAKE_CASE       ,						text_encoder=__SCREAMING_SNAKE_CASE       ,						tokenizer=__SCREAMING_SNAKE_CASE       ,						unet=__SCREAMING_SNAKE_CASE       ,						scheduler=__SCREAMING_SNAKE_CASE       ,						safety_checker=__SCREAMING_SNAKE_CASE       ,						feature_extractor=__SCREAMING_SNAKE_CASE       ,						requires_safety_checker=__SCREAMING_SNAKE_CASE       ,						)

      self.register_modules(pipelinea=self.pipea       ,						pipelinea=self.pipea       ,						pipelinea=self.pipea       ,						pipelinea=self.pipea					)






    @property
    def    UpperCamelCase       (       self     :							List[str]					)     ->		Dict[str, Any]:
      return {k: getattr(self       ,						__SCREAMING_SNAKE_CASE					) for k in self.config.keys() if not k.startswith('_'					)}






    def    UpperCamelCase       (       self     :							int       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, int]] = "auto"					)     ->		Any:
      if slice_size == "auto":
        # half the attention head size is usually a good trade-off between
        # speed and memory
        lowerCamelCase_         =						self.unet.config.attention_head_dim // 2
      self.unet.set_attention_slice(__SCREAMING_SNAKE_CASE					)






    def    UpperCamelCase       (       self     :							Any					)     ->		List[Any]:
      self.enable_attention_slicing(__SCREAMING_SNAKE_CASE					)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Any       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							int       ,						)     ->		Tuple:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							List[str]       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							List[str]       ,						)     ->		Optional[int]:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Optional[Any]       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							Optional[int]       ,						)     ->		Tuple:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Tuple       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							Tuple       ,						)     ->		Tuple:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Dict       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							int       ,						)     ->		str:
      lowerCamelCase_         =						'cuda' if torch.cuda.is_available() else 'cpu'
      self.to(__SCREAMING_SNAKE_CASE					)

      # Checks if the height and width are divisible by 8 or not
      if height % 8 != 0 or width % 8 != 0:
        raise ValueError(F'''`height` and `width` must be divisible by 8 but are {height} and {width}.'''					)

      # Get first result from Stable Diffusion Checkpoint v1.1
      lowerCamelCase_         =						self.textaimg_sda_a(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)

      # Get first result from Stable Diffusion Checkpoint v1.2
      lowerCamelCase_         =						self.textaimg_sda_a(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)

      # Get first result from Stable Diffusion Checkpoint v1.3
      lowerCamelCase_         =						self.textaimg_sda_a(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)

      # Get first result from Stable Diffusion Checkpoint v1.4
      lowerCamelCase_         =						self.textaimg_sda_a(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)

      # Get all result images into a single list and pass it via StableDiffusionPipelineOutput for final result
      return StableDiffusionPipelineOutput([resa[0], resa[0], resa[0], resa[0]]					)




