

import json
import os
from functools import lru_cache
from typing import TYPE_CHECKING, List, Optional, Tuple

import regex as re

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


if TYPE_CHECKING:
				from transformers.pipelines.conversational import Conversation

_a:    Union[str, Any] 							=			logging.get_logger(__name__)


_a:    Optional[int] 							=			{
    """vocab_file""": """vocab.json""",
    """merges_file""": """merges.txt""",
    """tokenizer_config_file""": """tokenizer_config.json""",
}

_a:    List[Any] 							=			{
    """vocab_file""": {"""facebook/blenderbot-3B""": """https://huggingface.co/facebook/blenderbot-3B/resolve/main/vocab.json"""},
    """merges_file""": {"""facebook/blenderbot-3B""": """https://huggingface.co/facebook/blenderbot-3B/resolve/main/merges.txt"""},
    """tokenizer_config_file""": {
        """facebook/blenderbot-3B""": """https://huggingface.co/facebook/blenderbot-3B/resolve/main/tokenizer_config.json"""
    },
}

_a:    List[str] 							=			{"""facebook/blenderbot-3B""": 128}



@lru_cache()
# Copied from transformers.models.roberta.tokenization_roberta.bytes_to_unicode
def       __lowerCAmelCase      (						):
	UpperCAmelCase_       				=			(
	    list(range(ord("!"    )       ,     ord("~"    ) + 1    )    ) + list(range(ord("¡"    )       ,     ord("¬"    ) + 1    )    ) + list(range(ord("®"    )       ,     ord("ÿ"    ) + 1    )    )
	)
	UpperCAmelCase_       				=			bs[:]
	UpperCAmelCase_       				=			0
	for b in range(2**8    ):
		if b not in bs:
			bs.append(_lowerCamelCase    )
			cs.append(2**8 + n    )
			n += 1
	UpperCAmelCase_       				=			[chr(_lowerCamelCase    ) for n in cs]
	return dict(zip(_lowerCamelCase       ,     _lowerCamelCase    )    )



def       __lowerCAmelCase      (						A    ):
	UpperCAmelCase_       				=			set()
	UpperCAmelCase_       				=			word[0]
	for char in word[1:]:
		pairs.add((prev_char, char)    )
		UpperCAmelCase_       				=			char
	return pairs




class 						__UpperCamelCase    (					a__						):
	SCREAMING_SNAKE_CASE__    				=     VOCAB_FILES_NAMES
	SCREAMING_SNAKE_CASE__    				=     PRETRAINED_VOCAB_FILES_MAP
	SCREAMING_SNAKE_CASE__    				=     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	SCREAMING_SNAKE_CASE__    				=     ['input_ids', 'attention_mask']




	def __init__(		self	:						List[str]		,	lowerCAmelCase	:						int		,	lowerCAmelCase	:						Dict		,	lowerCAmelCase	:						Optional[Any]="replace"		,	lowerCAmelCase	:						Any="<s>"		,	lowerCAmelCase	:						List[Any]="</s>"		,	lowerCAmelCase	:						str="</s>"		,	lowerCAmelCase	:						Optional[int]="<s>"		,	lowerCAmelCase	:						Optional[Any]="<unk>"		,	lowerCAmelCase	:						Union[str, Any]="<pad>"		,	lowerCAmelCase	:						Dict="<mask>"		,	lowerCAmelCase	:						Any=False		,	**lowerCAmelCase	:						Union[str, Any]		,	):


		'''simple docstring'''







		UpperCAmelCase_       				=			AddedToken(_A		,	lstrip=_A		,	rstrip=_A							) if isinstance(_A		,	_A							) else bos_token
		UpperCAmelCase_       				=			AddedToken(_A		,	lstrip=_A		,	rstrip=_A							) if isinstance(_A		,	_A							) else eos_token
		UpperCAmelCase_       				=			AddedToken(_A		,	lstrip=_A		,	rstrip=_A							) if isinstance(_A		,	_A							) else sep_token
		UpperCAmelCase_       				=			AddedToken(_A		,	lstrip=_A		,	rstrip=_A							) if isinstance(_A		,	_A							) else cls_token
		UpperCAmelCase_       				=			AddedToken(_A		,	lstrip=_A		,	rstrip=_A							) if isinstance(_A		,	_A							) else unk_token
		UpperCAmelCase_       				=			AddedToken(_A		,	lstrip=_A		,	rstrip=_A							) if isinstance(_A		,	_A							) else pad_token

		# Mask token behave like a normal word, i.e. include the space before it
		UpperCAmelCase_       				=			AddedToken(_A		,	lstrip=_A		,	rstrip=_A							) if isinstance(_A		,	_A							) else mask_token

		super().__init__(
		    errors=_A		,	bos_token=_A		,	eos_token=_A		,	unk_token=_A		,	sep_token=_A		,	cls_token=_A		,	pad_token=_A		,	mask_token=_A		,	add_prefix_space=_A		,	**_A		,	)

		with open(_A		,	encoding="utf-8"							) as vocab_handle:
			UpperCAmelCase_       				=			json.load(_A							)
		UpperCAmelCase_       				=			{v: k for k, v in self.encoder.items()}
		UpperCAmelCase_       				=			errors  # how to handle errors in decoding
		UpperCAmelCase_       				=			bytes_to_unicode()
		UpperCAmelCase_       				=			{v: k for k, v in self.byte_encoder.items()}
		with open(_A		,	encoding="utf-8"							) as merges_handle:
			UpperCAmelCase_       				=			merges_handle.read().split("\n"							)[1:-1]
		UpperCAmelCase_       				=			[tuple(merge.split()							) for merge in bpe_merges]
		UpperCAmelCase_       				=			dict(zip(_A		,	range(len(_A							)							)							)							)
		UpperCAmelCase_       				=			{}
		UpperCAmelCase_       				=			add_prefix_space

		# Should have added re.IGNORECASE so BPE merges can happen for capitalized versions of contractions
		UpperCAmelCase_       				=			re.compile(R"\'s|\'t|\'re|\'ve|\'m|\'ll|\'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+"							)




	@property
	# Copied from transformers.models.roberta.tokenization_roberta.RobertaTokenizer.vocab_size with Roberta->Blenderbot, RoBERTa->Blenderbot
	def       __A					(		self	:						List[Any]							):


		'''simple docstring'''







		return len(self.encoder							)




	def       __A					(		self	:						str							):


		'''simple docstring'''







		return dict(self.encoder		,	**self.added_tokens_encoder							)




	def       __A					(		self	:						List[Any]		,	lowerCAmelCase	:						Optional[int]							):


		'''simple docstring'''







		if token in self.cache:
			return self.cache[token]
		UpperCAmelCase_       				=			tuple(_A							)
		UpperCAmelCase_       				=			get_pairs(_A							)

		if not pairs:
			return token

		while True:
			UpperCAmelCase_       				=			min(_A		,	key=lambda lowerCAmelCase							: self.bpe_ranks.get(_A		,	float("inf"							)							)							)
			if bigram not in self.bpe_ranks:
				break
			UpperCAmelCase_       				=			bigram
			UpperCAmelCase_       				=			[]
			UpperCAmelCase_       				=			0
			while i < len(_A							):
				try:
					UpperCAmelCase_       				=			word.index(_A		,	_A							)
				except ValueError:
					new_word.extend(word[i:]							)
					break
				else:
					new_word.extend(word[i:j]							)
					UpperCAmelCase_       				=			j

				if word[i] == first and i < len(_A							) - 1 and word[i + 1] == second:
					new_word.append(first + second							)
					i += 2
				else:
					new_word.append(word[i]							)
					i += 1
			UpperCAmelCase_       				=			tuple(_A							)
			UpperCAmelCase_       				=			new_word
			if len(_A							) == 1:
				break
			else:
				UpperCAmelCase_       				=			get_pairs(_A							)
		UpperCAmelCase_       				=			' '.join(_A							)
		UpperCAmelCase_       				=			word
		return word




	def       __A					(		self	:						Optional[Any]		,	lowerCAmelCase	:						str							):


		'''simple docstring'''







		UpperCAmelCase_       				=			[]
		for token in re.findall(self.pat		,	_A							):
			UpperCAmelCase_       				=			''.join(
			    self.byte_encoder[b] for b in token.encode("utf-8"							)							)  # Maps all our bytes to unicode strings, avoiding control tokens of the BPE (spaces in our case)
			bpe_tokens.extend(bpe_token for bpe_token in self.bpe(_A							).split(" "							)							)
		return bpe_tokens




	def       __A					(		self	:						int		,	lowerCAmelCase	:						Optional[Any]							):


		'''simple docstring'''







		return self.encoder.get(_A		,	self.encoder.get(self.unk_token							)							)




	def       __A					(		self	:						List[Any]		,	lowerCAmelCase	:						List[str]							):


		'''simple docstring'''







		return self.decoder.get(_A							)




	def       __A					(		self	:						Any		,	lowerCAmelCase	:						str							):


		'''simple docstring'''







		UpperCAmelCase_       				=			''.join(_A							)
		UpperCAmelCase_       				=			bytearray([self.byte_decoder[c] for c in text]							).decode("utf-8"		,	errors=self.errors							)
		return text




	def       __A					(		self	:						Union[str, Any]		,	lowerCAmelCase	:						Union[str, Any]		,	lowerCAmelCase	:						Optional[int] = None							):


		'''simple docstring'''







		if not os.path.isdir(_A							):
			logger.error(F"Vocabulary path ({save_directory}) should be a directory"							)
			return
		UpperCAmelCase_       				=			os.path.join(
		    _A		,	(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]							)
		UpperCAmelCase_       				=			os.path.join(
		    _A		,	(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["merges_file"]							)

		with open(_A		,	"w"		,	encoding="utf-8"							) as f:
			f.write(json.dumps(self.encoder		,	indent=2		,	sort_keys=_A		,	ensure_ascii=_A							) + "\n"							)

		UpperCAmelCase_       				=			0
		with open(_A		,	"w"		,	encoding="utf-8"							) as writer:
			writer.write("#version: 0.2\n"							)
			for bpe_tokens, token_index in sorted(self.bpe_ranks.items()		,	key=lambda lowerCAmelCase							: kv[1]							):
				if index != token_index:
					logger.warning(
					    F"Saving vocabulary to {merge_file}: BPE merge indices are not consecutive."
					    " Please check that the tokenizer is not corrupted!"							)
					UpperCAmelCase_       				=			token_index
				writer.write(" ".join(_A							) + "\n"							)
				index += 1

		return vocab_file, merge_file




	def       __A					(		self	:						Dict		,	lowerCAmelCase	:						List[Any]		,	lowerCAmelCase	:						int = None		,	lowerCAmelCase	:						List[Any] = False							):


		'''simple docstring'''







		if already_has_special_tokens:
			return super().get_special_tokens_mask(
			    token_ids_a=_A		,	token_ids_a=_A		,	already_has_special_tokens=_A							)

		if token_ids_a is None:
			return [1] + ([0] * len(_A							)) + [1]
		return [1] + ([0] * len(_A							)) + [1, 1] + ([0] * len(_A							)) + [1]




	def       __A					(		self	:						Tuple		,	lowerCAmelCase	:						List[str]		,	lowerCAmelCase	:						List[Any] = None							):


		'''simple docstring'''







		UpperCAmelCase_       				=			[self.sep_token_id]
		UpperCAmelCase_       				=			[self.cls_token_id]

		if token_ids_a is None:
			return len(cls + token_ids_a + sep							) * [0]
		return len(cls + token_ids_a + sep + sep + token_ids_a + sep							) * [0]




	def       __A					(		self	:						Any		,	lowerCAmelCase	:						int		,	lowerCAmelCase	:						Tuple=False		,	**lowerCAmelCase	:						Optional[int]							):


		'''simple docstring'''







		UpperCAmelCase_       				=			kwargs.pop("add_prefix_space"		,	self.add_prefix_space							)
		if (is_split_into_words or add_prefix_space) and (len(_A							) > 0 and not text[0].isspace()):
			UpperCAmelCase_       				=			' ' + text
		return (text, kwargs)




	def       __A					(		self	:						str		,	lowerCAmelCase	:						int		,	lowerCAmelCase	:						Dict = None							):


		'''simple docstring'''







		return token_ids_a + [self.eos_token_id]




	def       __A					(		self	:						Dict		,	lowerCAmelCase	:						int							):


		'''simple docstring'''







		UpperCAmelCase_       				=			[]
		for is_user, text in conversation.iter_texts():
			if is_user:
				# We need to space prefix as it's being done within blenderbot
				inputs.append(" " + text							)
			else:
				# Generated responses should contain them already.
				inputs.append(_A							)

		UpperCAmelCase_       				=			'  '.join(_A							)
		UpperCAmelCase_       				=			self.encode(_A							)
		if len(_A							) > self.model_max_length:
			UpperCAmelCase_       				=			input_ids[-self.model_max_length :]
			logger.warning(F"Trimmed input from conversation as it was longer than {self.model_max_length} tokens."							)
		return input_ids


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:    Optional[int] 							=			"""CompVis/stable-diffusion-v1-1"""
_a:    Dict 							=			"""CompVis/stable-diffusion-v1-2"""
_a:    Optional[Any] 							=			"""CompVis/stable-diffusion-v1-3"""
_a:    str 							=			"""CompVis/stable-diffusion-v1-4"""

class 						__UpperCamelCase    (					lowercase						):




	def __init__(		self	:						Union[str, Any]		,	lowerCAmelCase	:						AutoencoderKL		,	lowerCAmelCase	:						CLIPTextModel		,	lowerCAmelCase	:						CLIPTokenizer		,	lowerCAmelCase	:						UNetaDConditionModel		,	lowerCAmelCase	:						Union[DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler]		,	lowerCAmelCase	:						StableDiffusionSafetyChecker		,	lowerCAmelCase	:						CLIPImageProcessor		,	lowerCAmelCase	:						bool = True		,	):


		'''simple docstring'''







		super()._init_()

		UpperCAmelCase_       				=			StableDiffusionPipeline.from_pretrained(lowerCAmelCase							)
		UpperCAmelCase_       				=			StableDiffusionPipeline.from_pretrained(lowerCAmelCase							)
		UpperCAmelCase_       				=			StableDiffusionPipeline.from_pretrained(lowerCAmelCase							)
		UpperCAmelCase_       				=			StableDiffusionPipeline(
		    vae=lowerCAmelCase		,	text_encoder=lowerCAmelCase		,	tokenizer=lowerCAmelCase		,	unet=lowerCAmelCase		,	scheduler=lowerCAmelCase		,	safety_checker=lowerCAmelCase		,	feature_extractor=lowerCAmelCase		,	requires_safety_checker=lowerCAmelCase		,	)

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




	@property
	def       __A					(		self	:						Tuple							):


		'''simple docstring'''







		return {k: getattr(self		,	lowerCAmelCase							) for k in self.config.keys() if not k.startswith("_"							)}




	def       __A					(		self	:						Dict		,	lowerCAmelCase	:						Optional[Union[str, int]] = "auto"							):


		'''simple docstring'''







		if slice_size == "auto":
			# half the attention head size is usually a good trade-off between
			# speed and memory
			UpperCAmelCase_       				=			self.unet.config.attention_head_dim // 2
		self.unet.set_attention_slice(lowerCAmelCase							)




	def       __A					(		self	:						int							):


		'''simple docstring'''







		self.enable_attention_slicing(lowerCAmelCase							)




	@torch.no_grad()
	def       __A					(		self	:						Union[str, Any]		,	lowerCAmelCase	:						Union[str, List[str]]		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 50		,	lowerCAmelCase	:						float = 7.5		,	lowerCAmelCase	:						Optional[Union[str, List[str]]] = None		,	lowerCAmelCase	:						Optional[int] = 1		,	lowerCAmelCase	:						float = 0.0		,	lowerCAmelCase	:						Optional[torch.Generator] = None		,	lowerCAmelCase	:						Optional[torch.FloatTensor] = None		,	lowerCAmelCase	:						Optional[str] = "pil"		,	lowerCAmelCase	:						bool = True		,	lowerCAmelCase	:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None		,	lowerCAmelCase	:						int = 1		,	**lowerCAmelCase	:						Tuple		,	):


		'''simple docstring'''







		return self.pipea(
		    prompt=lowerCAmelCase		,	height=lowerCAmelCase		,	width=lowerCAmelCase		,	num_inference_steps=lowerCAmelCase		,	guidance_scale=lowerCAmelCase		,	negative_prompt=lowerCAmelCase		,	num_images_per_prompt=lowerCAmelCase		,	eta=lowerCAmelCase		,	generator=lowerCAmelCase		,	latents=lowerCAmelCase		,	output_type=lowerCAmelCase		,	return_dict=lowerCAmelCase		,	callback=lowerCAmelCase		,	callback_steps=lowerCAmelCase		,	**lowerCAmelCase		,	)




	@torch.no_grad()
	def       __A					(		self	:						Dict		,	lowerCAmelCase	:						Union[str, List[str]]		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 50		,	lowerCAmelCase	:						float = 7.5		,	lowerCAmelCase	:						Optional[Union[str, List[str]]] = None		,	lowerCAmelCase	:						Optional[int] = 1		,	lowerCAmelCase	:						float = 0.0		,	lowerCAmelCase	:						Optional[torch.Generator] = None		,	lowerCAmelCase	:						Optional[torch.FloatTensor] = None		,	lowerCAmelCase	:						Optional[str] = "pil"		,	lowerCAmelCase	:						bool = True		,	lowerCAmelCase	:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None		,	lowerCAmelCase	:						int = 1		,	**lowerCAmelCase	:						List[Any]		,	):


		'''simple docstring'''







		return self.pipea(
		    prompt=lowerCAmelCase		,	height=lowerCAmelCase		,	width=lowerCAmelCase		,	num_inference_steps=lowerCAmelCase		,	guidance_scale=lowerCAmelCase		,	negative_prompt=lowerCAmelCase		,	num_images_per_prompt=lowerCAmelCase		,	eta=lowerCAmelCase		,	generator=lowerCAmelCase		,	latents=lowerCAmelCase		,	output_type=lowerCAmelCase		,	return_dict=lowerCAmelCase		,	callback=lowerCAmelCase		,	callback_steps=lowerCAmelCase		,	**lowerCAmelCase		,	)




	@torch.no_grad()
	def       __A					(		self	:						List[str]		,	lowerCAmelCase	:						Union[str, List[str]]		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 50		,	lowerCAmelCase	:						float = 7.5		,	lowerCAmelCase	:						Optional[Union[str, List[str]]] = None		,	lowerCAmelCase	:						Optional[int] = 1		,	lowerCAmelCase	:						float = 0.0		,	lowerCAmelCase	:						Optional[torch.Generator] = None		,	lowerCAmelCase	:						Optional[torch.FloatTensor] = None		,	lowerCAmelCase	:						Optional[str] = "pil"		,	lowerCAmelCase	:						bool = True		,	lowerCAmelCase	:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None		,	lowerCAmelCase	:						int = 1		,	**lowerCAmelCase	:						Union[str, Any]		,	):


		'''simple docstring'''







		return self.pipea(
		    prompt=lowerCAmelCase		,	height=lowerCAmelCase		,	width=lowerCAmelCase		,	num_inference_steps=lowerCAmelCase		,	guidance_scale=lowerCAmelCase		,	negative_prompt=lowerCAmelCase		,	num_images_per_prompt=lowerCAmelCase		,	eta=lowerCAmelCase		,	generator=lowerCAmelCase		,	latents=lowerCAmelCase		,	output_type=lowerCAmelCase		,	return_dict=lowerCAmelCase		,	callback=lowerCAmelCase		,	callback_steps=lowerCAmelCase		,	**lowerCAmelCase		,	)




	@torch.no_grad()
	def       __A					(		self	:						Dict		,	lowerCAmelCase	:						Union[str, List[str]]		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 50		,	lowerCAmelCase	:						float = 7.5		,	lowerCAmelCase	:						Optional[Union[str, List[str]]] = None		,	lowerCAmelCase	:						Optional[int] = 1		,	lowerCAmelCase	:						float = 0.0		,	lowerCAmelCase	:						Optional[torch.Generator] = None		,	lowerCAmelCase	:						Optional[torch.FloatTensor] = None		,	lowerCAmelCase	:						Optional[str] = "pil"		,	lowerCAmelCase	:						bool = True		,	lowerCAmelCase	:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None		,	lowerCAmelCase	:						int = 1		,	**lowerCAmelCase	:						Optional[Any]		,	):


		'''simple docstring'''







		return self.pipea(
		    prompt=lowerCAmelCase		,	height=lowerCAmelCase		,	width=lowerCAmelCase		,	num_inference_steps=lowerCAmelCase		,	guidance_scale=lowerCAmelCase		,	negative_prompt=lowerCAmelCase		,	num_images_per_prompt=lowerCAmelCase		,	eta=lowerCAmelCase		,	generator=lowerCAmelCase		,	latents=lowerCAmelCase		,	output_type=lowerCAmelCase		,	return_dict=lowerCAmelCase		,	callback=lowerCAmelCase		,	callback_steps=lowerCAmelCase		,	**lowerCAmelCase		,	)




	@torch.no_grad()
	def       __A					(		self	:						Union[str, Any]		,	lowerCAmelCase	:						Union[str, List[str]]		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 512		,	lowerCAmelCase	:						int = 50		,	lowerCAmelCase	:						float = 7.5		,	lowerCAmelCase	:						Optional[Union[str, List[str]]] = None		,	lowerCAmelCase	:						Optional[int] = 1		,	lowerCAmelCase	:						float = 0.0		,	lowerCAmelCase	:						Optional[torch.Generator] = None		,	lowerCAmelCase	:						Optional[torch.FloatTensor] = None		,	lowerCAmelCase	:						Optional[str] = "pil"		,	lowerCAmelCase	:						bool = True		,	lowerCAmelCase	:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None		,	lowerCAmelCase	:						int = 1		,	**lowerCAmelCase	:						Union[str, Any]		,	):


		'''simple docstring'''







		UpperCAmelCase_       				=			"cuda" if torch.cuda.is_available() else "cpu"
		self.to(lowerCAmelCase							)

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

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

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

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

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