code: def model():
      model_name = (
          "vaeapprox-sdxl.pt"
          if getattr(shared.sd_model, "is_sdxl", False)
          else "model.pt"
      )
      loaded_model = sd_vae_approx_models.get(model_name)
  
      if loaded_model is None:
          model_path = os.path.join(
              paths.models_path, "VAE-approx", model_name
          )
          if not os.path.exists(model_path):
              model_path = os.path.join(
                  paths.script_path, "models", "VAE-approx", model_name
              )
  
          if not os.path.exists(model_path):
              model_path = os.path.join(
                  paths.models_path, "VAE-approx", model_name
              )
              download_model(
                  model_path,
                  "https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/download/v1.0.0-pre/"
                  + model_name,
              )
  
          loaded_model = VAEApprox()
          loaded_model.load_state_dict(
              torch.load(
                  model_path,
                  map_location="cpu"
                  if devices.device.type != "cuda"
                  else None,
              )
          )
          loaded_model.eval()
          loaded_model.to(devices.device, devices.dtype)
          sd_vae_approx_models[model_name] = loaded_model
  
      return loaded_model
  
file_path: stable-diffusion-webui/modules/sd_vae_approx.py
imports: import os
  import torch
  from torch import nn
  from modules import devices, paths, shared
label_desc: Use image node_id 2 for calling a global function with example usage: model() and returns: loaded_model