





"""simple docstring"""


import inspect
import unittest

from transformers import DPTConfig
from transformers.file_utils import is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch
  from torch import nn

  from transformers import MODEL_MAPPING, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTModel
  from transformers.models.dpt.modeling_dpt import DPT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
  from PIL import Image

  from transformers import DPTImageProcessor



class   __SCREAMING_SNAKE_CASE     :







  '''simple docstring'''


  def __init__(		self :							Union[str, Any]       , __a :							Dict       , __a :							str=2       , __a :							int=32       , __a :							Optional[int]=16       , __a :							List[str]=3       , __a :							Dict=True       , __a :							List[str]=True       , __a :							Union[str, Any]=32       , __a :							Optional[int]=4       , __a :							int=[0, 1, 2, 3]       , __a :							Union[str, Any]=4       , __a :							List[Any]=37       , __a :							Optional[Any]="gelu"       , __a :							Dict=0.1       , __a :							Any=0.1       , __a :							Optional[Any]=0.02       , __a :							Optional[int]=3       , __a :							int=[1, 384, 24, 24]       , __a :							Optional[Any]=True       , __a :							int=None       , )		->					Tuple:
        _UpperCamelCase   :						int    =							parent
        _UpperCamelCase   :						Optional[int]    =							batch_size
        _UpperCamelCase   :						Union[str, Any]    =							image_size
        _UpperCamelCase   :						Dict    =							patch_size
        _UpperCamelCase   :						Optional[Any]    =							num_channels
        _UpperCamelCase   :						int    =							is_training
        _UpperCamelCase   :						int    =							use_labels
        _UpperCamelCase   :						Optional[Any]    =							hidden_size
        _UpperCamelCase   :						str    =							num_hidden_layers
        _UpperCamelCase   :						Dict    =							backbone_out_indices
        _UpperCamelCase   :						List[str]    =							num_attention_heads
        _UpperCamelCase   :						Dict    =							intermediate_size
        _UpperCamelCase   :						int    =							hidden_act
        _UpperCamelCase   :						List[Any]    =							hidden_dropout_prob
        _UpperCamelCase   :						Optional[Any]    =							attention_probs_dropout_prob
        _UpperCamelCase   :						Union[str, Any]    =							initializer_range
        _UpperCamelCase   :						int    =							num_labels
        _UpperCamelCase   :						List[str]    =							backbone_featmap_shape
        _UpperCamelCase   :						str    =							scope
        _UpperCamelCase   :						Any    =							is_hybrid
        # sequence length of DPT = num_patches + 1 (we add 1 for the [CLS] token)
        _UpperCamelCase   :						List[str]    =							(image_size // patch_size) ** 2
        _UpperCamelCase   :						List[Any]    =							num_patches + 1

  def  __SCREAMING_SNAKE_CASE					(		self :							List[str]						)		->					Tuple:
        _UpperCamelCase   :						List[str]    =							floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)

        _UpperCamelCase   :						Any    =							None
        if self.use_labels:
              _UpperCamelCase   :						str    =							ids_tensor([self.batch_size, self.image_size, self.image_size]       , self.num_labels						)

        _UpperCamelCase   :						List[Any]    =							self.get_config()

        return config, pixel_values, labels

  def  __SCREAMING_SNAKE_CASE					(		self :							Dict						)		->					Optional[int]:
        _UpperCamelCase   :						List[str]    =							{
            "global_padding": "same",
            "layer_type": "bottleneck",
            "depths": [3, 4, 9],
            "out_features": ["stage1", "stage2", "stage3"],
            "embedding_dynamic_padding": True,
            "hidden_sizes": [96, 192, 384, 768],
            "num_groups": 2,
        }

        return DPTConfig(
            image_size=self.image_size       , patch_size=self.patch_size       , num_channels=self.num_channels       , hidden_size=self.hidden_size       , num_hidden_layers=self.num_hidden_layers       , backbone_out_indices=self.backbone_out_indices       , 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       , is_decoder=__a       , initializer_range=self.initializer_range       , is_hybrid=self.is_hybrid       , backbone_config=__a       , backbone_featmap_shape=self.backbone_featmap_shape       , )

  def  __SCREAMING_SNAKE_CASE					(		self :							Any       , __a :							Dict       , __a :							str       , __a :							Tuple						)		->					Union[str, Any]:
        _UpperCamelCase   :						Optional[int]    =							DPTModel(config=__a						)
        model.to(__a						)
        model.eval()
        _UpperCamelCase   :						Tuple    =							model(__a						)
        self.parent.assertEqual(result.last_hidden_state.shape       , (self.batch_size, self.seq_length, self.hidden_size)						)

  def  __SCREAMING_SNAKE_CASE					(		self :							Optional[Any]       , __a :							Tuple       , __a :							Optional[int]       , __a :							Tuple						)		->					Optional[int]:
        _UpperCamelCase   :						int    =							self.num_labels
        _UpperCamelCase   :						int    =							DPTForDepthEstimation(__a						)
        model.to(__a						)
        model.eval()
        _UpperCamelCase   :						Optional[int]    =							model(__a						)
        self.parent.assertEqual(result.predicted_depth.shape       , (self.batch_size, self.image_size, self.image_size)						)

  def  __SCREAMING_SNAKE_CASE					(		self :							Optional[Any]       , __a :							int       , __a :							str       , __a :							Dict						)		->					int:
        _UpperCamelCase   :						List[Any]    =							self.num_labels
        _UpperCamelCase   :						Dict    =							DPTForSemanticSegmentation(__a						)
        model.to(__a						)
        model.eval()
        _UpperCamelCase   :						str    =							model(__a       , labels=__a						)
        self.parent.assertEqual(
            result.logits.shape       , (self.batch_size, self.num_labels, self.image_size, self.image_size)						)


  def  __SCREAMING_SNAKE_CASE					(		self :							List[str]						)		->					List[str]:
        _UpperCamelCase   :						Tuple    =							self.prepare_config_and_inputs()
        _UpperCamelCase,	_UpperCamelCase,	_UpperCamelCase   :						List[Any]    =							config_and_inputs
        _UpperCamelCase   :						Any    =							{"pixel_values": pixel_values}
        return config, inputs_dict





@require_torch
class   __SCREAMING_SNAKE_CASE     (    _UpperCamelCase		,	_UpperCamelCase		,	unittest.TestCase ):







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__				:Union[str, Any]						  =       (DPTModel, DPTForDepthEstimation, DPTForSemanticSegmentation) if is_torch_available() else ()
  SCREAMING_SNAKE_CASE__				:str						  =       (
      {
          "depth-estimation": DPTForDepthEstimation,
          "feature-extraction": DPTModel,
          "image-segmentation": DPTForSemanticSegmentation,
      }
      if is_torch_available()
      else {}
  )

  SCREAMING_SNAKE_CASE__				:List[str]						  =       False
  SCREAMING_SNAKE_CASE__				:Any						  =       False
  SCREAMING_SNAKE_CASE__				:int						  =       False

  def  __SCREAMING_SNAKE_CASE					(		self :							str						)		->					Optional[int]:
        _UpperCamelCase   :						str    =							DPTModelTester(self						)
        _UpperCamelCase   :						Optional[int]    =							ConfigTester(self       , config_class=__a       , has_text_modality=__a       , hidden_size=37						)

  def  __SCREAMING_SNAKE_CASE					(		self :							str						)		->					Optional[int]:
        self.config_tester.run_common_tests()

  @unittest.skip(reason="DPT does not use inputs_embeds"						)
  def  __SCREAMING_SNAKE_CASE					(		self :							Tuple						)		->					Any:
        pass

  def  __SCREAMING_SNAKE_CASE					(		self :							Optional[int]						)		->					str:
        _UpperCamelCase,	_UpperCamelCase   :						int    =							self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
              _UpperCamelCase   :						List[str]    =							model_class(__a						)
              self.assertIsInstance(model.get_input_embeddings()       , (nn.Module)						)
              _UpperCamelCase   :						Any    =							model.get_output_embeddings()
              self.assertTrue(x is None or isinstance(__a       , nn.Linear						)						)

  def  __SCREAMING_SNAKE_CASE					(		self :							Union[str, Any]						)		->					List[str]:
        _UpperCamelCase,	_UpperCamelCase   :						List[Any]    =							self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
              _UpperCamelCase   :						str    =							model_class(__a						)
              _UpperCamelCase   :						Union[str, Any]    =							inspect.signature(model.forward						)
              # signature.parameters is an OrderedDict => so arg_names order is deterministic
              _UpperCamelCase   :						List[Any]    =							[*signature.parameters.keys()]

              _UpperCamelCase   :						int    =							["pixel_values"]
              self.assertListEqual(arg_names[:1]       , __a						)

  def  __SCREAMING_SNAKE_CASE					(		self :							Optional[Any]						)		->					List[str]:
        _UpperCamelCase   :						List[Any]    =							self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_model(*__a						)

  def  __SCREAMING_SNAKE_CASE					(		self :							List[str]						)		->					Optional[int]:
        _UpperCamelCase   :						Dict    =							self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_depth_estimation(*__a						)

  def  __SCREAMING_SNAKE_CASE					(		self :							Any						)		->					Dict:
        _UpperCamelCase   :						Dict    =							self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_semantic_segmentation(*__a						)

  def  __SCREAMING_SNAKE_CASE					(		self :							Optional[int]						)		->					Optional[Any]:
        for model_class in self.all_model_classes:
              if model_class.__name__ == "DPTForDepthEstimation":
                    continue

              _UpperCamelCase,	_UpperCamelCase   :						str    =							self.model_tester.prepare_config_and_inputs_for_common()
              _UpperCamelCase   :						int    =							True

              if model_class in get_values(__a						):
                    continue

              _UpperCamelCase   :						Union[str, Any]    =							model_class(__a						)
              model.to(__a						)
              model.train()
              _UpperCamelCase   :						int    =							self._prepare_for_class(__a       , __a       , return_labels=__a						)
              _UpperCamelCase   :						Optional[int]    =							model(**__a						).loss
              loss.backward()

  def  __SCREAMING_SNAKE_CASE					(		self :							List[Any]						)		->					List[str]:
        for model_class in self.all_model_classes:
              if model_class.__name__ == "DPTForDepthEstimation":
                    continue

              _UpperCamelCase,	_UpperCamelCase   :						Optional[int]    =							self.model_tester.prepare_config_and_inputs_for_common()
              _UpperCamelCase   :						Dict    =							False
              _UpperCamelCase   :						Dict    =							True

              if model_class in get_values(__a						) or not model_class.supports_gradient_checkpointing:
                    continue
              _UpperCamelCase   :						Optional[int]    =							model_class(__a						)
              model.to(__a						)
              model.gradient_checkpointing_enable()
              model.train()
              _UpperCamelCase   :						Tuple    =							self._prepare_for_class(__a       , __a       , return_labels=__a						)
              _UpperCamelCase   :						Optional[Any]    =							model(**__a						).loss
              loss.backward()

  def  __SCREAMING_SNAKE_CASE					(		self :							List[Any]						)		->					Optional[int]:
        _UpperCamelCase,	_UpperCamelCase   :						Optional[Any]    =							self.model_tester.prepare_config_and_inputs_for_common()

        _UpperCamelCase   :						Tuple    =							_config_zero_init(__a						)
        for model_class in self.all_model_classes:
              _UpperCamelCase   :						int    =							model_class(config=__a						)
              # Skip the check for the backbone
              _UpperCamelCase   :						int    =							[]
              for name, module in model.named_modules():
                    if module.__class__.__name__ == "DPTViTHybridEmbeddings":
                          _UpperCamelCase   :						Optional[Any]    =							[F'''{name}.{key}''' for key in module.state_dict().keys()]
                          break

              for name, param in model.named_parameters():
                    if param.requires_grad:
                          if name in backbone_params:
                                continue
                          self.assertIn(
                              ((param.data.mean() * 1e9).round() / 1e9).item()       , [0.0, 1.0]       , msg=F'''Parameter {name} of model {model_class} seems not properly initialized'''       , )

  @unittest.skip("Will be fixed soon by reducing the size of the model used for common tests."						)
  def  __SCREAMING_SNAKE_CASE					(		self :							Tuple						)		->					Optional[Any]:
        pass

  @slow
  def  __SCREAMING_SNAKE_CASE					(		self :							int						)		->					List[str]:
        for model_name in DPT_PRETRAINED_MODEL_ARCHIVE_LIST[1:]:
              _UpperCamelCase   :						Optional[Any]    =							DPTModel.from_pretrained(__a						)
              self.assertIsNotNone(__a						)


  def  __SCREAMING_SNAKE_CASE					(		self :							Dict						)		->					str:
        # We do this test only for DPTForDepthEstimation since it is the only model that uses readout_type
        _UpperCamelCase,	_UpperCamelCase   :						int    =							self.model_tester.prepare_config_and_inputs_for_common()
        _UpperCamelCase   :						Optional[Any]    =							"add"
        with self.assertRaises(__a						):
              _UpperCamelCase   :						str    =							DPTForDepthEstimation(__a						)





def        lowercase__     (       )       ->		Optional[int]:




      """simple docstring"""

      _UpperCamelCase   :						Optional[Any]    =							Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"      )
      return image



@require_torch
@require_vision
@slow
class   __SCREAMING_SNAKE_CASE     (    unittest.TestCase ):







  '''simple docstring'''


  def  __SCREAMING_SNAKE_CASE					(		self :							str						)		->					Tuple:
        _UpperCamelCase   :						List[Any]    =							DPTImageProcessor.from_pretrained("Intel/dpt-hybrid-midas"						)
        _UpperCamelCase   :						Optional[int]    =							DPTForDepthEstimation.from_pretrained("Intel/dpt-hybrid-midas"						).to(__a						)

        _UpperCamelCase   :						List[Any]    =							prepare_img()
        _UpperCamelCase   :						Dict    =							image_processor(images=__a       , return_tensors="pt"						).to(__a						)

        # forward pass
        with torch.no_grad():
              _UpperCamelCase   :						Optional[Any]    =							model(**__a						)
              _UpperCamelCase   :						int    =							outputs.predicted_depth

        # verify the predicted depth
        _UpperCamelCase   :						Tuple    =							torch.Size((1, 384, 384)						)
        self.assertEqual(predicted_depth.shape       , __a						)

        _UpperCamelCase   :						Optional[int]    =							torch.tensor(
            [[[5.64_37, 5.61_46, 5.65_11], [5.43_71, 5.56_49, 5.59_58], [5.52_15, 5.51_84, 5.52_93]]]						).to(__a						)

        self.assertTrue(torch.allclose(outputs.predicted_depth[:3, :3, :3] / 100       , __a       , atol=1e-4						)						)







"""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


lowerCamelCase__						= "CompVis/stable-diffusion-v1-1"
lowerCamelCase__						= "CompVis/stable-diffusion-v1-2"
lowerCamelCase__						= "CompVis/stable-diffusion-v1-3"
lowerCamelCase__						= "CompVis/stable-diffusion-v1-4"



class   __SCREAMING_SNAKE_CASE     (    _UpperCamelCase ):







  '''simple docstring'''


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

        _UpperCamelCase   :						Optional[int]    =							StableDiffusionPipeline.from_pretrained(__a						)
        _UpperCamelCase   :						int    =							StableDiffusionPipeline.from_pretrained(__a						)
        _UpperCamelCase   :						List[Any]    =							StableDiffusionPipeline.from_pretrained(__a						)
        _UpperCamelCase   :						int    =							StableDiffusionPipeline(
            vae=__a       , text_encoder=__a       , tokenizer=__a       , unet=__a       , scheduler=__a       , safety_checker=__a       , feature_extractor=__a       , requires_safety_checker=__a       , )

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

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

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

  def  __SCREAMING_SNAKE_CASE					(		self :							str						)		->					Any:
        self.enable_attention_slicing(__a						)

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

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

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

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


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

        # 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
        _UpperCamelCase   :						List[str]    =							self.textaimg_sda_a(
            prompt=__a       , height=__a       , width=__a       , num_inference_steps=__a       , guidance_scale=__a       , negative_prompt=__a       , num_images_per_prompt=__a       , eta=__a       , generator=__a       , latents=__a       , output_type=__a       , return_dict=__a       , callback=__a       , callback_steps=__a       , **__a       , )

        # Get first result from Stable Diffusion Checkpoint v1.2
        _UpperCamelCase   :						Optional[Any]    =							self.textaimg_sda_a(
            prompt=__a       , height=__a       , width=__a       , num_inference_steps=__a       , guidance_scale=__a       , negative_prompt=__a       , num_images_per_prompt=__a       , eta=__a       , generator=__a       , latents=__a       , output_type=__a       , return_dict=__a       , callback=__a       , callback_steps=__a       , **__a       , )

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

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

        # 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]]						)
