Denys88 / rl_games

RL implementations
MIT License
800 stars 135 forks source link

How to use Isaac trained customized models (different number of observations and outputs) #269

Open DannyChen1994 opened 6 months ago

DannyChen1994 commented 6 months ago

I refer to the example in https://github.com/Denys88/rl_games/blob/master/notebooks/train_and_export_onnx_example_lstm_continuous.ipynb run and export the onnx model. But when I tried to modify the config file to modify the network structure, I found that the observation quantity of the LSTM layer was always 3 and could not be modified, and the number of actions output by the network could not be modified. The errors are as follows: RuntimeError: Error(s) in loading state_dict for Network: size mismatch for running_mean_std.running_mean: copying a param with shape torch.Size([95]) from checkpoint, the shape in current model is torch.Size([3]). size mismatch for running_mean_std.running_var: copying a param with shape torch.Size([95]) from checkpoint, the shape in current model is torch.Size([3]). size mismatch for a2c_network.sigma: copying a param with shape torch.Size([21]) from checkpoint, the shape in current model is torch.Size([1]). I guess it is related to 'env_config': {'env_name': 'Pendulum-v1', 'seed': 5}, 'env_name': 'envpool' is related to the content. How to set up my own environment and modify the number of observations and actions?

Looking forward to your reply, Thank you!

Denys88 commented 6 months ago

My only quick Idea is to create very simple empty environment with right spaces. I will add obs and action space to the pytorch checkpoint in the future. I am sorry for the inconvenience. Second option is to add this feature (export to the onnx) to the isaacgym directly so it will produce onnx file when training is done.