class_docstr: Pipeline for pixel-levl image editing using Pix2Pix Zero. Based on Stable Diffusion.
  
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
  library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
  
  Args:
      vae ([`AutoencoderKL`]):
          Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
      text_encoder ([`CLIPTextModel`]):
          Frozen text-encoder. Stable Diffusion uses the text portion of
          [CLIP](https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel), specifically
          the [clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14) variant.
      tokenizer (`CLIPTokenizer`):
          Tokenizer of class
          [CLIPTokenizer](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer).
      unet ([`UNet2DConditionModel`]): Conditional U-Net architecture to denoise the encoded image latents.
      scheduler ([`SchedulerMixin`]):
          A scheduler to be used in combination with `unet` to denoise the encoded image latents. Can be one of
          [`DDIMScheduler`], [`LMSDiscreteScheduler`], [`EulerAncestralDiscreteScheduler`], or [`DDPMScheduler`].
      safety_checker ([`StableDiffusionSafetyChecker`]):
          Classification module that estimates whether generated images could be considered offensive or harmful.
          Please, refer to the [model card](https://huggingface.co/runwayml/stable-diffusion-v1-5) for details.
      feature_extractor ([`CLIPImageProcessor`]):
          Model that extracts features from generated images to be used as inputs for the `safety_checker`.
      requires_safety_checker (bool):
          Whether the pipeline requires a safety checker. We recommend setting it to True if you're using the
          pipeline publicly.
class_docstr_tok: ["Pipeline","for","pixel-levl","image","editing","using","Pix2Pix","Zero",".","Based","on","Stable","Diffusion",".","This","model","inherits","from","[","`","DiffusionPipeline","`","]",".","Check","the","superclass","documentation","for","the","generic","methods","the","library","implements","for","all","the","pipelines","(","such","as","downloading","or","saving",",","running","on","a","particular","device",",","etc",".",")","Args",":","vae","(","[","`","AutoencoderKL","`","]",")",":","Variational","Auto-Encoder","(","VAE",")","Model","to","encode","and","decode","images","to","and","from","latent","representations",".","text_encoder","(","[","`","CLIPTextModel","`","]",")",":","Frozen","text-encoder",".","Stable","Diffusion","uses","the","text","portion","of","[","CLIP","]","(","https",":","\/\/huggingface.co\/docs\/transformers\/model_doc\/clip","#","transformers.CLIPTextModel",")",",","specifically","the","[","clip-vit-large-patch14","]","(","https",":","\/\/huggingface.co\/openai\/clip-vit-large-patch14",")","variant",".","tokenizer","(","`","CLIPTokenizer","`",")",":","Tokenizer","of","class","[","CLIPTokenizer","]","(","https",":","\/\/huggingface.co\/docs\/transformers\/v4.21.0\/en\/model_doc\/clip","#","transformers.CLIPTokenizer",")",".","unet","(","[","`","UNet2DConditionModel","`","]",")",":","Conditional","U-Net","architecture","to","denoise","the","encoded","image","latents",".","scheduler","(","[","`","SchedulerMixin","`","]",")",":","A","scheduler","to","be","used","in","combination","with","`","unet","`","to","denoise","the","encoded","image","latents",".","Can","be","one","of","[","`","DDIMScheduler","`","]",",","[","`","LMSDiscreteScheduler","`","]",",","[","`","EulerAncestralDiscreteScheduler","`","]",",","or","[","`","DDPMScheduler","`","]",".","safety_checker","(","[","`","StableDiffusionSafetyChecker","`","]",")",":","Classification","module","that","estimates","whether","generated","images","could","be","considered","offensive","or","harmful",".","Please",",","refer","to","the","[","model","card","]","(","https",":","\/\/huggingface.co\/runwayml\/stable-diffusion-v1-5",")","for","details",".","feature_extractor","(","[","`","CLIPImageProcessor","`","]",")",":","Model","that","extracts","features","from","generated","images","to","be","used","as","inputs","for","the","`","safety_checker","`",".","requires_safety_checker","(","bool",")",":","Whether","the","pipeline","requires","a","safety","checker",".","We","recommend","setting","it","to","True","if","you","'re","using","the","pipeline","publicly","."]
docstr: Function used to generate inverted latents given a prompt and image.
  
  Args:
      prompt (`str` or `List[str]`, *optional*):
          The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
          instead.
      image (`torch.FloatTensor` `np.ndarray`, `PIL.Image.Image`, `List[torch.FloatTensor]`, `List[PIL.Image.Image]`, or `List[np.ndarray]`):
          `Image`, or tensor representing an image batch which will be used for conditioning. Can also accept
          image latents as `image`, if passing latents directly, it will not be encoded again.
      num_inference_steps (`int`, *optional*, defaults to 50):
          The number of denoising steps. More denoising steps usually lead to a higher quality image at the
          expense of slower inference.
      guidance_scale (`float`, *optional*, defaults to 1):
          Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
          `guidance_scale` is defined as `w` of equation 2. of [Imagen
          Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
          1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
          usually at the expense of lower image quality.
      generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
          One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
          to make generation deterministic.
      latents (`torch.FloatTensor`, *optional*):
          Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
          generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
          tensor will ge generated by sampling using the supplied random `generator`.
      prompt_embeds (`torch.FloatTensor`, *optional*):
          Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not
          provided, text embeddings will be generated from `prompt` input argument.
      cross_attention_guidance_amount (`float`, defaults to 0.1):
          Amount of guidance needed from the reference cross-attention maps.
      output_type (`str`, *optional*, defaults to `"pil"`):
          The output format of the generate image. Choose between
          [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`.
      return_dict (`bool`, *optional*, defaults to `True`):
          Whether or not to return a [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] instead of a
          plain tuple.
      callback (`Callable`, *optional*):
          A function that will be called every `callback_steps` steps during inference. The function will be
          called with the following arguments: `callback(step: int, timestep: int, latents: torch.FloatTensor)`.
      callback_steps (`int`, *optional*, defaults to 1):
          The frequency at which the `callback` function will be called. If not specified, the callback will be
          called at every step.
      lambda_auto_corr (`float`, *optional*, defaults to 20.0):
          Lambda parameter to control auto correction
      lambda_kl (`float`, *optional*, defaults to 20.0):
          Lambda parameter to control Kullback–Leibler divergence output
      num_reg_steps (`int`, *optional*, defaults to 5):
          Number of regularization loss steps
      num_auto_corr_rolls (`int`, *optional*, defaults to 5):
          Number of auto correction roll steps
  
  Examples:
  
  Returns:
      [`~pipelines.stable_diffusion.pipeline_stable_diffusion_pix2pix_zero.Pix2PixInversionPipelineOutput`] or
      `tuple`:
      [`~pipelines.stable_diffusion.pipeline_stable_diffusion_pix2pix_zero.Pix2PixInversionPipelineOutput`] if
      `return_dict` is True, otherwise a `tuple. When returning a tuple, the first element is the inverted
      latents tensor and then second is the corresponding decoded image.
docstr_tok: ["Function","used","to","generate","inverted","latents","given","a","prompt","and","image",".","Args",":","prompt","(","`","str","`","or","`","List","[","str","]","`",",","*","optional","*",")",":","The","prompt","or","prompts","to","guide","the","image","generation",".","If","not","defined",",","one","has","to","pass","`","prompt_embeds","`",".","instead",".","image","(","`","torch.FloatTensor","`","`","np.ndarray","`",",","`","PIL.Image.Image","`",",","`","List","[","torch.FloatTensor","]","`",",","`","List","[","PIL.Image.Image","]","`",",","or","`","List","[","np.ndarray","]","`",")",":","`","Image","`",",","or","tensor","representing","an","image","batch","which","will","be","used","for","conditioning",".","Can","also","accept","image","latents","as","`","image","`",",","if","passing","latents","directly",",","it","will","not","be","encoded","again",".","num_inference_steps","(","`","int","`",",","*","optional","*",",","defaults","to","50",")",":","The","number","of","denoising","steps",".","More","denoising","steps","usually","lead","to","a","higher","quality","image","at","the","expense","of","slower","inference",".","guidance_scale","(","`","float","`",",","*","optional","*",",","defaults","to","1",")",":","Guidance","scale","as","defined","in","[","Classifier-Free","Diffusion","Guidance","]","(","https",":","\/\/arxiv.org\/abs\/2207.12598",")",".","`","guidance_scale","`","is","defined","as","`","w","`","of","equation","2.","of","[","Imagen","Paper","]","(","https",":","\/\/arxiv.org\/pdf\/2205.11487.pdf",")",".","Guidance","scale","is","enabled","by","setting","`","guidance_scale",">","1","`",".","Higher","guidance","scale","encourages","to","generate","images","that","are","closely","linked","to","the","text","`","prompt","`",",","usually","at","the","expense","of","lower","image","quality",".","generator","(","`","torch.Generator","`","or","`","List","[","torch.Generator","]","`",",","*","optional","*",")",":","One","or","a","list","of","[","torch","generator","(","s",")","]","(","https",":","\/\/pytorch.org\/docs\/stable\/generated\/torch.Generator.html",")","to","make","generation","deterministic",".","latents","(","`","torch.FloatTensor","`",",","*","optional","*",")",":","Pre-generated","noisy","latents",",","sampled","from","a","Gaussian","distribution",",","to","be","used","as","inputs","for","image","generation",".","Can","be","used","to","tweak","the","same","generation","with","different","prompts",".","If","not","provided",",","a","latents","tensor","will","ge","generated","by","sampling","using","the","supplied","random","`","generator","`",".","prompt_embeds","(","`","torch.FloatTensor","`",",","*","optional","*",")",":","Pre-generated","text","embeddings",".","Can","be","used","to","easily","tweak","text","inputs",",","*","e.g",".","*","prompt","weighting",".","If","not","provided",",","text","embeddings","will","be","generated","from","`","prompt","`","input","argument",".","cross_attention_guidance_amount","(","`","float","`",",","defaults","to","0.1",")",":","Amount","of","guidance","needed","from","the","reference","cross-attention","maps",".","output_type","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","pil","''","`",")",":","The","output","format","of","the","generate","image",".","Choose","between","[","PIL","]","(","https",":","\/\/pillow.readthedocs.io\/en\/stable\/",")",":","`","PIL.Image.Image","`","or","`","np.array","`",".","return_dict","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","to","return","a","[","`","~pipelines.stable_diffusion.StableDiffusionPipelineOutput","`","]","instead","of","a","plain","tuple",".","callback","(","`","Callable","`",",","*","optional","*",")",":","A","function","that","will","be","called","every","`","callback_steps","`","steps","during","inference",".","The","function","will","be","called","with","the","following","arguments",":","`","callback","(","step",":","int",",","timestep",":","int",",","latents",":","torch.FloatTensor",")","`",".","callback_steps","(","`","int","`",",","*","optional","*",",","defaults","to","1",")",":","The","frequency","at","which","the","`","callback","`","function","will","be","called",".","If","not","specified",",","the","callback","will","be","called","at","every","step",".","lambda_auto_corr","(","`","float","`",",","*","optional","*",",","defaults","to","20.0",")",":","Lambda","parameter","to","control","auto","correction","lambda_kl","(","`","float","`",",","*","optional","*",",","defaults","to","20.0",")",":","Lambda","parameter","to","control","Kullback\u2013Leibler","divergence","output","num_reg_steps","(","`","int","`",",","*","optional","*",",","defaults","to","5",")",":","Number","of","regularization","loss","steps","num_auto_corr_rolls","(","`","int","`",",","*","optional","*",",","defaults","to","5",")",":","Number","of","auto","correction","roll","steps","Examples",":","Returns",":","[","`","~pipelines.stable_diffusion.pipeline_stable_diffusion_pix2pix_zero.Pix2PixInversionPipelineOutput","`","]","or","`","tuple","`",":","[","`","~pipelines.stable_diffusion.pipeline_stable_diffusion_pix2pix_zero.Pix2PixInversionPipelineOutput","`","]","if","`","return_dict","`","is","True",",","otherwise","a","`","tuple",".","When","returning","a","tuple",",","the","first","element","is","the","inverted","latents","tensor","and","then","second","is","the","corresponding","decoded","image","."]
code: def invert(
      self,
      prompt: Optional[str] = None,
      image: PipelineImageInput = None,
      num_inference_steps: int = 50,
      guidance_scale: float = 1,
      generator: Optional[
          Union[torch.Generator, List[torch.Generator]]
      ] = None,
      latents: Optional[torch.FloatTensor] = None,
      prompt_embeds: Optional[torch.FloatTensor] = None,
      cross_attention_guidance_amount: float = 0.1,
      output_type: Optional[str] = "pil",
      return_dict: bool = True,
      callback: Optional[
          Callable[[int, int, torch.FloatTensor], None]
      ] = None,
      callback_steps: Optional[int] = 1,
      cross_attention_kwargs: Optional[Dict[str, Any]] = None,
      lambda_auto_corr: float = 20.0,
      lambda_kl: float = 20.0,
      num_reg_steps: int = 5,
      num_auto_corr_rolls: int = 5,
  ):
      r"""
      Function used to generate inverted latents given a prompt and image.
  
      Args:
          prompt (`str` or `List[str]`, *optional*):
              The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
              instead.
          image (`torch.FloatTensor` `np.ndarray`, `PIL.Image.Image`, `List[torch.FloatTensor]`, `List[PIL.Image.Image]`, or `List[np.ndarray]`):
              `Image`, or tensor representing an image batch which will be used for conditioning. Can also accept
              image latents as `image`, if passing latents directly, it will not be encoded again.
          num_inference_steps (`int`, *optional*, defaults to 50):
              The number of denoising steps. More denoising steps usually lead to a higher quality image at the
              expense of slower inference.
          guidance_scale (`float`, *optional*, defaults to 1):
              Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
              `guidance_scale` is defined as `w` of equation 2. of [Imagen
              Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
              1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
              usually at the expense of lower image quality.
          generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
              One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
              to make generation deterministic.
          latents (`torch.FloatTensor`, *optional*):
              Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
              generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
              tensor will ge generated by sampling using the supplied random `generator`.
          prompt_embeds (`torch.FloatTensor`, *optional*):
              Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not
              provided, text embeddings will be generated from `prompt` input argument.
          cross_attention_guidance_amount (`float`, defaults to 0.1):
              Amount of guidance needed from the reference cross-attention maps.
          output_type (`str`, *optional*, defaults to `"pil"`):
              The output format of the generate image. Choose between
              [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`.
          return_dict (`bool`, *optional*, defaults to `True`):
              Whether or not to return a [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] instead of a
              plain tuple.
          callback (`Callable`, *optional*):
              A function that will be called every `callback_steps` steps during inference. The function will be
              called with the following arguments: `callback(step: int, timestep: int, latents: torch.FloatTensor)`.
          callback_steps (`int`, *optional*, defaults to 1):
              The frequency at which the `callback` function will be called. If not specified, the callback will be
              called at every step.
          lambda_auto_corr (`float`, *optional*, defaults to 20.0):
              Lambda parameter to control auto correction
          lambda_kl (`float`, *optional*, defaults to 20.0):
              Lambda parameter to control Kullback–Leibler divergence output
          num_reg_steps (`int`, *optional*, defaults to 5):
              Number of regularization loss steps
          num_auto_corr_rolls (`int`, *optional*, defaults to 5):
              Number of auto correction roll steps
  
      Examples:
  
      Returns:
          [`~pipelines.stable_diffusion.pipeline_stable_diffusion_pix2pix_zero.Pix2PixInversionPipelineOutput`] or
          `tuple`:
          [`~pipelines.stable_diffusion.pipeline_stable_diffusion_pix2pix_zero.Pix2PixInversionPipelineOutput`] if
          `return_dict` is True, otherwise a `tuple. When returning a tuple, the first element is the inverted
          latents tensor and then second is the corresponding decoded image.
      """
      # 1. Define call parameters
      if prompt is not None and isinstance(prompt, str):
          batch_size = 1
      elif prompt is not None and isinstance(prompt, list):
          batch_size = len(prompt)
      else:
          batch_size = prompt_embeds.shape[0]
      if cross_attention_kwargs is None:
          cross_attention_kwargs = {}
  
      device = self._execution_device
      # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
      # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
      # corresponds to doing no classifier free guidance.
      do_classifier_free_guidance = guidance_scale > 1.0
  
      # 3. Preprocess image
      image = self.image_processor.preprocess(image)
  
      # 4. Prepare latent variables
      latents = self.prepare_image_latents(
          image, batch_size, self.vae.dtype, device, generator
      )
  
      # 5. Encode input prompt
      num_images_per_prompt = 1
      prompt_embeds, negative_prompt_embeds = self.encode_prompt(
          prompt,
          device,
          num_images_per_prompt,
          do_classifier_free_guidance,
          prompt_embeds=prompt_embeds,
      )
      # For classifier free guidance, we need to do two forward passes.
      # Here we concatenate the unconditional and text embeddings into a single batch
      # to avoid doing two forward passes
      if do_classifier_free_guidance:
          prompt_embeds = torch.cat(
              [negative_prompt_embeds, prompt_embeds]
          )
  
      # 4. Prepare timesteps
      self.inverse_scheduler.set_timesteps(
          num_inference_steps, device=device
      )
      timesteps = self.inverse_scheduler.timesteps
  
      # 6. Rejig the UNet so that we can obtain the cross-attenion maps and
      # use them for guiding the subsequent image generation.
      self.unet = prepare_unet(self.unet)
  
      # 7. Denoising loop where we obtain the cross-attention maps.
      num_warmup_steps = (
          len(timesteps)
          - num_inference_steps * self.inverse_scheduler.order
      )
      with self.progress_bar(total=num_inference_steps) as progress_bar:
          for i, t in enumerate(timesteps):
              # expand the latents if we are doing classifier free guidance
              latent_model_input = (
                  torch.cat([latents] * 2)
                  if do_classifier_free_guidance
                  else latents
              )
              latent_model_input = (
                  self.inverse_scheduler.scale_model_input(
                      latent_model_input, t
                  )
              )
  
              # predict the noise residual
              noise_pred = self.unet(
                  latent_model_input,
                  t,
                  encoder_hidden_states=prompt_embeds,
                  cross_attention_kwargs={"timestep": t},
              ).sample
  
              # perform guidance
              if do_classifier_free_guidance:
                  noise_pred_uncond, noise_pred_text = noise_pred.chunk(
                      2
                  )
                  noise_pred = noise_pred_uncond + guidance_scale * (
                      noise_pred_text - noise_pred_uncond
                  )
  
              # regularization of the noise prediction
              with torch.enable_grad():
                  for _ in range(num_reg_steps):
                      if lambda_auto_corr > 0:
                          for _ in range(num_auto_corr_rolls):
                              var = torch.autograd.Variable(
                                  noise_pred.detach().clone(),
                                  requires_grad=True,
                              )
  
                              # Derive epsilon from model output before regularizing to IID standard normal
                              var_epsilon = self.get_epsilon(
                                  var, latent_model_input.detach(), t
                              )
  
                              l_ac = self.auto_corr_loss(
                                  var_epsilon, generator=generator
                              )
                              l_ac.backward()
  
                              grad = (
                                  var.grad.detach()
                                  / num_auto_corr_rolls
                              )
                              noise_pred = (
                                  noise_pred - lambda_auto_corr * grad
                              )
  
                      if lambda_kl > 0:
                          var = torch.autograd.Variable(
                              noise_pred.detach().clone(),
                              requires_grad=True,
                          )
  
                          # Derive epsilon from model output before regularizing to IID standard normal
                          var_epsilon = self.get_epsilon(
                              var, latent_model_input.detach(), t
                          )
  
                          l_kld = self.kl_divergence(var_epsilon)
                          l_kld.backward()
  
                          grad = var.grad.detach()
                          noise_pred = noise_pred - lambda_kl * grad
  
                      noise_pred = noise_pred.detach()
  
              # compute the previous noisy sample x_t -> x_t-1
              latents = self.inverse_scheduler.step(
                  noise_pred, t, latents
              ).prev_sample
  
              # call the callback, if provided
              if i == len(timesteps) - 1 or (
                  (i + 1) > num_warmup_steps
                  and (i + 1) % self.inverse_scheduler.order == 0
              ):
                  progress_bar.update()
                  if callback is not None and i % callback_steps == 0:
                      step_idx = i // getattr(
                          self.scheduler, "order", 1
                      )
                      callback(step_idx, t, latents)
  
      inverted_latents = latents.detach().clone()
  
      # 8. Post-processing
      image = self.vae.decode(
          latents / self.vae.config.scaling_factor, return_dict=False
      )[0]
      image = self.image_processor.postprocess(
          image, output_type=output_type
      )
  
      # Offload all models
      self.maybe_free_model_hooks()
  
      if not return_dict:
          return (inverted_latents, image)
  
      return Pix2PixInversionPipelineOutput(
          latents=inverted_latents, images=image
      )
  
imports: import inspect
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import PIL.Image
  import torch
  import torch.nn.functional
  from transformers import BlipForConditionalGeneration, BlipProcessor, CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
  from ...image_processor import PipelineImageInput, VaeImageProcessor
  from ...loaders import LoraLoaderMixin, TextualInversionLoaderMixin
  from ...models import AutoencoderKL, UNet2DConditionModel
  from ...models.attention_processor import Attention
  from ...models.lora import adjust_lora_scale_text_encoder
  from ...schedulers import DDIMScheduler, DDPMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler
  from ...schedulers.scheduling_ddim_inverse import DDIMInverseScheduler
  from ...utils import PIL_INTERPOLATION, USE_PEFT_BACKEND, BaseOutput, deprecate, logging, replace_example_docstring, scale_lora_layers, unscale_lora_layers
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline
  from .None import StableDiffusionPipelineOutput
  from .safety_checker import StableDiffusionSafetyChecker
label_desc: Use image node_id 17 for calling the StableDiffusionPix2PixZeroPipeline obj's underlying member method code with example usage: obj.invert(prompt, image, num_inference_steps, guidance_scale, generator, latents, prompt_embeds, cross_attention_guidance_amount, output_type, return_dict, callback, callback_steps, cross_attention_kwargs, lambda_auto_corr, lambda_kl, num_reg_steps, num_auto_corr_rolls) and returns: Pix2PixInversionPipelineOutput, inverted_latents,  image