-
Notifications
You must be signed in to change notification settings - Fork 526
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
[Question] Does hyperparameter tuning support custom vectorized environments? #439
Comments
Looking at the source code, it seems like it could be done by adding an if/else in rl-baselines3-zoo/rl_zoo3/exp_manager.py Line 622 in aa38145
env = make_env(**env_kwargs) ? More specifically, replace lines 622-632 with:
Curious if this might break things down the line, and/or if there is an already built solution I'm missing? (I'd rather not have to integrate the entire rl_zoo3 repo in my project for cleanliness' sake) |
In your case, the best is probably to fork the RL Zoo to adapt it to your needs (you can still install it as an editable package so you don't have to integrate it in your codebase).
We have something similar for a tentative PR with envpool integration: #355 |
Sounds good, thanks for letting me know. I'll fork and make the changes. In case anyone else has the same question, I'll be updating the code here: |
Maybe, could you do a pr to update the docs? |
Sure, however I'm new to the repo so I'm not sure the standards / where to do this. What exactly should I update and with what information? Should I do something along the lines of "If your custom environment implements the Stable Baselines 3 VecEnv class, you will have to update the source code (see issue [....])." in https://github.com/DLR-RM/rl-baselines3-zoo/blob/master/docs/guide/custom_env.rst? |
yes, this file. with an explanation/link (link to this issue) on what to do when you have Something like https://stable-baselines3.readthedocs.io/en/master/guide/examples.html#sb3-and-procgenenv |
❓ Question
Hello,
I have implemented a custom Vectorized Environment using Mujoco (which adheres to stable baseline 3's VecEnv standard), but I haven't found any evidence of RL Zoo 3 supporting (or not supporting) vectorized environments. When I pass my environment name in after registering it with OpenAI gym, RL Zoo 3 always tries to put a VecEnv wrapper on it (such as dummy or subprocenv) and it crashes with an error due to the fact that the interface for a normal Env is not the same as a VecEnv. I am wondering if there is a way (an argument I missed or some source code I could modify) such that I can directly pass in the name of a vectorized environment and RL Zoo 3 will skip the step of wrapping it in a DummyVecEnv and/or SubProcEnv wrapper. I've tried vec_env_wrapper argument in my hyperparameters config, setting env_wrapper to None, and many Google and source code searches but haven't found anything. It doesn't sound like RL Zoo 3 supports this out of the box, but I'm wondering if this is by choice, if I missed a section in the documentation or a past issue already raised, or if I can update the source code so it works for me? (I dont know much about the inner workings of RL Zoo 3, but it seems like an additional argument such as "is_env_vectorized" and an if statement would do the trick).
For context, my hyperparameter config is:
And I am calling the train.py script with arguments relevant to hyperparameter tuning with this script:
The error code I get when I use the above arguments + hyperparameter config is:
It seems like its expecting the Env interface, and not VecEnv, but I can see from the source code that Envs are wrapped in a DummyVecEnv after being gym.make()'d.
Is there something I am missing? Any help would be greatly appreciated!
Checklist
The text was updated successfully, but these errors were encountered: