How Can I Load trained pth file to real?

Hi, I really Love Isaac Gym’s Reinforcement Learning Service, this is incredible.

I want to have a learned model and implement it into reality.
I think the pth file is saved as set_dof_action_force_tensor and I wonder how to load the trained pth to send this signal to DAQ such as Arduino, Raspberry Pi, or Jetson.

I’ve been looking at pytorch’s save & load to implement this, but I’m not sure how to do with model = MyModel() for model.eval() part.

ex)
image

How do I load the learned pth and convert it to torque output data ?

(I referred CartPole example from GitHub - NVIDIA-Omniverse/IsaacGymEnvs: Isaac Gym Reinforcement Learning Environments)

1 Like

LeggedGym library has some codes for importing a NN and testing it, there should be similar code in other environments, I didn’t check if it uses Pytorch but it should be. Easiest way is to use the same computer you are using for Gym to control the hardware maybe with an Arduino or another interface as the middle guy! but if you want to transfer your NN to another processor like Arduino, RP or Jetson, for each one you have to use a different library which can read that NN. You can use TensorRT to optimize your NN for less powerful processors:
https://developer.nvidia.com/tensorrt