code: def resolve_vae(checkpoint_file) -> VaeResolution:
      if shared.cmd_opts.vae_path is not None:
          return VaeResolution(
              shared.cmd_opts.vae_path, "from commandline argument"
          )
  
      if (
          shared.opts.sd_vae_overrides_per_model_preferences
          and not is_automatic()
      ):
          return resolve_vae_from_setting()
  
      res = resolve_vae_from_user_metadata(checkpoint_file)
      if res.resolved:
          return res
  
      res = resolve_vae_near_checkpoint(checkpoint_file)
      if res.resolved:
          return res
  
      res = resolve_vae_from_setting()
  
      return res
  
imports: import os
  import collections
  from dataclasses import dataclass
  from modules import paths, shared, devices, script_callbacks, sd_models, extra_networks, lowvram, sd_hijack, hashes
  import glob
  from copy import deepcopy
label_desc: Use image node_id 14 for calling a global function with example usage: resolve_vae(checkpoint_file) and returns: res, VaeResolution, resolve_vae_from_setting, res, res