code: def do_upscale(self, img, model_file):
      use_compile = (
          hasattr(opts, "SWIN_torch_compile")
          and opts.SWIN_torch_compile
          and int(torch.__version__.split(".")[0]) >= 2
          and platform.system() != "Windows"
      )
      current_config = (model_file, opts.SWIN_tile)
  
      if use_compile and self._cached_model_config == current_config:
          model = self._cached_model
      else:
          self._cached_model = None
          try:
              model = self.load_model(model_file)
          except Exception as e:
              print(
                  f"Failed loading SwinIR model {model_file}: {e}",
                  file=sys.stderr,
              )
              return img
          model = model.to(device_swinir, dtype=devices.dtype)
          if use_compile:
              model = torch.compile(model)
              self._cached_model = model
              self._cached_model_config = current_config
      img = upscale(img, model)
      devices.torch_gc()
      return img
  
file_path: stable-diffusion-webui/extensions-builtin/SwinIR/scripts/swinir_model.py
imports: import sys
  import platform
  import numpy
  import torch
  from PIL import Image
  from tqdm import tqdm
  from modules import modelloader, devices, script_callbacks, shared
  from modules.shared import opts, state
  from swinir_model_arch import SwinIR
  from swinir_model_arch_v2 import Swin2SR
  from modules.upscaler import Upscaler, UpscalerData
label_desc: Use image node_id 2 for calling the UpscalerSwinIR obj's underlying member method code with example usage: obj.do_upscale(img, model_file) and returns: img, img