code: def load_model(model, pretrained):
      weights = torch.load(pretrained)
      pretrained_dict = weights["state_dict"]
      model_dict = model.state_dict()
  
      # print("to here")
      # print(model_dict.keys())
      # print('\n')
  
      # print(pretrained_dict.keys())
  
      # import pdb;pdb.set_trace()
  
      if "LightCNN" in pretrained:
          tmp = [k for k in pretrained_dict]
          if "module." in tmp[0]:
              pretrained_dict = {
                  k.replace("module.", ""): v
                  for k, v in pretrained_dict.items()
                  if k.replace("module.", "") in model_dict
              }
      else:
          pretrained_dict = {
              k: v
              for k, v in pretrained_dict.items()
              if k in model_dict and k != "module.weight"
          }
  
      print("len of params to be loaded: ", len(pretrained_dict))
      model.load_state_dict(pretrained_dict, strict=False)
  
      return weights["epoch"]
  
file_path: insightface/recognition/idmmd/utils.py
imports: import os
  import numpy
  import torch
  import torch.nn.functional
label_desc: Use image node_id 6 for calling a global function with example usage: load_model(model, pretrained) and returns: weights