-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT] C++ Export #228
base: master
Are you sure you want to change the base?
[DRAFT] C++ Export #228
Conversation
For some application, I would also be interrested in having the values predictions available, so I am adding them as well, some questions:
|
Also, is there a consistent pattern across all algorithms to access values functions just like |
Another question/note: If we use the |
yes, we already save the mean and std for observation in a separate file ( |
not really... Only between algorithms of the same family...
I agree but I would not focus on that for now (value functions are not needed for inference, unless it is DQN). |
that's hard to give only one answer, we surely hope they are, but that doesn't mean it is always the case.
yes
for rough estimation, only one is needed. |
@Gregwar I could successfully test it =) export CMAKE_PREFIX_PATH="${HOME}/.local/lib/libtorch:/home/user/miniconda3" where the conda prefix can be retrieved with I also had to comment out the hardcoded |
I think I will have to setup some (automated) tests to check for consistency between Python and C++ predictions. It will be hard to be sure to cover all the cases else, I am digging in the code of all the possible algorithms and I might miss some information (there are many possible options as well like using images as input that should get normalized, using SDE, the Wrapping "normalize" that is not handled at all currently etc.) |
Let's do a first working version that covers only some algorithms (let's say PPO, DQN and SAC) and only covers basic case (MLP, no images, no additional feature like normalization or SDE). Once that's working and merged, we can work on adding additional features, I would start with normalization and then image support ;) |
Hello, Sorry for the lag, we are currently working on our humanoid robots for RoboCup, we integrate DRL algorithms in the robots for the first year. We spent some time investigating and finally using OpenVino runtime because of our robots architecture (we use ONNX as intermediary representation OpenVino's model exporter). In first place I thought of implementing pre/post processing in C++ but it is actually a better idea to use it in the PyTorch module that is being traced or exported. We can't provide a lot of runtime-specific implementation, so we could focus on libtorch as first intended and provide ONNX possibility for people that want to use something else. |
@Gregwar could you give me access to your repo so I can push changes? (mainly merging master with this branch) |
@araffin Is there any update on this PR? I would be interested in exporting SB3 models into C++ executables but I am not sure on how to approach this problem |
For inference, you can have a look at https://stable-baselines3.readthedocs.io/en/master/guide/export.html |
Description
This is a draft, I suggest we keep the conversation in the associated issue:
DLR-RM/stable-baselines3#836
Motivation and Context
DLR-RM/stable-baselines3#836
Types of changes
Checklist:
make format
(required)make check-codestyle
andmake lint
(required)make pytest
andmake type
both pass. (required)