class_docstr: Pipeline for text-to-image generation using unCLIP
  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:
      text_encoder ([`CLIPTextModelWithProjection`]):
          Frozen text-encoder.
      tokenizer (`CLIPTokenizer`):
          Tokenizer of class
          [CLIPTokenizer](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer).
      prior ([`PriorTransformer`]):
          The canonincal unCLIP prior to approximate the image embedding from the text embedding.
      text_proj ([`UnCLIPTextProjModel`]):
          Utility class to prepare and combine the embeddings before they are passed to the decoder.
      decoder ([`UNet2DConditionModel`]):
          The decoder to invert the image embedding into an image.
      super_res_first ([`UNet2DModel`]):
          Super resolution unet. Used in all but the last step of the super resolution diffusion process.
      super_res_last ([`UNet2DModel`]):
          Super resolution unet. Used in the last step of the super resolution diffusion process.
      prior_scheduler ([`UnCLIPScheduler`]):
          Scheduler used in the prior denoising process. Just a modified DDPMScheduler.
      decoder_scheduler ([`UnCLIPScheduler`]):
          Scheduler used in the decoder denoising process. Just a modified DDPMScheduler.
      super_res_scheduler ([`UnCLIPScheduler`]):
          Scheduler used in the super resolution denoising process. Just a modified DDPMScheduler.
class_docstr_tok: ["Pipeline","for","text-to-image","generation","using","unCLIP","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",":","text_encoder","(","[","`","CLIPTextModelWithProjection","`","]",")",":","Frozen","text-encoder",".","tokenizer","(","`","CLIPTokenizer","`",")",":","Tokenizer","of","class","[","CLIPTokenizer","]","(","https",":","\/\/huggingface.co\/docs\/transformers\/v4.21.0\/en\/model_doc\/clip","#","transformers.CLIPTokenizer",")",".","prior","(","[","`","PriorTransformer","`","]",")",":","The","canonincal","unCLIP","prior","to","approximate","the","image","embedding","from","the","text","embedding",".","text_proj","(","[","`","UnCLIPTextProjModel","`","]",")",":","Utility","class","to","prepare","and","combine","the","embeddings","before","they","are","passed","to","the","decoder",".","decoder","(","[","`","UNet2DConditionModel","`","]",")",":","The","decoder","to","invert","the","image","embedding","into","an","image",".","super_res_first","(","[","`","UNet2DModel","`","]",")",":","Super","resolution","unet",".","Used","in","all","but","the","last","step","of","the","super","resolution","diffusion","process",".","super_res_last","(","[","`","UNet2DModel","`","]",")",":","Super","resolution","unet",".","Used","in","the","last","step","of","the","super","resolution","diffusion","process",".","prior_scheduler","(","[","`","UnCLIPScheduler","`","]",")",":","Scheduler","used","in","the","prior","denoising","process",".","Just","a","modified","DDPMScheduler",".","decoder_scheduler","(","[","`","UnCLIPScheduler","`","]",")",":","Scheduler","used","in","the","decoder","denoising","process",".","Just","a","modified","DDPMScheduler",".","super_res_scheduler","(","[","`","UnCLIPScheduler","`","]",")",":","Scheduler","used","in","the","super","resolution","denoising","process",".","Just","a","modified","DDPMScheduler","."]
code: def __init__(
      self,
      prior: PriorTransformer,
      decoder: UNet2DConditionModel,
      text_encoder: CLIPTextModelWithProjection,
      tokenizer: CLIPTokenizer,
      text_proj: UnCLIPTextProjModel,
      super_res_first: UNet2DModel,
      super_res_last: UNet2DModel,
      prior_scheduler: UnCLIPScheduler,
      decoder_scheduler: UnCLIPScheduler,
      super_res_scheduler: UnCLIPScheduler,
  ):
      super().__init__()
  
      self.register_modules(
          prior=prior,
          decoder=decoder,
          text_encoder=text_encoder,
          tokenizer=tokenizer,
          text_proj=text_proj,
          super_res_first=super_res_first,
          super_res_last=super_res_last,
          prior_scheduler=prior_scheduler,
          decoder_scheduler=decoder_scheduler,
          super_res_scheduler=super_res_scheduler,
      )
  
file_path: StableDiffusion/ldm/modules/karlo/diffusers_pipeline.py
imports: import inspect
  from typing import List, Optional, Tuple, Union
  import torch
  from torch.nn import functional
  from transformers import CLIPTextModelWithProjection, CLIPTokenizer
  from transformers.models.clip.modeling_clip import CLIPTextModelOutput
  from ...models import PriorTransformer, UNet2DConditionModel, UNet2DModel
  from ...pipelines import DiffusionPipeline, ImagePipelineOutput
  from ...schedulers import UnCLIPScheduler
  from ...utils import is_accelerate_available, logging, randn_tensor
  from .text_proj import UnCLIPTextProjModel
label_desc: Use image node_id 1 to create a new UnCLIPPipeline object from inherited base classes: DiffusionPipeline with example: obj = UnCLIPPipeline(prior, decoder, text_encoder, tokenizer, text_proj, super_res_first, super_res_last, prior_scheduler, decoder_scheduler, super_res_scheduler)