class_docstr: Pipeline for text-to-image generation using Stable Diffusion XL with ControlNet-XS guidance.
  
  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.StableDiffusionXLLoraLoaderMixin.load_lora_weights`] for loading LoRA weights
      - [`~loaders.StableDiffusionXLLoraLoaderMixin.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)).
      text_encoder_2 ([`~transformers.CLIPTextModelWithProjection`]):
          Second frozen text-encoder
          ([laion/CLIP-ViT-bigG-14-laion2B-39B-b160k](https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k)).
      tokenizer ([`~transformers.CLIPTokenizer`]):
          A `CLIPTokenizer` to tokenize text.
      tokenizer_2 ([`~transformers.CLIPTokenizer`]):
          A `CLIPTokenizer` to tokenize text.
      unet ([`UNet2DConditionModel`]):
          A `UNet2DConditionModel` to denoise the encoded image latents.
      controlnet ([`ControlNetXSModel`]:
          Provides additional conditioning to the `unet` during the denoising process.
      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`].
      force_zeros_for_empty_prompt (`bool`, *optional*, defaults to `"True"`):
          Whether the negative prompt embeddings should always be set to 0. Also see the config of
          `stabilityai/stable-diffusion-xl-base-1-0`.
      add_watermarker (`bool`, *optional*):
          Whether to use the [invisible_watermark](https://github.com/ShieldMnt/invisible-watermark/) library to
          watermark output images. If not defined, it defaults to `True` if the package is installed; otherwise no
          watermarker is used.
code: def __init__(
      self,
      vae: AutoencoderKL,
      text_encoder: CLIPTextModel,
      text_encoder_2: CLIPTextModelWithProjection,
      tokenizer: CLIPTokenizer,
      tokenizer_2: CLIPTokenizer,
      unet: UNet2DConditionModel,
      controlnet: ControlNetXSModel,
      scheduler: KarrasDiffusionSchedulers,
      force_zeros_for_empty_prompt: bool = True,
      add_watermarker: Optional[bool] = None,
  ):
      super().__init__()
  
      (
          vae_compatible,
          cnxs_condition_downsample_factor,
          vae_downsample_factor,
      ) = controlnet._check_if_vae_compatible(vae)
      if not vae_compatible:
          raise ValueError(
              f"The downsampling factors of the VAE ({vae_downsample_factor}) and the conditioning part of ControlNetXS model {cnxs_condition_downsample_factor} need to be equal. Consider building the ControlNetXS model with different `conditioning_block_sizes`."
          )
  
      self.register_modules(
          vae=vae,
          text_encoder=text_encoder,
          text_encoder_2=text_encoder_2,
          tokenizer=tokenizer,
          tokenizer_2=tokenizer_2,
          unet=unet,
          controlnet=controlnet,
          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, do_convert_rgb=True
      )
      self.control_image_processor = VaeImageProcessor(
          vae_scale_factor=self.vae_scale_factor,
          do_convert_rgb=True,
          do_normalize=False,
      )
      add_watermarker = (
          add_watermarker
          if add_watermarker is not None
          else is_invisible_watermark_available()
      )
  
      if add_watermarker:
          self.watermark = StableDiffusionXLWatermarker()
      else:
          self.watermark = None
  
      self.register_to_config(
          force_zeros_for_empty_prompt=force_zeros_for_empty_prompt
      )
  
imports: import inspect
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import PIL.Image
  import torch
  import torch.nn.functional
  from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer
  from diffusers.image_processor import PipelineImageInput, VaeImageProcessor
  from diffusers.loaders import FromSingleFileMixin, StableDiffusionXLLoraLoaderMixin, TextualInversionLoaderMixin
  from diffusers.models import AutoencoderKL, ControlNetXSModel, UNet2DConditionModel
  from diffusers.models.attention_processor import AttnProcessor2_0, LoRAAttnProcessor2_0, LoRAXFormersAttnProcessor, XFormersAttnProcessor
  from diffusers.models.lora import adjust_lora_scale_text_encoder
  from diffusers.pipelines.pipeline_utils import DiffusionPipeline
  from diffusers.pipelines.stable_diffusion_xl.pipeline_output import StableDiffusionXLPipelineOutput
  from diffusers.schedulers import KarrasDiffusionSchedulers
  from diffusers.utils import USE_PEFT_BACKEND, logging, scale_lora_layers, unscale_lora_layers
  from diffusers.utils.import_utils import is_invisible_watermark_available
  from diffusers.utils.torch_utils import is_compiled_module, is_torch_version, randn_tensor
label_desc: Use image node_id 1 to create a new StableDiffusionXLControlNetXSPipeline object from inherited base classes: DiffusionPipeline, TextualInversionLoaderMixin, StableDiffusionXLLoraLoaderMixin, FromSingleFileMixin with example: obj = StableDiffusionXLControlNetXSPipeline(vae, text_encoder, text_encoder_2, tokenizer, tokenizer_2, unet, controlnet, scheduler, force_zeros_for_empty_prompt, add_watermarker)