class_docstr: Pipeline for text-to-image generation using Stable Diffusion XL.
  
  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.)
  
  In addition the pipeline inherits the following loading methods:
      - *LoRA*: [`loaders.StableDiffusionXLLoraLoaderMixin.load_lora_weights`]
      - *Ckpt*: [`loaders.FromSingleFileMixin.from_single_file`]
  
  as well as the following saving methods:
      - *LoRA*: [`loaders.StableDiffusionXLLoraLoaderMixin.save_lora_weights`]
  
  Args:
      vae ([`AutoencoderKL`]):
          Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
      text_encoder ([`CLIPTextModel`]):
          Frozen text-encoder. Stable Diffusion XL uses the text portion of
          [CLIP](https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel), specifically
          the [clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14) variant.
      text_encoder_2 ([` CLIPTextModelWithProjection`]):
          Second frozen text-encoder. Stable Diffusion XL uses the text and pool portion of
          [CLIP](https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModelWithProjection),
          specifically the
          [laion/CLIP-ViT-bigG-14-laion2B-39B-b160k](https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k)
          variant.
      tokenizer (`CLIPTokenizer`):
          Tokenizer of class
          [CLIPTokenizer](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer).
      tokenizer_2 (`CLIPTokenizer`):
          Second Tokenizer of class
          [CLIPTokenizer](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer).
      unet ([`UNet2DConditionModel`]): Conditional U-Net architecture 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 _get_add_time_ids(
      self,
      original_size,
      crops_coords_top_left,
      target_size,
      aesthetic_score,
      negative_aesthetic_score,
      dtype,
  ):
      if self.config.requires_aesthetics_score:
          add_time_ids = list(
              original_size + crops_coords_top_left + (aesthetic_score,)
          )
          add_neg_time_ids = list(
              original_size
              + crops_coords_top_left
              + (negative_aesthetic_score,)
          )
      else:
          add_time_ids = list(
              original_size + crops_coords_top_left + target_size
          )
          add_neg_time_ids = list(
              original_size + crops_coords_top_left + target_size
          )
  
      passed_add_embed_dim = (
          self.unet.config.addition_time_embed_dim * len(add_time_ids)
          + self.text_encoder_2.config.projection_dim
      )
      expected_add_embed_dim = (
          self.unet.add_embedding.linear_1.in_features
      )
  
      if (
          expected_add_embed_dim > passed_add_embed_dim
          and (expected_add_embed_dim - passed_add_embed_dim)
          == self.unet.config.addition_time_embed_dim
      ):
          raise ValueError(
              f"Model expects an added time embedding vector of length {expected_add_embed_dim}, but a vector of {passed_add_embed_dim} was created. Please make sure to enable `requires_aesthetics_score` with `pipe.register_to_config(requires_aesthetics_score=True)` to make sure `aesthetic_score` {aesthetic_score} and `negative_aesthetic_score` {negative_aesthetic_score} is correctly used by the model."
          )
      elif (
          expected_add_embed_dim < passed_add_embed_dim
          and (passed_add_embed_dim - expected_add_embed_dim)
          == self.unet.config.addition_time_embed_dim
      ):
          raise ValueError(
              f"Model expects an added time embedding vector of length {expected_add_embed_dim}, but a vector of {passed_add_embed_dim} was created. Please make sure to disable `requires_aesthetics_score` with `pipe.register_to_config(requires_aesthetics_score=False)` to make sure `target_size` {target_size} is correctly used by the model."
          )
      elif expected_add_embed_dim != passed_add_embed_dim:
          raise ValueError(
              f"Model expects an added time embedding vector of length {expected_add_embed_dim}, but a vector of {passed_add_embed_dim} was created. The model has an incorrect config. Please check `unet.config.time_embedding_type` and `text_encoder_2.config.projection_dim`."
          )
  
      add_time_ids = torch.tensor([add_time_ids], dtype=dtype)
      add_neg_time_ids = torch.tensor([add_neg_time_ids], dtype=dtype)
  
      return add_time_ids, add_neg_time_ids
  
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 ...image_processor import PipelineImageInput, VaeImageProcessor
  from ...loaders import FromSingleFileMixin, StableDiffusionXLLoraLoaderMixin, TextualInversionLoaderMixin
  from ...models import AutoencoderKL, ControlNetModel, UNet2DConditionModel
  from ...models.attention_processor import AttnProcessor2_0, LoRAAttnProcessor2_0, LoRAXFormersAttnProcessor, XFormersAttnProcessor
  from ...models.lora import adjust_lora_scale_text_encoder
  from ...schedulers import KarrasDiffusionSchedulers
  from ...utils import USE_PEFT_BACKEND, is_invisible_watermark_available, logging, replace_example_docstring, scale_lora_layers, unscale_lora_layers
  from ...utils.torch_utils import is_compiled_module, randn_tensor
  from ..pipeline_utils import DiffusionPipeline
  from ..stable_diffusion_xl.pipeline_output import StableDiffusionXLPipelineOutput
  from .multicontrolnet import MultiControlNetModel
label_desc: Use image node_id 15 for calling the StableDiffusionXLControlNetInpaintPipeline obj's underlying member method code with example usage: obj._get_add_time_ids(original_size, crops_coords_top_left, target_size, aesthetic_score, negative_aesthetic_score, dtype) and returns: add_time_ids,  add_neg_time_ids