-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ShmemVectorEnv Implementation #174
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
Conversation
Also need to modify the documentation somewhere. |
Codecov Report
@@ Coverage Diff @@
## dev #174 +/- ##
==========================================
+ Coverage 88.93% 89.40% +0.46%
==========================================
Files 38 39 +1
Lines 2214 2321 +107
==========================================
+ Hits 1969 2075 +106
- Misses 245 246 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
How about #166? |
It would be nice to refactor this module, to avoid many code duplications. But it could be done in another PR. |
Yes, I think so. Another PR will reconstruct these vecenv codes to support wait_num. |
recurse dict is supported now. Ready for review.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR for memory efficiency and speed with large observations 👍
* add shmem vecenv, some add&fix in test_env * generalize test_env IO * pep8 fix * comment update * style change * pep8 fix * style fix * minor fix * fix a bug * test fix * change env * testenv bug fix& shmem support recurse dict * bugfix * pep8 fix * _NP_TO_CT enhance * doc update * docstring update * pep8 fix * style change * style fix * remove assert * minor Co-authored-by: Trinkle23897 <463003665@qq.com>
Following OpenAI baseline, I implement ShmemVectorEnv which is an optimized version of SubprocVectorEnv that uses shared variables to communicate observations. ShmemVectorEnv has exactly the same API as SubprocVectorEnv, but when
obs.shape
is too large, the usage of shared variables can save us a lot of time.This pr include:
I borrow from openai baseline to implement ShmemVectorEnv Class. Please refer to https://github.com/openai/baselines/blob/master/baselines/common/vec_env/shmem_vec_env.py