original_docstring:  load pre-trained model in a not-equal way,
      when new model has been partially modified 
docstring: load pre-trained model in a not-equal way,
  when new model has been partially modified
docstring_tokens: load pre - trained model in a not - equal way when new model has been partially modified
code: def neq_load_customized(model, pretrained_dict, verbose=True):
      ''' load pre-trained model in a not-equal way,
      when new model has been partially modified '''
      model_dict = model.state_dict()
      tmp = {}
      if verbose:
          print('\n=======Check Weights Loading======')
          print('Weights not used from pretrained file:')
          for k, v in pretrained_dict.items():
              if k in model_dict:
                  tmp[k] = v
              else:
                  print(k)
          print('---------------------------')
          print('Weights not loaded into new model:')
          for k, v in model_dict.items():
              if k not in pretrained_dict:
                  print(k)
          print('===================================\n')
      # pretrained_dict = {k: v for k, v in pretrained_dict.items() if k in model_dict}
      del pretrained_dict
      model_dict.update(tmp)
      del tmp
      model.load_state_dict(model_dict)
      return model
code_tokens: def neq_load_customized ( model , pretrained_dict , verbose = True ) : model_dict = model . state_dict ( ) tmp = { } if verbose : print ( '\n=======Check Weights Loading======' ) print ( 'Weights not used from pretrained file:' ) for k , v in pretrained_dict . items ( ) : if k in model_dict : tmp [ k ] = v else : print ( k ) print ( '---------------------------' ) print ( 'Weights not loaded into new model:' ) for k , v in model_dict . items ( ) : if k not in pretrained_dict : print ( k ) print ( '===================================\n' ) del pretrained_dict model_dict . update ( tmp ) del tmp model . load_state_dict ( model_dict ) return model
short_docstring: load pre-trained model in a not-equal way,
  when new model has been partially modified
short_docstring_tokens: load pre - trained model in a not - equal way when new model has been partially modified
comment: ''' load pre-trained model in a not-equal way,
      when new model has been partially modified '''$SEP$# pretrained_dict = {k: v for k, v in pretrained_dict.items() if k in model_dict}