class_docstr: Args for Regional Prompting Pipeline:
      rp_args:dict
      Required
          rp_args["mode"]: cols, rows, prompt, prompt-ex
      for cols, rows mode
          rp_args["div"]: ex) 1;1;1(Divide into 3 regions)
      for prompt, prompt-ex mode
          rp_args["th"]: ex) 0.5,0.5,0.6 (threshold for prompt mode)
  
      Optional
          rp_args["save_mask"]: True/False (save masks in prompt mode)
  
  Pipeline for text-to-image generation using 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`], 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/CompVis/stable-diffusion-v1-4) for details.
      feature_extractor ([`CLIPImageProcessor`]):
          Model that extracts features from generated images to be used as inputs for the `safety_checker`.
class_docstr_tok: ["Args","for","Regional","Prompting","Pipeline",":","rp_args",":","dict","Required","rp_args","[","``","mode","''","]",":","cols",",","rows",",","prompt",",","prompt-ex","for","cols",",","rows","mode","rp_args","[","``","div","''","]",":","ex",")","1",";","1",";","1","(","Divide","into","3","regions",")","for","prompt",",","prompt-ex","mode","rp_args","[","``","th","''","]",":","ex",")","0.5,0.5,0.6","(","threshold","for","prompt","mode",")","Optional","rp_args","[","``","save_mask","''","]",":","True\/False","(","save","masks","in","prompt","mode",")","Pipeline","for","text-to-image","generation","using","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","`","]",",","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\/CompVis\/stable-diffusion-v1-4",")","for","details",".","feature_extractor","(","[","`","CLIPImageProcessor","`","]",")",":","Model","that","extracts","features","from","generated","images","to","be","used","as","inputs","for","the","`","safety_checker","`","."]
code: def __init__(
      self,
      vae: AutoencoderKL,
      text_encoder: CLIPTextModel,
      tokenizer: CLIPTokenizer,
      unet: UNet2DConditionModel,
      scheduler: KarrasDiffusionSchedulers,
      safety_checker: StableDiffusionSafetyChecker,
      feature_extractor: CLIPFeatureExtractor,
      requires_safety_checker: bool = True,
  ):
      super().__init__(
          vae,
          text_encoder,
          tokenizer,
          unet,
          scheduler,
          safety_checker,
          feature_extractor,
          requires_safety_checker,
      )
      self.register_modules(
          vae=vae,
          text_encoder=text_encoder,
          tokenizer=tokenizer,
          unet=unet,
          scheduler=scheduler,
          safety_checker=safety_checker,
          feature_extractor=feature_extractor,
      )
  
imports: import math
  from typing import Dict, Optional
  import torch
  import torchvision.transforms.functional
  from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer
  from diffusers import StableDiffusionPipeline
  from diffusers.models import AutoencoderKL, UNet2DConditionModel
  from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
  from diffusers.schedulers import KarrasDiffusionSchedulers
  from diffusers.utils import USE_PEFT_BACKEND
label_desc: Use image node_id 1 to create a new RegionalPromptingStableDiffusionPipeline object from inherited base classes: StableDiffusionPipeline with example: obj = RegionalPromptingStableDiffusionPipeline(vae, text_encoder, tokenizer, unet, scheduler, safety_checker, feature_extractor, requires_safety_checker)