class_docstr: Core ML version of
  `diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline`
class_docstr_tok: ["Core","ML","version","of","`","diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline","`"]
code: def __init__(
      self,
      text_encoder: CoreMLModel,
      unet: CoreMLModel,
      vae_decoder: CoreMLModel,
      scheduler: Union[
          DDIMScheduler,
          DPMSolverMultistepScheduler,
          EulerAncestralDiscreteScheduler,
          EulerDiscreteScheduler,
          LMSDiscreteScheduler,
          PNDMScheduler,
      ],
      tokenizer: CLIPTokenizer,
      controlnet: Optional[List[CoreMLModel]],
      xl: Optional[bool] = False,
      force_zeros_for_empty_prompt: Optional[bool] = True,
      feature_extractor: Optional[CLIPFeatureExtractor] = None,
      safety_checker: Optional[CoreMLModel] = None,
      text_encoder_2: Optional[CoreMLModel] = None,
      tokenizer_2: Optional[CLIPTokenizer] = None,
  ):
      super().__init__()
  
      # Register non-Core ML components of the pipeline similar to the original pipeline
      self.register_modules(
          tokenizer=tokenizer,
          scheduler=scheduler,
          feature_extractor=feature_extractor,
      )
  
      if safety_checker is None:
          # Reproduce original warning:
          # https://github.com/huggingface/diffusers/blob/v0.9.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L119
          logger.warning(
              f"You have disabled the safety checker for {self.__class__} by passing `safety_checker=None`. Ensure"
              " that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered"
              " results in services or applications open to the public. Both the diffusers team and Hugging Face"
              " strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling"
              " it only for use-cases that involve analyzing network behavior or auditing its results. For more"
              " information, please have a look at https://github.com/huggingface/diffusers/pull/254 ."
          )
      self.xl = xl
      self.force_zeros_for_empty_prompt = force_zeros_for_empty_prompt
  
      # Register Core ML components of the pipeline
      self.safety_checker = safety_checker
      self.text_encoder = text_encoder
      self.text_encoder_2 = text_encoder_2
      self.tokenizer_2 = tokenizer_2
      self.unet = unet
      self.unet.in_channels = self.unet.expected_inputs["sample"][
          "shape"
      ][1]
  
      self.controlnet = controlnet
  
      self.vae_decoder = vae_decoder
  
      VAE_DECODER_UPSAMPLE_FACTOR = 8
  
      # In PyTorch, users can determine the tensor shapes dynamically by default
      # In CoreML, tensors have static shapes unless flexible shapes were used during export
      # See https://coremltools.readme.io/docs/flexible-inputs
      latent_h, latent_w = self.unet.expected_inputs["sample"]["shape"][
          2:
      ]
      self.height = latent_h * VAE_DECODER_UPSAMPLE_FACTOR
      self.width = latent_w * VAE_DECODER_UPSAMPLE_FACTOR
  
      logger.info(
          f"Stable Diffusion configured to generate {self.height}x{self.width} images"
      )
  
imports: import argparse
  from diffusers import StableDiffusionPipeline, StableDiffusionXLPipeline
  from diffusers.pipelines.pipeline_utils import DiffusionPipeline
  from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
  from diffusers.schedulers import DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler
  from diffusers.schedulers.scheduling_utils import SchedulerMixin
  import gc
  import inspect
  import logging
  import numpy
  import os
  from python_coreml_stable_diffusion.coreml_model import CoreMLModel, _load_mlpackage, _load_mlpackage_controlnet, get_available_compute_units
  import time
  import torch
  from transformers import CLIPFeatureExtractor, CLIPTokenizer
  from typing import List, Optional, Union, Tuple
  from PIL import Image
label_desc: Use image node_id 1 to create a new CoreMLStableDiffusionPipeline object from inherited base classes: DiffusionPipeline with example: obj = CoreMLStableDiffusionPipeline(text_encoder, unet, vae_decoder, scheduler, tokenizer, controlnet, xl, force_zeros_for_empty_prompt, feature_extractor, safety_checker, text_encoder_2, tokenizer_2)