code: def list_models():
      checkpoints_list.clear()
      checkpoint_aliases.clear()
  
      cmd_ckpt = shared.cmd_opts.ckpt
      if (
          shared.cmd_opts.no_download_sd_model
          or cmd_ckpt != shared.sd_model_file
          or os.path.exists(cmd_ckpt)
      ):
          model_url = None
      else:
          model_url = "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors"
  
      model_list = modelloader.load_models(
          model_path=model_path,
          model_url=model_url,
          command_path=shared.cmd_opts.ckpt_dir,
          ext_filter=[".ckpt", ".safetensors"],
          download_name="v1-5-pruned-emaonly.safetensors",
          ext_blacklist=[".vae.ckpt", ".vae.safetensors"],
      )
  
      if os.path.exists(cmd_ckpt):
          checkpoint_info = CheckpointInfo(cmd_ckpt)
          checkpoint_info.register()
  
          shared.opts.data[
              "sd_model_checkpoint"
          ] = checkpoint_info.title
      elif (
          cmd_ckpt is not None
          and cmd_ckpt != shared.default_sd_model_file
      ):
          print(
              f"Checkpoint in --ckpt argument not found (Possible it was moved to {model_path}: {cmd_ckpt}",
              file=sys.stderr,
          )
  
      for filename in model_list:
          checkpoint_info = CheckpointInfo(filename)
          checkpoint_info.register()
  
imports: import collections
  import os.path
  import sys
  import threading
  import torch
  import re
  import safetensors.torch
  from omegaconf import OmegaConf, ListConfig
  from os import mkdir
  from urllib import request
  import ldm.modules.midas
  from ldm.util import instantiate_from_config
  from modules import paths, shared, modelloader, devices, script_callbacks, sd_vae, sd_disable_initialization, errors, hashes, sd_models_config, sd_unet, sd_models_xl, cache, extra_networks, processing, lowvram, sd_hijack, patches
  from modules.timer import Timer
  import tomesd
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: list_models() without return types