class_docstr: Pipeline for text-to-image generation using latent 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.).
  
  Parameters:
      vqvae ([`VQModel`]):
          Vector-quantized (VQ) model to encode and decode images to and from latent representations.
      bert ([`LDMBertModel`]):
          Text-encoder model based on [`~transformers.BERT`].
      tokenizer ([`~transformers.BertTokenizer`]):
          A `BertTokenizer` 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`].
class_docstr_tok: ["Pipeline","for","text-to-image","generation","using","latent","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.",")",".","Parameters",":","vqvae","(","[","`","VQModel","`","]",")",":","Vector-quantized","(","VQ",")","model","to","encode","and","decode","images","to","and","from","latent","representations",".","bert","(","[","`","LDMBertModel","`","]",")",":","Text-encoder","model","based","on","[","`","~transformers.BERT","`","]",".","tokenizer","(","[","`","~transformers.BertTokenizer","`","]",")",":","A","`","BertTokenizer","`","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","`","]","."]
code: def __init__(
      self,
      vqvae: Union[VQModel, AutoencoderKL],
      bert: PreTrainedModel,
      tokenizer: PreTrainedTokenizer,
      unet: Union[UNet2DModel, UNet2DConditionModel],
      scheduler: Union[
          DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler
      ],
  ):
      super().__init__()
      self.register_modules(
          vqvae=vqvae,
          bert=bert,
          tokenizer=tokenizer,
          unet=unet,
          scheduler=scheduler,
      )
      self.vae_scale_factor = 2 ** (
          len(self.vqvae.config.block_out_channels) - 1
      )
  
imports: import inspect
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.utils.checkpoint
  from transformers import PretrainedConfig, PreTrainedModel, PreTrainedTokenizer
  from transformers.activations import ACT2FN
  from transformers.modeling_outputs import BaseModelOutput
  from transformers.utils import logging
  from ...models import AutoencoderKL, UNet2DConditionModel, UNet2DModel, VQModel
  from ...schedulers import DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput
label_desc: Use image node_id 1 to create a new LDMTextToImagePipeline object from inherited base classes: DiffusionPipeline with example: obj = LDMTextToImagePipeline(vqvae, bert, tokenizer, unet, scheduler)