stable-baselines3 icon indicating copy to clipboard operation
stable-baselines3 copied to clipboard

How do I export RecurrentPPO as an onnx model?

Open shuo-Liu opened this issue 3 years ago • 3 comments
trafficstars

❓ Question

How do I export RecurrentPPO as an onnx model?

Checklist

  • [X] I have checked that there is no similar issue in the repo
  • [X] I have read the documentation
  • [X] If code there is, it is minimal and working
  • [X] If code there is, it is formatted using the markdown code blocks for both code and stack traces.

shuo-Liu avatar Oct 17 '22 15:10 shuo-Liu

Hello, what have you tried so far? Did you try adapting what is already in the documentation? https://stable-baselines3.readthedocs.io/en/master/guide/export.html#export-to-onnx

You should also take a look at SB3 contrib code, to have a better understanding of how it works.

araffin avatar Oct 17 '22 15:10 araffin

Hello, thank you for your reply! I have already tried to export the models of PPO and SAC before by using the documentation, but for RecurrentPPO, which uses the LSTM network, I tried to use the forward function in RecurrentActorCriticPolicy as my OnnxablePolicy function, but since I didn't figure out some variables definitions, so the conversion is not successful so far!

Hello, what have you tried so far? Did you try adapting what is already in the documentation? https://stable-baselines3.readthedocs.io/en/master/guide/export.html#export-to-onnx

You should also take a look at SB3 contrib code, to have a better understanding of how it works.

shuo-Liu avatar Oct 18 '22 03:10 shuo-Liu

I didn't figure out some variables definitions, so the conversion is not successful so far!

could you provide what you have currently and the error messages? Please use markdown codeblock to format your code when you do so (see link in the issue template).

araffin avatar Oct 18 '22 12:10 araffin