






'''simple docstring'''

import argparse
from pathlib import Path
from typing import Dict, OrderedDict, Tuple

import torch
from audiocraft.models import MusicGen

from transformers import (
    AutoFeatureExtractor,
    AutoTokenizer,
    EncodecModel,
    MusicgenDecoderConfig,
    MusicgenForConditionalGeneration,
    MusicgenProcessor,
    TaEncoderModel,
)
from transformers.models.musicgen.modeling_musicgen import MusicgenForCausalLM
from transformers.utils import logging


logging.set_verbosity_info()
SCREAMING_SNAKE_CASE__     =       logging.get_logger(__name__)


SCREAMING_SNAKE_CASE__     =       ['model.decoder.embed_positions.weights']







def    lowercase__			(				__UpperCamelCase   )->			Tuple:
      if "emb" in name:
            UpperCamelCase      = name.replace("""emb"""		,						"""model.decoder.embed_tokens"""   )
      if "transformer" in name:
            UpperCamelCase      = name.replace("""transformer"""		,						"""model.decoder"""   )
      if "cross_attention" in name:
            UpperCamelCase      = name.replace("""cross_attention"""		,						"""encoder_attn"""   )
      if "linear1" in name:
            UpperCamelCase      = name.replace("""linear1"""		,						"""fc1"""   )
      if "linear2" in name:
            UpperCamelCase      = name.replace("""linear2"""		,						"""fc2"""   )
      if "norm1" in name:
            UpperCamelCase      = name.replace("""norm1"""		,						"""self_attn_layer_norm"""   )
      if "norm_cross" in name:
            UpperCamelCase      = name.replace("""norm_cross"""		,						"""encoder_attn_layer_norm"""   )
      if "norm2" in name:
            UpperCamelCase      = name.replace("""norm2"""		,						"""final_layer_norm"""   )
      if "out_norm" in name:
            UpperCamelCase      = name.replace("""out_norm"""		,						"""model.decoder.layer_norm"""   )
      if "linears" in name:
            UpperCamelCase      = name.replace("""linears"""		,						"""lm_heads"""   )
      if "condition_provider.conditioners.description.output_proj" in name:
            UpperCamelCase      = name.replace("""condition_provider.conditioners.description.output_proj"""		,						"""enc_to_dec_proj"""   )
      return name







def    lowercase__			(				__UpperCamelCase		,						__UpperCamelCase   )->			Tuple[Dict, Dict]:
      UpperCamelCase      = list(state_dict.keys()   )
      UpperCamelCase      = {}
      for key in keys:
            UpperCamelCase      = state_dict.pop(__UpperCamelCase   )
            UpperCamelCase      = rename_keys(__UpperCamelCase   )
            if "in_proj_weight" in key:
                  # split fused qkv proj
                  UpperCamelCase      = val[:hidden_size, :]
                  UpperCamelCase      = val[hidden_size : 2 * hidden_size, :]
                  UpperCamelCase      = val[-hidden_size:, :]
            elif "enc_to_dec_proj" in key:
                  UpperCamelCase      = val
            else:
                  UpperCamelCase      = val
      return state_dict, enc_dec_proj_state_dict







def    lowercase__			(				__UpperCamelCase   )->			MusicgenDecoderConfig:
      if checkpoint == "small":
            # default config values
            UpperCamelCase      = 1024
            UpperCamelCase      = 24
            UpperCamelCase      = 16
      elif checkpoint == "medium":
            UpperCamelCase      = 1536
            UpperCamelCase      = 48
            UpperCamelCase      = 24
      elif checkpoint == "large":
            UpperCamelCase      = 2048
            UpperCamelCase      = 48
            UpperCamelCase      = 32
      else:
            raise ValueError(F"Checkpoint should be one of `['small', 'medium', 'large']`, got {checkpoint}."   )
      UpperCamelCase      = MusicgenDecoderConfig(
          hidden_size=__UpperCamelCase		,						ffn_dim=hidden_size * 4		,						num_hidden_layers=__UpperCamelCase		,						num_attention_heads=__UpperCamelCase		,						)
      return config







@torch.no_grad()
def    lowercase__			(				__UpperCamelCase		,						__UpperCamelCase=None		,						__UpperCamelCase=None		,						__UpperCamelCase="cpu"   )->			Optional[int]:
      UpperCamelCase      = MusicGen.get_pretrained(__UpperCamelCase		,						device=__UpperCamelCase   )
      UpperCamelCase      = decoder_config_from_checkpoint(__UpperCamelCase   )

      UpperCamelCase      = fairseq_model.lm.state_dict()
      UpperCamelCase  ,UpperCamelCase      = rename_state_dict(
          __UpperCamelCase		,						hidden_size=decoder_config.hidden_size   )

      UpperCamelCase      = TaEncoderModel.from_pretrained("""t5-base"""   )
      UpperCamelCase      = EncodecModel.from_pretrained("""facebook/encodec_32khz"""   )
      UpperCamelCase      = MusicgenForCausalLM(__UpperCamelCase   ).eval()

      # load all decoder weights - expect that we'll be missing embeddings and enc-dec projection
      UpperCamelCase  ,UpperCamelCase      = decoder.load_state_dict(__UpperCamelCase		,						strict=__UpperCamelCase   )

      for key in missing_keys.copy():
            if key.startswith(("""text_encoder""", """audio_encoder""")   ) or key in EXPECTED_MISSING_KEYS:
                  missing_keys.remove(__UpperCamelCase   )

      if len(__UpperCamelCase   ) > 0:
            raise ValueError(F"Missing key(s) in state_dict: {missing_keys}"   )

      if len(__UpperCamelCase   ) > 0:
            raise ValueError(F"Unexpected key(s) in state_dict: {unexpected_keys}"   )

      # init the composite model
      UpperCamelCase      = MusicgenForConditionalGeneration(text_encoder=__UpperCamelCase		,						audio_encoder=__UpperCamelCase		,						decoder=__UpperCamelCase   )

      # load the pre-trained enc-dec projection (from the decoder state dict)
      model.enc_to_dec_proj.load_state_dict(__UpperCamelCase   )

      # check we can do a forward pass
      UpperCamelCase      = torch.arange(0		,						8		,						dtype=torch.long   ).reshape(2		,						-1   )
      UpperCamelCase      = input_ids.reshape(2 * 4		,						-1   )

      with torch.no_grad():
            UpperCamelCase      = model(input_ids=__UpperCamelCase		,						decoder_input_ids=__UpperCamelCase   ).logits

      if logits.shape != (8, 1, 2048):
            raise ValueError("""Incorrect shape for logits"""   )

      # now construct the processor
      UpperCamelCase      = AutoTokenizer.from_pretrained("""t5-base"""   )
      UpperCamelCase      = AutoFeatureExtractor.from_pretrained("""facebook/encodec_32khz"""		,						padding_side="""left"""   )

      UpperCamelCase      = MusicgenProcessor(feature_extractor=__UpperCamelCase		,						tokenizer=__UpperCamelCase   )

      # set the appropriate bos/pad token ids
      UpperCamelCase      = 2048
      UpperCamelCase      = 2048

      # set other default generation config params
      UpperCamelCase      = int(30 * audio_encoder.config.frame_rate   )
      UpperCamelCase      = True
      UpperCamelCase      = 3.0

      if pytorch_dump_folder is not None:
            Path(__UpperCamelCase   ).mkdir(exist_ok=__UpperCamelCase   )
            logger.info(F"Saving model {checkpoint} to {pytorch_dump_folder}"   )
            model.save_pretrained(__UpperCamelCase   )
            processor.save_pretrained(__UpperCamelCase   )

      if repo_id:
            logger.info(F"Pushing model {checkpoint} to {repo_id}"   )
            model.push_to_hub(__UpperCamelCase   )
            processor.push_to_hub(__UpperCamelCase   )


if __name__ == "__main__":
     SCREAMING_SNAKE_CASE__     =       argparse.ArgumentParser()
     # Required parameters
     parser.add_argument(
         '--checkpoint',
         default='small',
         type=str,
         help='Checkpoint size of the MusicGen model you\'d like to convert. Can be one of: `[\'small\', \'medium\', \'large\']`.',
     )
     parser.add_argument(
         '--pytorch_dump_folder',
         required=True,
         default=None,
         type=str,
         help='Path to the output PyTorch model directory.',
     )
     parser.add_argument(
         '--push_to_hub', default=None, type=str, help='Where to upload the converted model on the 🤗 hub.'
     )
     parser.add_argument(
         '--device', default='cpu', type=str, help='Torch device to run the conversion, either cpu or cuda.'
     )

     SCREAMING_SNAKE_CASE__     =       parser.parse_args()
     convert_musicgen_checkpoint(args.checkpoint, args.pytorch_dump_folder, args.push_to_hub)








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