code: def load_model(self, path, scale=4):
      if path.startswith("http"):
          filename = modelloader.load_file_from_url(
              url=path,
              model_dir=self.model_download_path,
              file_name=f"{self.model_name.replace(' ', '_')}.pth",
          )
      else:
          filename = path
      if filename.endswith(".v2.pth"):
          model = Swin2SR(
              upscale=scale,
              in_chans=3,
              img_size=64,
              window_size=8,
              img_range=1.0,
              depths=[6, 6, 6, 6, 6, 6],
              embed_dim=180,
              num_heads=[6, 6, 6, 6, 6, 6],
              mlp_ratio=2,
              upsampler="nearest+conv",
              resi_connection="1conv",
          )
          params = None
      else:
          model = SwinIR(
              upscale=scale,
              in_chans=3,
              img_size=64,
              window_size=8,
              img_range=1.0,
              depths=[6, 6, 6, 6, 6, 6, 6, 6, 6],
              embed_dim=240,
              num_heads=[8, 8, 8, 8, 8, 8, 8, 8, 8],
              mlp_ratio=2,
              upsampler="nearest+conv",
              resi_connection="3conv",
          )
          params = "params_ema"
  
      pretrained_model = torch.load(filename)
      if params is not None:
          model.load_state_dict(pretrained_model[params], strict=True)
      else:
          model.load_state_dict(pretrained_model, strict=True)
      return model
  
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 3 for calling the UpscalerSwinIR obj's underlying member method code with example usage: obj.load_model(path, scale) and returns: model