isaac-sim / OmniIsaacGymEnvs

Reinforcement Learning Environments for Omniverse Isaac Gym
Other
760 stars 203 forks source link

Infer trained neural network manually #80

Open BaranAugustus opened 8 months ago

BaranAugustus commented 8 months ago

Hello!

So I have trained 3 neural networks using Omni Isaac Gym Envs and the rl_games RL library. Now I want to define a new task. In this new task I want to infer from the already trained neural networks. So in the pre_physics_step I want to be able to say If condition_0: actions = model_0(obs), else if condition_1: actions=model_1(obs) . I know you can run inference by setting test=True and specifying a corresponding checkpoint, but I want to use multiple networks manually in the code, in my case an OmniIsaacGym Task file.

Think of Hierarchical Reinforcement Learning where you have a higher level policy commanding a lower level policy. When training the higher level policy you need to be able to infer from the already trained lower level policy. Perhaps take a look at the code above the sentence "We should see our cartpole policy running!" in this link: https://docs.omniverse.nvidia.com/isaacsim/latest/tutorial_gym_new_rl_example.html. I, too, want to be able to write action = model.predict(obs).

I have taken this issue into account: https://github.com/Denys88/rl_games/issues/243 Since my knowledge of torch/neural networks is still limited, I do not know if the solution to the linked issue is also the solution to my issue. I expected an easier way to incorporate an already trained neural network into my task file.

eferreirafilho commented 3 months ago

Hi @BaranAugustus, I'm facing a similar crossroads, have you managed to solve that? Many thanks!