code: """
  ## CycleISP: Real Image Restoration Via Improved Data Synthesis
  ## Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, Ming-Hsuan Yang, and Ling Shao
  ## CVPR 2020
  ## https://arxiv.org/abs/2003.07761
  """
  
  from collections import OrderedDict
  
  import torch
  
  
  def load_checkpoint(model, weights):
      checkpoint = torch.load(weights, map_location='cpu')
      try:
          model.load_state_dict(checkpoint["state_dict"])
      except:
          state_dict = checkpoint["state_dict"]
          new_state_dict = OrderedDict()
          for k, v in state_dict.items():
              name = k[7:] # remove `module.`
              new_state_dict[name] = v
          model.load_state_dict(new_state_dict)
apis: torch.load