RuntimeError: Error(s) in loading state_dict for GnnNets: Missing key(s) in state_dict: "model.gnn_layers.0.lin.weight", "model.gnn_layers.1.lin.weight", "model.gnn_layers.2.lin.weight". #217
I have this problem,
RuntimeError: Error(s) in loading state_dict for GnnNets:
Missing key(s) in state_dict: "model.gnn_layers.0.lin.weight", "model.gnn_layers.1.lin.weight", "model.gnn_layers.2.lin.weight".
in this code
def update_state_dict(self, state_dict):
original_state_dict = self.state_dict()
print('dict',state_dict.items())
loaded_state_dict = dict()
for k, v in state_dict.items():
if k in original_state_dict.keys():
loaded_state_dict[k] = v
self.load_state_dict(loaded_state_dict)
I have this problem, RuntimeError: Error(s) in loading state_dict for GnnNets: Missing key(s) in state_dict: "model.gnn_layers.0.lin.weight", "model.gnn_layers.1.lin.weight", "model.gnn_layers.2.lin.weight".
in this code def update_state_dict(self, state_dict): original_state_dict = self.state_dict() print('dict',state_dict.items()) loaded_state_dict = dict() for k, v in state_dict.items(): if k in original_state_dict.keys(): loaded_state_dict[k] = v self.load_state_dict(loaded_state_dict)