andyzeng / visual-pushing-grasping

Train robotic agents to learn to plan pushing and grasping actions for manipulation with deep reinforcement learning.
http://vpg.cs.princeton.edu/
BSD 2-Clause "Simplified" License
883 stars 314 forks source link

RuntimeError: Error(s) in loading state_dict for reinforcement_net: Missing key(s) in state_dict: "push_color_trunk.f #54

Open ZhouHaonanShens opened 4 years ago

ZhouHaonanShens commented 4 years ago

My environment is Ubuntu18.04 and Pytorch version is 1.4.0 when torchvision is 0.5.0. Every time I want to run this demo it would mention me this RuntimeError, following by a amount of name of vars. I think there may be some something wrong with the dict loading and wandering how to cope with this problem sendpix0 .

baotruyenthach commented 4 years ago

Hi, I have the same error as yours. If you already fix this error, could you please teach me? Thanks a lot!

ZhouHaonanShens commented 4 years ago

Sorry, this problem still exists. But I think it may be caused by the GPU memory. My GPU is RTX2080-8G while the usable is less than that value when the system is running. You can check your environment or use a suitable machine to run this code and confirm my conjecture.

SantiDiazC commented 3 years ago

Hi, I have the same problem as yours. Did you solve it? Thanks

StefanoFerraro commented 3 years ago

I solved by adding a 'strict = FALSE' on the load_state_dict function.

line 65 of trainer.py becomes: self.model.load_state_dict(torch.load(snapshot_file), strict=False)

arashakb commented 1 year ago

I solved by adding a 'strict = FALSE' on the load_state_dict function.

line 65 of trainer.py becomes: self.model.load_state_dict(torch.load(snapshot_file), strict=False)

Well, now the code is running but the simulation doesn't work properly on test iterations. Any chance you've got the same issue?

duweiwmxes commented 1 year ago

Because the model the author trained is in torch=0.3.1, which is too low, some expressions have changed in the higher version.You can train a new model yourself and then test it.

duweiwmxes commented 1 year ago

I solved by adding a 'strict = FALSE' on the load_state_dict function. line 65 of trainer.py becomes: self.model.load_state_dict(torch.load(snapshot_file), strict=False)

Well, now the code is running but the simulation doesn't work properly on test iterations. Any chance you've got the same issue? sctrict=False prevents many model parameters from being loaded properly. The method I adopted was to modify the model trained by the author, norm.1 was changed to norm1 and conv.1 was changed to conv1. The new model is as follows: Can't upload .pth.Sorry