class_docstr: Pipeline for text-guided image super-resolution using Stable Diffusion 2.
  
  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.).
  
  The pipeline also inherits the following loading methods:
      - [`~loaders.TextualInversionLoaderMixin.load_textual_inversion`] for loading textual inversion embeddings
      - [`~loaders.LoraLoaderMixin.load_lora_weights`] for loading LoRA weights
      - [`~loaders.LoraLoaderMixin.save_lora_weights`] for saving LoRA weights
      - [`~loaders.FromSingleFileMixin.from_single_file`] for loading `.ckpt` files
  
  Args:
      vae ([`AutoencoderKL`]):
          Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.
      text_encoder ([`~transformers.CLIPTextModel`]):
          Frozen text-encoder ([clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14)).
      tokenizer ([`~transformers.CLIPTokenizer`]):
          A `CLIPTokenizer` to tokenize text.
      unet ([`UNet2DConditionModel`]):
          A `UNet2DConditionModel` to denoise the encoded image latents.
      low_res_scheduler ([`SchedulerMixin`]):
          A scheduler used to add initial noise to the low resolution conditioning image. It must be an instance of
          [`DDPMScheduler`].
      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`].
class_docstr_tok: ["Pipeline","for","text-guided","image","super-resolution","using","Stable","Diffusion","2",".","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.",")",".","The","pipeline","also","inherits","the","following","loading","methods",":","-","[","`","~loaders.TextualInversionLoaderMixin.load_textual_inversion","`","]","for","loading","textual","inversion","embeddings","-","[","`","~loaders.LoraLoaderMixin.load_lora_weights","`","]","for","loading","LoRA","weights","-","[","`","~loaders.LoraLoaderMixin.save_lora_weights","`","]","for","saving","LoRA","weights","-","[","`","~loaders.FromSingleFileMixin.from_single_file","`","]","for","loading","`",".ckpt","`","files","Args",":","vae","(","[","`","AutoencoderKL","`","]",")",":","Variational","Auto-Encoder","(","VAE",")","model","to","encode","and","decode","images","to","and","from","latent","representations",".","text_encoder","(","[","`","~transformers.CLIPTextModel","`","]",")",":","Frozen","text-encoder","(","[","clip-vit-large-patch14","]","(","https",":","\/\/huggingface.co\/openai\/clip-vit-large-patch14",")",")",".","tokenizer","(","[","`","~transformers.CLIPTokenizer","`","]",")",":","A","`","CLIPTokenizer","`","to","tokenize","text",".","unet","(","[","`","UNet2DConditionModel","`","]",")",":","A","`","UNet2DConditionModel","`","to","denoise","the","encoded","image","latents",".","low_res_scheduler","(","[","`","SchedulerMixin","`","]",")",":","A","scheduler","used","to","add","initial","noise","to","the","low","resolution","conditioning","image",".","It","must","be","an","instance","of","[","`","DDPMScheduler","`","]",".","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","`","]","."]
code: def __init__(
      self,
      vae: AutoencoderKL,
      text_encoder: CLIPTextModel,
      tokenizer: CLIPTokenizer,
      unet: UNet2DConditionModel,
      low_res_scheduler: DDPMScheduler,
      scheduler: KarrasDiffusionSchedulers,
      safety_checker: Optional[Any] = None,
      feature_extractor: Optional[CLIPImageProcessor] = None,
      watermarker: Optional[Any] = None,
      max_noise_level: int = 350,
  ):
      super().__init__()
  
      if hasattr(
          vae, "config"
      ):  # check if vae has a config attribute `scaling_factor` and if it is set to 0.08333, else set it to 0.08333 and deprecate
          is_vae_scaling_factor_set_to_0_08333 = (
              hasattr(vae.config, "scaling_factor")
              and vae.config.scaling_factor == 0.08333
          )
          if not is_vae_scaling_factor_set_to_0_08333:
              deprecation_message = (
                  "The configuration file of the vae does not contain `scaling_factor` or it is set to"
                  f" {vae.config.scaling_factor}, which seems highly unlikely. If your checkpoint is a fine-tuned"
                  " version of `stabilityai/stable-diffusion-x4-upscaler` you should change 'scaling_factor' to"
                  " 0.08333 Please make sure to update the config accordingly, as not doing so might lead to"
                  " incorrect results in future versions. If you have downloaded this checkpoint from the Hugging"
                  " Face Hub, it would be very nice if you could open a Pull Request for the `vae/config.json` file"
              )
              deprecate(
                  "wrong scaling_factor",
                  "1.0.0",
                  deprecation_message,
                  standard_warn=False,
              )
              vae.register_to_config(scaling_factor=0.08333)
  
      self.register_modules(
          vae=vae,
          text_encoder=text_encoder,
          tokenizer=tokenizer,
          unet=unet,
          low_res_scheduler=low_res_scheduler,
          scheduler=scheduler,
          safety_checker=safety_checker,
          watermarker=watermarker,
          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, resample="bicubic"
      )
      self.register_to_config(max_noise_level=max_noise_level)
  
imports: import inspect
  import warnings
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import PIL.Image
  import torch
  from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
  from ...image_processor import PipelineImageInput, VaeImageProcessor
  from ...loaders import FromSingleFileMixin, LoraLoaderMixin, TextualInversionLoaderMixin
  from ...models import AutoencoderKL, UNet2DConditionModel
  from ...models.attention_processor import AttnProcessor2_0, LoRAAttnProcessor2_0, LoRAXFormersAttnProcessor, XFormersAttnProcessor
  from ...models.lora import adjust_lora_scale_text_encoder
  from ...schedulers import DDPMScheduler, KarrasDiffusionSchedulers
  from ...utils import USE_PEFT_BACKEND, deprecate, logging, scale_lora_layers, unscale_lora_layers
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline
  from .None import StableDiffusionPipelineOutput
label_desc: Use image node_id 1 to create a new StableDiffusionUpscalePipeline object from inherited base classes: DiffusionPipeline, TextualInversionLoaderMixin, LoraLoaderMixin, FromSingleFileMixin with example: obj = StableDiffusionUpscalePipeline(vae, text_encoder, tokenizer, unet, low_res_scheduler, scheduler, safety_checker, feature_extractor, watermarker, max_noise_level)