Toni-SM / skrl

Modular reinforcement learning library (on PyTorch and JAX) with support for NVIDIA Isaac Gym, Omniverse Isaac Gym and Isaac Lab
https://skrl.readthedocs.io/
MIT License
445 stars 43 forks source link

Loading the .pth file trained in the Isaac Gym environment #17

Closed famora2 closed 2 years ago

famora2 commented 2 years ago

Hi,

I really like this feature in skrl which enables simultaneous deploying of agents (https://skrl.readthedocs.io/en/latest/intro/examples.html). However, it would be great if skrl for example can also load the .pth file trained with Isaac Gym Library(https://github.com/NVIDIA-Omniverse/IsaacGymEnvs) for benchmark purposes. Currently, one gets the following errors:


  File "ppo_ant.py", line 135, in <module>
    models_ppo["policy"].load("./ant_best.pth")
  File "/home/user/skrl/skrl/models/torch/base.py", line 302, in load
    self.load_state_dict(torch.load(path))
  File "/home/user/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Policy:
    Missing key(s) in state_dict: "log_std_parameter", "net.0.weight", "net.0.bias", "net.2.weight", "net.2.bias", "net.4.weight", "net.4.bias", "net.6.weight", "net.6.bias". 
    Unexpected key(s) in state_dict: "running_mean_std", "reward_mean_std", "model", "epoch", "optimizer", "frame", "last_mean_rewards", "env_state".