code: def mod2normal(state_dict):
      # this code is copied from https://github.com/victorca25/iNNfer
      if "conv_first.weight" in state_dict:
          crt_net = {}
          items = list(state_dict)
  
          crt_net["model.0.weight"] = state_dict["conv_first.weight"]
          crt_net["model.0.bias"] = state_dict["conv_first.bias"]
  
          for k in items.copy():
              if "RDB" in k:
                  ori_k = k.replace("RRDB_trunk.", "model.1.sub.")
                  if ".weight" in k:
                      ori_k = ori_k.replace(".weight", ".0.weight")
                  elif ".bias" in k:
                      ori_k = ori_k.replace(".bias", ".0.bias")
                  crt_net[ori_k] = state_dict[k]
                  items.remove(k)
  
          crt_net["model.1.sub.23.weight"] = state_dict[
              "trunk_conv.weight"
          ]
          crt_net["model.1.sub.23.bias"] = state_dict["trunk_conv.bias"]
          crt_net["model.3.weight"] = state_dict["upconv1.weight"]
          crt_net["model.3.bias"] = state_dict["upconv1.bias"]
          crt_net["model.6.weight"] = state_dict["upconv2.weight"]
          crt_net["model.6.bias"] = state_dict["upconv2.bias"]
          crt_net["model.8.weight"] = state_dict["HRconv.weight"]
          crt_net["model.8.bias"] = state_dict["HRconv.bias"]
          crt_net["model.10.weight"] = state_dict["conv_last.weight"]
          crt_net["model.10.bias"] = state_dict["conv_last.bias"]
          state_dict = crt_net
      return state_dict
  
file_path: stable-diffusion-webui/modules/esrgan_model.py
imports: import sys
  import numpy
  import torch
  from PIL import Image
  import modules.esrgan_model_arch
  from modules import modelloader, images, devices
  from modules.shared import opts
  from modules.upscaler import Upscaler, UpscalerData
label_desc: Use image node_id 1 for calling a global function with example usage: mod2normal(state_dict) and returns: state_dict