class_docstr: <Tip warning={true}>
  
  🧪 This is an experimental feature!
  
  </Tip>
  
  Pipeline for image-guided image inpainting using Stable Diffusion.
  
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
  implemented for all pipelines (downloading, 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.
      image_encoder ([`PaintByExampleImageEncoder`]):
          Encodes the example input image. The `unet` is conditioned on the example image instead of a text prompt.
      tokenizer ([`~transformers.CLIPTokenizer`]):
          A `CLIPTokenizer` to tokenize text.
      unet ([`UNet2DConditionModel`]):
          A `UNet2DConditionModel` 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`], or [`PNDMScheduler`].
      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 more details
          about a model's potential harms.
      feature_extractor ([`~transformers.CLIPImageProcessor`]):
          A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
class_docstr_tok: ["<","Tip","warning=","{","true","}",">","\ud83e\uddea","This","is","an","experimental","feature","!","<","\/Tip",">","Pipeline","for","image-guided","image","inpainting","using","Stable","Diffusion",".","This","model","inherits","from","[","`","DiffusionPipeline","`","]",".","Check","the","superclass","documentation","for","the","generic","methods","implemented","for","all","pipelines","(","downloading",",","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",".","image_encoder","(","[","`","PaintByExampleImageEncoder","`","]",")",":","Encodes","the","example","input","image",".","The","`","unet","`","is","conditioned","on","the","example","image","instead","of","a","text","prompt",".","tokenizer","(","[","`","~transformers.CLIPTokenizer","`","]",")",":","A","`","CLIPTokenizer","`","to","tokenize","text",".","unet","(","[","`","UNet2DConditionModel","`","]",")",":","A","`","UNet2DConditionModel","`","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","`","]",",","or","[","`","PNDMScheduler","`","]",".","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","more","details","about","a","model","'s","potential","harms",".","feature_extractor","(","[","`","~transformers.CLIPImageProcessor","`","]",")",":","A","`","CLIPImageProcessor","`","to","extract","features","from","generated","images",";","used","as","inputs","to","the","`","safety_checker","`","."]
code: def __init__(
      self,
      vae: AutoencoderKL,
      image_encoder: PaintByExampleImageEncoder,
      unet: UNet2DConditionModel,
      scheduler: Union[
          DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler
      ],
      safety_checker: StableDiffusionSafetyChecker,
      feature_extractor: CLIPImageProcessor,
      requires_safety_checker: bool = False,
  ):
      super().__init__()
  
      self.register_modules(
          vae=vae,
          image_encoder=image_encoder,
          unet=unet,
          scheduler=scheduler,
          safety_checker=safety_checker,
          feature_extractor=feature_extractor,
      )
      self.vae_scale_factor = 2 ** (
          len(self.vae.config.block_out_channels) - 1
      )
      self.image_processor = VaeImageProcessor(
          vae_scale_factor=self.vae_scale_factor
      )
      self.register_to_config(
          requires_safety_checker=requires_safety_checker
      )
  
imports: import inspect
  from typing import Callable, List, Optional, Union
  import numpy
  import PIL.Image
  import torch
  from transformers import CLIPImageProcessor
  from ...image_processor import VaeImageProcessor
  from ...models import AutoencoderKL, UNet2DConditionModel
  from ...schedulers import DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler
  from ...utils import deprecate, logging
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline
  from ..stable_diffusion import StableDiffusionPipelineOutput
  from ..stable_diffusion.safety_checker import StableDiffusionSafetyChecker
  from .image_encoder import PaintByExampleImageEncoder
label_desc: Use image node_id 1 to create a new PaintByExamplePipeline object from inherited base classes: DiffusionPipeline with example: obj = PaintByExamplePipeline(vae, image_encoder, unet, scheduler, safety_checker, feature_extractor, requires_safety_checker)