class_docstr: Pipeline for text-to-image generation using Versatile 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,
      tokenizer: CLIPTokenizer,
      text_encoder: CLIPTextModelWithProjection,
      image_unet: UNet2DConditionModel,
      text_unet: UNetFlatConditionModel,
      vae: AutoencoderKL,
      scheduler: KarrasDiffusionSchedulers,
  ):
      super().__init__()
      self.register_modules(
          tokenizer=tokenizer,
          text_encoder=text_encoder,
          image_unet=image_unet,
          text_unet=text_unet,
          vae=vae,
          scheduler=scheduler,
      )
      self.vae_scale_factor = 2 ** (
          len(self.vae.config.block_out_channels) - 1
      )
      self.image_processor = VaeImageProcessor(
          vae_scale_factor=self.vae_scale_factor
      )
  
      if self.text_unet is not None:
          self._swap_unet_attention_blocks()
  
imports: import inspect
  from typing import Callable, List, Optional, Union
  import torch
  import torch.utils.checkpoint
  from transformers import CLIPImageProcessor, CLIPTextModelWithProjection, CLIPTokenizer
  from ....image_processor import VaeImageProcessor
  from ....models import AutoencoderKL, Transformer2DModel, UNet2DConditionModel
  from ....schedulers import KarrasDiffusionSchedulers
  from ....utils import deprecate, logging
  from ....utils.torch_utils import randn_tensor
  from ...pipeline_utils import DiffusionPipeline, ImagePipelineOutput
  from .modeling_text_unet import UNetFlatConditionModel
label_desc: Use image node_id 1 to create a new VersatileDiffusionTextToImagePipeline object from inherited base classes: DiffusionPipeline with example: obj = VersatileDiffusionTextToImagePipeline(tokenizer, text_encoder, image_unet, text_unet, vae, scheduler)