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 prepare_latents(
      self,
      batch_size,
      num_channels_latents,
      height,
      width,
      dtype,
      device,
      generator,
      latents=None,
  ):
      shape = (
          batch_size,
          num_channels_latents,
          height // self.vae_scale_factor,
          width // self.vae_scale_factor,
      )
      if isinstance(generator, list) and len(generator) != batch_size:
          raise ValueError(
              f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
              f" size of {batch_size}. Make sure the batch size matches the length of the generators."
          )
  
      if latents is None:
          latents = randn_tensor(
              shape, generator=generator, device=device, dtype=dtype
          )
      else:
          latents = latents.to(device)
  
      # scale the initial noise by the standard deviation required by the scheduler
      latents = latents * self.scheduler.init_noise_sigma
      return latents
  
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 8 for calling the VersatileDiffusionTextToImagePipeline obj's underlying member method code with example usage: obj.prepare_latents(batch_size, num_channels_latents, height, width, dtype, device, generator, latents) and returns: latents