code: def main(args):
      logger.info(f"Setting random seed to {args.seed}")
      np.random.seed(args.seed)
  
      logger.info(
          "Initializing PyTorch pipe for reference configuration"
      )
  
      SDP = (
          StableDiffusionXLPipeline
          if "xl" in args.model_version
          else StableDiffusionPipeline
      )
  
      pytorch_pipe = SDP.from_pretrained(
          args.model_version,
          use_auth_token=True,
      )
  
      # Get Scheduler
      user_specified_scheduler = None
      if args.scheduler is not None:
          user_specified_scheduler = SCHEDULER_MAP[
              args.scheduler
          ].from_config(pytorch_pipe.scheduler.config)
  
      # Get Force Zeros Config if it exists
      force_zeros_for_empty_prompt: bool = False
      if "force_zeros_for_empty_prompt" in pytorch_pipe.config:
          force_zeros_for_empty_prompt = pytorch_pipe.config[
              "force_zeros_for_empty_prompt"
          ]
  
      coreml_pipe = get_coreml_pipe(
          pytorch_pipe=pytorch_pipe,
          mlpackages_dir=args.i,
          model_version=args.model_version,
          compute_unit=args.compute_unit,
          scheduler_override=user_specified_scheduler,
          controlnet_models=args.controlnet,
          force_zeros_for_empty_prompt=force_zeros_for_empty_prompt,
          sources=args.model_sources,
      )
  
      if args.controlnet:
          controlnet_cond = []
          for i, _ in enumerate(args.controlnet):
              image_path = args.controlnet_inputs[i]
              image = prepare_controlnet_cond(
                  image_path, coreml_pipe.height, coreml_pipe.width
              )
              controlnet_cond.append(image)
      else:
          controlnet_cond = None
  
      logger.info("Beginning image generation.")
      image = coreml_pipe(
          prompt=args.prompt,
          height=coreml_pipe.height,
          width=coreml_pipe.width,
          num_inference_steps=args.num_inference_steps,
          guidance_scale=args.guidance_scale,
          controlnet_cond=controlnet_cond,
          negative_prompt=args.negative_prompt,
      )
  
      out_path = get_image_path(args)
      logger.info(f"Saving generated image to {out_path}")
      image["images"][0].save(out_path)
  
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 5 for calling a global function with example usage: main(args) without return types