AI4Finance-Foundation / AI4Finance-Foundation/ElegantRL
✨ build vectorized env from single env
- 主要言語
- Python
- スター
- 4.4k
- フォーク
- 978
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
The [subprocess Vectorized environment of stable baselines 3](https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html) is practically useful.
So I added a simple **subprocess Vectorized environment** into ElegantRL.
Demo code: Add the `num_envs=int` and `if_build_vec_env=True` to the `env_args` for a single env. Then **function `build_env()` **will build a vectorized env automatically.
https://github.com/AI4Finance-Foundation/ElegantRL/blob/003572d9a37a1a302edb8bebd4fbd9c17d5ddccd/examples/demo_A2C_PPO.py#L62-L72
**Function `build_env()`** build a vectorized env from a single env **using `class VecEnv`**:
Build a vectorized env from a single env:
https://github.com/AI4Finance-Foundation/ElegantRL/blob/003572d9a37a1a302edb8bebd4fbd9c17d5ddccd/elegantrl/train/config.py#L112-L124
The **vectorized env `class VecEnv`** is a simplify version of subprocess Vectorized environment for ElegantRL.
`VecEnv` build a vectorized env on GPU. The sub-env number is `num_envs`.
https://github.com/AI4Finance-Foundation/ElegantRL/blob/003572d9a37a1a302edb8bebd4fbd9c17d5ddccd/elegantrl/train/config.py#L245-L248
`VecEnv` use `multiprocessing.Pipe` for communication between `VecEnv` and `SubEnv`:
https://github.com/AI4Finance-Foundation/ElegantRL/blob/003572d9a37a1a302edb8bebd4fbd9c17d5ddccd/elegantrl/train/config.py#L267-L271
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。