nikhilbarhate99 / PPO-PyTorch

Minimal implementation of clipped objective Proximal Policy Optimization (PPO) in PyTorch
MIT License
1.66k stars 343 forks source link

RuntimeError: Error(s) in loading state_dict for ActorCritic: Unexpected key(s) in state_dict: "affine.weight", "affine.bias". #27

Closed nro-bot closed 4 years ago

nro-bot commented 4 years ago

Ran into error running test.py (after installing unmentioned dependency, box2d-py).

RuntimeError: Error(s) in loading state_dict for ActorCritic:
    Unexpected key(s) in state_dict: "affine.weight", "affine.bias". 

Fix is to add "strict=False" to model loading.

     ppo.policy_old.load_state_dict(torch.load(directory+filename), strict=False)
fatalfeel commented 4 years ago

same as my problem~~~