Hi bloggers!
Is there a reason for model.state_dict() to be an OrderedDict instead of a vainilla dict?
The thing is I change the name of the parameters of my model and I am creating a new dict to be used in model.load_state_dict()
params=load_checkpoint(args.model_dir,"")
NNetdict=NNet.state_dict()
retrained_dict = {k: v for k, v in params.items() if k in NNetdict}
for k in params.keys():
        if 'list_var' in k:
              newk=k.replace('list_var','list_logvar')
              retrained_dict.update({newk:params[k]})


NNet.load_state_dict(retrained_dict)
NNEt.cuda()


Thanks.