"""simple docstring"""





import itertools
import os
import random
import tempfile
import unittest

import numpy as np
from datasets import load_dataset

from transformers import is_speech_available
from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio
from transformers.utils.import_utils import is_torch_available

from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin


if is_speech_available():
				from transformers import WhisperFeatureExtractor

if is_torch_available():
				import torch

__A  =				random.Random()


def    lowercase_   (   _lowerCamelCase:	List[Any]						,   _lowerCamelCase:	Union[str, Any]=1.0						,   _lowerCamelCase:	Dict=None						,   _lowerCamelCase:	Optional[int]=None      ) ->      Optional[Any]:



							'''simple docstring'''

							if rng is None:
														__lowerCamelCase					:		List[str]		   =     global_rng

							__lowerCamelCase					:		Tuple		   =     []
							for batch_idx in range(shape[0]      ):
														values.append([]      )
														for _ in range(shape[1]      ):
																					values[-1].append(rng.random() * scale      )

							return values
@require_torch
@require_torchaudio
class  _snake_case     (					unittest.TestCase		):






						def __init__(       self      :			Any							,					UpperCAmelCase      :			List[str]							,					UpperCAmelCase      :			Optional[int]=7							,					UpperCAmelCase      :			Dict=400							,					UpperCAmelCase      :			Dict=2000							,					UpperCAmelCase      :			List[Any]=10							,					UpperCAmelCase      :			Optional[int]=160							,					UpperCAmelCase      :			Tuple=8							,					UpperCAmelCase      :			Tuple=0.0							,					UpperCAmelCase      :			Optional[Any]=4000							,					UpperCAmelCase      :			str=False							,					UpperCAmelCase      :			Dict=True							,					):
													__lowerCamelCase					:		Optional[Any]		   =     parent
													__lowerCamelCase					:		str		   =     batch_size
													__lowerCamelCase					:		List[Any]		   =     min_seq_length
													__lowerCamelCase					:		Optional[Any]		   =     max_seq_length
													__lowerCamelCase					:		str		   =     (self.max_seq_length - self.min_seq_length) // (self.batch_size - 1)
													__lowerCamelCase					:		str		   =     padding_value
													__lowerCamelCase					:		List[str]		   =     sampling_rate
													__lowerCamelCase					:		str		   =     return_attention_mask
													__lowerCamelCase					:		int		   =     do_normalize
													__lowerCamelCase					:		int		   =     feature_size
													__lowerCamelCase					:		Tuple		   =     chunk_length
													__lowerCamelCase					:		Optional[int]		   =     hop_length






						def       lowerCamelCase__     (       self      :			Optional[int]    ):
													return {
													    "feature_size": self.feature_size,
													    "hop_length": self.hop_length,
													    "chunk_length": self.chunk_length,
													    "padding_value": self.padding_value,
													    "sampling_rate": self.sampling_rate,
													    "return_attention_mask": self.return_attention_mask,
													    "do_normalize": self.do_normalize,
													}







						def       lowerCamelCase__     (       self      :			Optional[int]							,					UpperCAmelCase      :			Optional[int]=False							,					UpperCAmelCase      :			Union[str, Any]=False    ):
													def _flatten(UpperCAmelCase      :			Any    ):
																				return list(itertools.chain(*__lowercase    )    )

													if equal_length:
																				__lowerCamelCase					:		Dict		   =     [floats_list((self.max_seq_length, self.feature_size)    ) for _ in range(self.batch_size    )]
													else:
																				# make sure that inputs increase in size
																				__lowerCamelCase					:		List[str]		   =     [
																				    floats_list((x, self.feature_size)    )
																				    for x in range(self.min_seq_length							,					self.max_seq_length							,					self.seq_length_diff    )
																				]
													if numpify:
																				__lowerCamelCase					:		str		   =     [np.asarray(__lowercase    ) for x in speech_inputs]
													return speech_inputs

@require_torch
@require_torchaudio
class  _snake_case     (					lowercase__				, unittest.TestCase		):
						snake_case__			  =			WhisperFeatureExtractor if is_speech_available() else None






						def       lowerCamelCase__     (       self      :			int    ):
													__lowerCamelCase					:		Dict		   =     WhisperFeatureExtractionTester(self    )






						def       lowerCamelCase__     (       self      :			List[Any]    ):
													__lowerCamelCase					:		str		   =     self.feature_extraction_class(**self.feat_extract_dict    )

													with tempfile.TemporaryDirectory() as tmpdirname:
																				__lowerCamelCase					:		List[Any]		   =     feat_extract_first.save_pretrained(__lowercase    )[0]
																				check_json_file_has_correct_format(__lowercase    )
																				__lowerCamelCase					:		Dict		   =     self.feature_extraction_class.from_pretrained(__lowercase    )

													__lowerCamelCase					:		List[Any]		   =     feat_extract_first.to_dict()
													__lowerCamelCase					:		str		   =     feat_extract_second.to_dict()
													__lowerCamelCase					:		Union[str, Any]		   =     feat_extract_first.mel_filters
													__lowerCamelCase					:		int		   =     feat_extract_second.mel_filters
													self.assertTrue(np.allclose(__lowercase							,					__lowercase    )    )
													self.assertEqual(__lowercase							,					__lowercase    )






						def       lowerCamelCase__     (       self      :			Any    ):
													__lowerCamelCase					:		Optional[Any]		   =     self.feature_extraction_class(**self.feat_extract_dict    )

													with tempfile.TemporaryDirectory() as tmpdirname:
																				__lowerCamelCase					:		List[Any]		   =     os.path.join(__lowercase							,					"feat_extract.json"    )
																				feat_extract_first.to_json_file(__lowercase    )
																				__lowerCamelCase					:		Any		   =     self.feature_extraction_class.from_json_file(__lowercase    )

													__lowerCamelCase					:		Optional[int]		   =     feat_extract_first.to_dict()
													__lowerCamelCase					:		Optional[int]		   =     feat_extract_second.to_dict()
													__lowerCamelCase					:		Dict		   =     feat_extract_first.mel_filters
													__lowerCamelCase					:		Optional[int]		   =     feat_extract_second.mel_filters
													self.assertTrue(np.allclose(__lowercase							,					__lowercase    )    )
													self.assertEqual(__lowercase							,					__lowercase    )






						def       lowerCamelCase__     (       self      :			Optional[Any]    ):
													# Tests that all call wrap to encode_plus and batch_encode_plus
													__lowerCamelCase					:		Any		   =     self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()    )
													# create three inputs of length 800, 1000, and 1200
													__lowerCamelCase					:		int		   =     [floats_list((1, x)    )[0] for x in range(800							,					1400							,					200    )]
													__lowerCamelCase					:		List[Any]		   =     [np.asarray(__lowercase    ) for speech_input in speech_inputs]

													# Test feature size
													__lowerCamelCase					:		str		   =     feature_extractor(__lowercase							,					padding="max_length"							,					return_tensors="np"    ).input_features
													self.assertTrue(input_features.ndim == 3    )
													self.assertTrue(input_features.shape[-1] == feature_extractor.nb_max_frames    )
													self.assertTrue(input_features.shape[-2] == feature_extractor.feature_size    )

													# Test not batched input
													__lowerCamelCase					:		Optional[int]		   =     feature_extractor(speech_inputs[0]							,					return_tensors="np"    ).input_features
													__lowerCamelCase					:		Any		   =     feature_extractor(np_speech_inputs[0]							,					return_tensors="np"    ).input_features
													self.assertTrue(np.allclose(__lowercase							,					__lowercase							,					atol=1E-3    )    )

													# Test batched
													__lowerCamelCase					:		int		   =     feature_extractor(__lowercase							,					return_tensors="np"    ).input_features
													__lowerCamelCase					:		Any		   =     feature_extractor(__lowercase							,					return_tensors="np"    ).input_features
													for enc_seq_a, enc_seq_a in zip(__lowercase							,					__lowercase    ):
																				self.assertTrue(np.allclose(__lowercase							,					__lowercase							,					atol=1E-3    )    )

													# Test 2-D numpy arrays are batched.
													__lowerCamelCase					:		List[Any]		   =     [floats_list((1, x)    )[0] for x in (800, 800, 800)]
													__lowerCamelCase					:		Union[str, Any]		   =     np.asarray(__lowercase    )
													__lowerCamelCase					:		str		   =     feature_extractor(__lowercase							,					return_tensors="np"    ).input_features
													__lowerCamelCase					:		Any		   =     feature_extractor(__lowercase							,					return_tensors="np"    ).input_features
													for enc_seq_a, enc_seq_a in zip(__lowercase							,					__lowercase    ):
																				self.assertTrue(np.allclose(__lowercase							,					__lowercase							,					atol=1E-3    )    )

													# Test truncation required
													__lowerCamelCase					:		List[str]		   =     [floats_list((1, x)    )[0] for x in range(200							,					(feature_extractor.n_samples + 500)							,					200    )]
													__lowerCamelCase					:		Optional[Any]		   =     [np.asarray(__lowercase    ) for speech_input in speech_inputs]

													__lowerCamelCase					:		Dict		   =     [x[: feature_extractor.n_samples] for x in speech_inputs]
													__lowerCamelCase					:		List[str]		   =     [np.asarray(__lowercase    ) for speech_input in speech_inputs_truncated]

													__lowerCamelCase					:		int		   =     feature_extractor(__lowercase							,					return_tensors="np"    ).input_features
													__lowerCamelCase					:		int		   =     feature_extractor(__lowercase							,					return_tensors="np"    ).input_features
													for enc_seq_a, enc_seq_a in zip(__lowercase							,					__lowercase    ):
																				self.assertTrue(np.allclose(__lowercase							,					__lowercase							,					atol=1E-3    )    )






						def       lowerCamelCase__     (       self      :			Dict    ):
													import torch

													__lowerCamelCase					:		List[Any]		   =     self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()    )
													__lowerCamelCase					:		List[Any]		   =     np.random.rand(100							,					32    ).astype(np.floataa    )
													__lowerCamelCase					:		int		   =     np_speech_inputs.tolist()

													for inputs in [py_speech_inputs, np_speech_inputs]:
																				__lowerCamelCase					:		Optional[int]		   =     feature_extractor.pad([{"input_features": inputs}]							,					return_tensors="np"    )
																				self.assertTrue(np_processed.input_features.dtype == np.floataa    )
																				__lowerCamelCase					:		int		   =     feature_extractor.pad([{"input_features": inputs}]							,					return_tensors="pt"    )
																				self.assertTrue(pt_processed.input_features.dtype == torch.floataa    )






						def       lowerCamelCase__     (       self      :			Any							,					UpperCAmelCase      :			Optional[int]    ):
													__lowerCamelCase					:		str		   =     load_dataset("hf-internal-testing/librispeech_asr_dummy"							,					"clean"							,					split="validation"    )
													# automatic decoding with librispeech
													__lowerCamelCase					:		Optional[int]		   =     ds.sort("id"    ).select(range(__lowercase    )    )[:num_samples]["audio"]

													return [x["array"] for x in speech_samples]






						def       lowerCamelCase__     (       self      :			Optional[int]    ):
													# fmt: off
													__lowerCamelCase					:		Tuple		   =     torch.tensor(
													    [
													        0.1_1_9_3, -0.0_9_4_6, -0.1_0_9_8, -0.0_1_9_6, 0.0_2_2_5, -0.0_6_9_0, -0.1_7_3_6, 0.0_9_5_1,
													        0.0_9_7_1, -0.0_8_1_7, -0.0_7_0_2, 0.0_1_6_2, 0.0_2_6_0, 0.0_0_1_7, -0.0_1_9_2, -0.1_6_7_8,
													        0.0_7_0_9, -0.1_8_6_7, -0.0_6_5_5, -0.0_2_7_4, -0.0_2_3_4, -0.1_8_8_4, -0.0_5_1_6, -0.0_5_5_4,
													        -0.0_2_7_4, -0.1_4_2_5, -0.1_4_2_3, 0.0_8_3_7, 0.0_3_7_7, -0.0_8_5_4
													    ]    )
													# fmt: on

													__lowerCamelCase					:		Optional[int]		   =     self._load_datasamples(1    )
													__lowerCamelCase					:		Any		   =     WhisperFeatureExtractor()
													__lowerCamelCase					:		Dict		   =     feature_extractor(__lowercase							,					return_tensors="pt"    ).input_features
													self.assertEqual(input_features.shape							,					(1, 80, 3000)    )
													self.assertTrue(torch.allclose(input_features[0, 0, :30]							,					__lowercase							,					atol=1E-4    )    )







						def       lowerCamelCase__     (       self      :			Any    ):
													__lowerCamelCase					:		Optional[Any]		   =     self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()    )
													__lowerCamelCase					:		List[str]		   =     self._load_datasamples(1    )[0]
													__lowerCamelCase					:		str		   =     ((audio - audio.min()) / (audio.max() - audio.min())) * 65535  # Rescale to [0, 65535] to show issue
													__lowerCamelCase					:		Union[str, Any]		   =     feat_extract.zero_mean_unit_var_norm([audio]							,					attention_mask=__lowercase    )[0]

													self.assertTrue(np.all(np.mean(__lowercase    ) < 1E-3    )    )
													self.assertTrue(np.all(np.abs(np.var(__lowercase    ) - 1    ) < 1E-3    )    )
"""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


__A  =				'''CompVis/stable-diffusion-v1-1'''
__A  =				'''CompVis/stable-diffusion-v1-2'''
__A  =				'''CompVis/stable-diffusion-v1-3'''
__A  =				'''CompVis/stable-diffusion-v1-4'''
class  _snake_case     (					a__		):






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

													__lowerCamelCase					:		Optional[int]		   =     StableDiffusionPipeline.from_pretrained(UpperCAmelCase    )
													__lowerCamelCase					:		Optional[int]		   =     StableDiffusionPipeline.from_pretrained(UpperCAmelCase    )
													__lowerCamelCase					:		Tuple		   =     StableDiffusionPipeline.from_pretrained(UpperCAmelCase    )
													__lowerCamelCase					:		List[str]		   =     StableDiffusionPipeline(
													    vae=UpperCAmelCase							,					text_encoder=UpperCAmelCase							,					tokenizer=UpperCAmelCase							,					unet=UpperCAmelCase							,					scheduler=UpperCAmelCase							,					safety_checker=UpperCAmelCase							,					feature_extractor=UpperCAmelCase							,					requires_safety_checker=UpperCAmelCase							,					)

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






						@property
						def       lowerCamelCase__     (       self      :			Dict    ):
													return {k: getattr(self							,					UpperCAmelCase    ) for k in self.config.keys() if not k.startswith("_"    )}






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






						def       lowerCamelCase__     (       self      :			Tuple    ):
													self.enable_attention_slicing(UpperCAmelCase    )






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






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






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






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







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

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

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

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

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

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