






'''simple docstring'''

import gc
import unittest

from transformers import CTRLConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
 import torch

 from transformers import (
     CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
     CTRLForSequenceClassification,
     CTRLLMHeadModel,
     CTRLModel,
 )






class     a_						:

  def __init__(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE=14      ,		_SCREAMING_SNAKE_CASE=7      ,		_SCREAMING_SNAKE_CASE=True      ,		_SCREAMING_SNAKE_CASE=True      ,		_SCREAMING_SNAKE_CASE=True      ,		_SCREAMING_SNAKE_CASE=True      ,		_SCREAMING_SNAKE_CASE=True      ,		_SCREAMING_SNAKE_CASE=99      ,		_SCREAMING_SNAKE_CASE=32      ,		_SCREAMING_SNAKE_CASE=5      ,		_SCREAMING_SNAKE_CASE=4      ,		_SCREAMING_SNAKE_CASE=37      ,		_SCREAMING_SNAKE_CASE="gelu"      ,		_SCREAMING_SNAKE_CASE=0.1      ,		_SCREAMING_SNAKE_CASE=0.1      ,		_SCREAMING_SNAKE_CASE=512      ,		_SCREAMING_SNAKE_CASE=16      ,		_SCREAMING_SNAKE_CASE=2      ,		_SCREAMING_SNAKE_CASE=0.0_2      ,		_SCREAMING_SNAKE_CASE=3      ,		_SCREAMING_SNAKE_CASE=4      ,		_SCREAMING_SNAKE_CASE=None      ,		)  ->				List[str]:



        """simple docstring"""






        UpperCamelCase      = parent
        UpperCamelCase      = batch_size
        UpperCamelCase      = seq_length
        UpperCamelCase      = is_training
        UpperCamelCase      = use_token_type_ids
        UpperCamelCase      = use_input_mask
        UpperCamelCase      = use_labels
        UpperCamelCase      = use_mc_token_ids
        UpperCamelCase      = vocab_size
        UpperCamelCase      = hidden_size
        UpperCamelCase      = num_hidden_layers
        UpperCamelCase      = num_attention_heads
        UpperCamelCase      = intermediate_size
        UpperCamelCase      = hidden_act
        UpperCamelCase      = hidden_dropout_prob
        UpperCamelCase      = attention_probs_dropout_prob
        UpperCamelCase      = max_position_embeddings
        UpperCamelCase      = type_vocab_size
        UpperCamelCase      = type_sequence_label_size
        UpperCamelCase      = initializer_range
        UpperCamelCase      = num_labels
        UpperCamelCase      = num_choices
        UpperCamelCase      = scope
        UpperCamelCase      = self.vocab_size - 1

  def   A__						(				self				)  ->				str:



        """simple docstring"""






        UpperCamelCase      = ids_tensor([self.batch_size, self.seq_length]      ,		self.vocab_size				)

        UpperCamelCase      = None
        if self.use_input_mask:
              UpperCamelCase      = random_attention_mask([self.batch_size, self.seq_length]				)

        UpperCamelCase      = None
        if self.use_token_type_ids:
              UpperCamelCase      = ids_tensor([self.batch_size, self.seq_length]      ,		self.type_vocab_size				)

        UpperCamelCase      = None
        if self.use_mc_token_ids:
              UpperCamelCase      = ids_tensor([self.batch_size, self.num_choices]      ,		self.seq_length				)

        UpperCamelCase      = None
        UpperCamelCase      = None
        UpperCamelCase      = None
        if self.use_labels:
              UpperCamelCase      = ids_tensor([self.batch_size]      ,		self.type_sequence_label_size				)
              UpperCamelCase      = ids_tensor([self.batch_size, self.seq_length]      ,		self.num_labels				)
              UpperCamelCase      = ids_tensor([self.batch_size]      ,		self.num_choices				)

        UpperCamelCase      = self.get_config()

        UpperCamelCase      = ids_tensor([self.num_hidden_layers, self.num_attention_heads]      ,		2				)

        return (
            config,
            input_ids,
            input_mask,
            head_mask,
            token_type_ids,
            mc_token_ids,
            sequence_labels,
            token_labels,
            choice_labels,
        )

  def   A__						(				self				)  ->				int:



        """simple docstring"""






        return CTRLConfig(
            vocab_size=self.vocab_size      ,		n_embd=self.hidden_size      ,		n_layer=self.num_hidden_layers      ,		n_head=self.num_attention_heads      ,		n_positions=self.max_position_embeddings      ,		pad_token_id=self.pad_token_id      ,		)

  def   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		*_SCREAMING_SNAKE_CASE				)  ->				Any:



        """simple docstring"""






        UpperCamelCase      = CTRLModel(config=SCREAMING_SNAKE_CASE_				)
        model.to(SCREAMING_SNAKE_CASE_				)
        model.eval()

        model(SCREAMING_SNAKE_CASE_      ,		token_type_ids=SCREAMING_SNAKE_CASE_      ,		head_mask=SCREAMING_SNAKE_CASE_				)
        model(SCREAMING_SNAKE_CASE_      ,		token_type_ids=SCREAMING_SNAKE_CASE_				)
        UpperCamelCase      = model(SCREAMING_SNAKE_CASE_				)
        self.parent.assertEqual(result.last_hidden_state.shape      ,		(self.batch_size, self.seq_length, self.hidden_size)				)
        self.parent.assertEqual(len(result.past_key_values				)      ,		config.n_layer				)

  def   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		*_SCREAMING_SNAKE_CASE				)  ->				Tuple:



        """simple docstring"""






        UpperCamelCase      = CTRLLMHeadModel(SCREAMING_SNAKE_CASE_				)
        model.to(SCREAMING_SNAKE_CASE_				)
        model.eval()

        UpperCamelCase      = model(SCREAMING_SNAKE_CASE_      ,		token_type_ids=SCREAMING_SNAKE_CASE_      ,		labels=SCREAMING_SNAKE_CASE_				)
        self.parent.assertEqual(result.loss.shape      ,		()				)
        self.parent.assertEqual(result.logits.shape      ,		(self.batch_size, self.seq_length, self.vocab_size)				)

  def   A__						(				self				)  ->				Dict:



        """simple docstring"""






        UpperCamelCase      = self.prepare_config_and_inputs()

        (
            UpperCamelCase							
        )      = config_and_inputs

        UpperCamelCase      = {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """head_mask""": head_mask}

        return config, inputs_dict


  def   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		*_SCREAMING_SNAKE_CASE				)  ->				Union[str, Any]:



        """simple docstring"""






        UpperCamelCase      = self.num_labels
        UpperCamelCase      = CTRLForSequenceClassification(SCREAMING_SNAKE_CASE_				)
        model.to(SCREAMING_SNAKE_CASE_				)
        model.eval()
        UpperCamelCase      = ids_tensor([self.batch_size]      ,		self.type_sequence_label_size				)
        UpperCamelCase      = model(SCREAMING_SNAKE_CASE_      ,		token_type_ids=SCREAMING_SNAKE_CASE_      ,		labels=SCREAMING_SNAKE_CASE_				)
        self.parent.assertEqual(result.logits.shape      ,		(self.batch_size, self.num_labels)				)






@require_torch
class     a_						(      _UpperCAmelCase     ,	_UpperCAmelCase     ,	_UpperCAmelCase     ,	unittest.TestCase    ):
  lowercase							=				(CTRLModel, CTRLLMHeadModel, CTRLForSequenceClassification) if is_torch_available() else ()
  lowercase							=				(CTRLLMHeadModel,) if is_torch_available() else ()
  lowercase							=				(
      {
          'feature-extraction': CTRLModel,
          'text-classification': CTRLForSequenceClassification,
          'text-generation': CTRLLMHeadModel,
          'zero-shot': CTRLForSequenceClassification,
      }
      if is_torch_available()
      else {}
  )
  lowercase							=				True
  lowercase							=				False
  lowercase							=				False

  def   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE				)  ->				Dict:



        """simple docstring"""






        if pipeline_test_casse_name == "ZeroShotClassificationPipelineTests":
              # Get `tokenizer does not have a padding token` error for both fast/slow tokenizers.
              # `CTRLConfig` was never used in pipeline tests, either because of a missing checkpoint or because a tiny
              # config could not be created.
              return True

        return False

  def   A__						(				self				)  ->				Dict:



        """simple docstring"""






        UpperCamelCase      = CTRLModelTester(self				)
        UpperCamelCase      = ConfigTester(self      ,		config_class=SCREAMING_SNAKE_CASE_      ,		n_embd=37				)

  def   A__						(				self				)  ->				Any:



        """simple docstring"""






        super().tearDown()
        # clean-up as much as possible GPU memory occupied by PyTorch
        gc.collect()
        torch.cuda.empty_cache()

  def   A__						(				self				)  ->				Tuple:



        """simple docstring"""






        self.config_tester.run_common_tests()

  def   A__						(				self				)  ->				List[Any]:



        """simple docstring"""






        UpperCamelCase      = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_ctrl_model(*SCREAMING_SNAKE_CASE_				)

  def   A__						(				self				)  ->				Optional[int]:



        """simple docstring"""






        UpperCamelCase      = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_lm_head_model(*SCREAMING_SNAKE_CASE_				)

  @unittest.skip("""Will be fixed soon by reducing the size of the model used for common tests."""				)
  def   A__						(				self				)  ->				Dict:



        """simple docstring"""






        pass

  @slow
  def   A__						(				self				)  ->				List[Any]:



        """simple docstring"""






        for model_name in CTRL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              UpperCamelCase      = CTRLModel.from_pretrained(SCREAMING_SNAKE_CASE_				)
              self.assertIsNotNone(SCREAMING_SNAKE_CASE_				)


  @unittest.skip("""The model doesn't support left padding"""				)  # and it's not used enough to be worth fixing :)
  def   A__						(				self				)  ->				List[str]:



        """simple docstring"""






        pass






@require_torch
class     a_						(      unittest.TestCase    ):

  def   A__						(				self				)  ->				Optional[int]:



        """simple docstring"""






        super().tearDown()
        # clean-up as much as possible GPU memory occupied by PyTorch
        gc.collect()
        torch.cuda.empty_cache()


  @slow
  def   A__						(				self				)  ->				str:



        """simple docstring"""






        UpperCamelCase      = CTRLLMHeadModel.from_pretrained("""ctrl"""				)
        model.to(SCREAMING_SNAKE_CASE_				)
        UpperCamelCase      = torch.tensor(
            [[11859, 0, 1611, 8]]      ,		dtype=torch.long      ,		device=SCREAMING_SNAKE_CASE_				)  # Legal the president is
        UpperCamelCase      = [
            11859,
            0,
            1611,
            8,
            5,
            150,
            26449,
            2,
            19,
            348,
            469,
            3,
            2595,
            48,
            20740,
            246533,
            246533,
            19,
            30,
            5,
        ]  # Legal the president is a good guy and I don't want to lose my job. \n \n I have a

        UpperCamelCase      = model.generate(SCREAMING_SNAKE_CASE_      ,		do_sample=SCREAMING_SNAKE_CASE_				)
        self.assertListEqual(output_ids[0].tolist()      ,		SCREAMING_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__     =       'CompVis/stable-diffusion-v1-1'
SCREAMING_SNAKE_CASE__     =       'CompVis/stable-diffusion-v1-2'
SCREAMING_SNAKE_CASE__     =       'CompVis/stable-diffusion-v1-3'
SCREAMING_SNAKE_CASE__     =       'CompVis/stable-diffusion-v1-4'






class     a_						(      lowerCamelCase    ):

  def __init__(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE = True      ,		)  ->				int:



        """simple docstring"""






        super()._init_()

        UpperCamelCase      = StableDiffusionPipeline.from_pretrained(_SCREAMING_SNAKE_CASE				)
        UpperCamelCase      = StableDiffusionPipeline.from_pretrained(_SCREAMING_SNAKE_CASE				)
        UpperCamelCase      = StableDiffusionPipeline.from_pretrained(_SCREAMING_SNAKE_CASE				)
        UpperCamelCase      = 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   A__						(				self				)  ->				Dict[str, Any]:



        """simple docstring"""






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

  def   A__						(				self      ,		_SCREAMING_SNAKE_CASE = "auto"				)  ->				Any:



        """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(_SCREAMING_SNAKE_CASE				)

  def   A__						(				self				)  ->				Optional[int]:



        """simple docstring"""






        self.enable_attention_slicing(_SCREAMING_SNAKE_CASE				)

  @torch.no_grad()
  def   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 50      ,		_SCREAMING_SNAKE_CASE = 7.5      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		_SCREAMING_SNAKE_CASE = 0.0      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = "pil"      ,		_SCREAMING_SNAKE_CASE = True      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		**_SCREAMING_SNAKE_CASE      ,		)  ->				List[Any]:



        """simple docstring"""






        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   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 50      ,		_SCREAMING_SNAKE_CASE = 7.5      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		_SCREAMING_SNAKE_CASE = 0.0      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = "pil"      ,		_SCREAMING_SNAKE_CASE = True      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		**_SCREAMING_SNAKE_CASE      ,		)  ->				str:



        """simple docstring"""






        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   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 50      ,		_SCREAMING_SNAKE_CASE = 7.5      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		_SCREAMING_SNAKE_CASE = 0.0      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = "pil"      ,		_SCREAMING_SNAKE_CASE = True      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		**_SCREAMING_SNAKE_CASE      ,		)  ->				Optional[Any]:



        """simple docstring"""






        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   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 50      ,		_SCREAMING_SNAKE_CASE = 7.5      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		_SCREAMING_SNAKE_CASE = 0.0      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = "pil"      ,		_SCREAMING_SNAKE_CASE = True      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		**_SCREAMING_SNAKE_CASE      ,		)  ->				Union[str, Any]:



        """simple docstring"""






        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   A__						(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 512      ,		_SCREAMING_SNAKE_CASE = 50      ,		_SCREAMING_SNAKE_CASE = 7.5      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		_SCREAMING_SNAKE_CASE = 0.0      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = "pil"      ,		_SCREAMING_SNAKE_CASE = True      ,		_SCREAMING_SNAKE_CASE = None      ,		_SCREAMING_SNAKE_CASE = 1      ,		**_SCREAMING_SNAKE_CASE      ,		)  ->				int:



        """simple docstring"""






        UpperCamelCase      = """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
        UpperCamelCase      = 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
        UpperCamelCase      = 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
        UpperCamelCase      = 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
        UpperCamelCase      = 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]]				)
