Gymnasium inspired tools for (really) parallel Reinforcement Learning
Project description
ParallEnv
A small library that provides an RL environment class for parallelization. The core class, ParallelEnv, is inspired by Gymnasium environments, especially its vectorized environments, but it does not work in exactly the same way. The key difference is that ParallelEnv allows environments and policies to run concurrently in separate processes. This maximizes the throughput of RL simulations.
Usage Example
import gymnasium as gym
from parallenv import ParallEnv
if __name__ == "__main__":
batch_size = 16
num_envs = 32
env_fns = [lambda: gym.make("CartPole-v1") for _ in range(num_envs)]
envs = ParallEnv(
env_fns,
batch_size=batch_size,
num_workers=4,
)
envs.reset()
for i in range(1000):
ids, observation, reward, terminated, truncated, info = envs.gather()
# No more resets are required since `next_step` autoreset is set by default.
actions = envs.action_space.sample()
# This call is not blocking, you don't have to wait for the sub-environments
# to run.
envs.step(ids, actions)
envs.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parallenv-0.1.0.tar.gz.
File metadata
- Download URL: parallenv-0.1.0.tar.gz
- Upload date:
- Size: 51.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
445a3993ef0ab7a07b5885eee22abfbfb2413a554eeaa164f925798ec4d0d489
|
|
| MD5 |
1cdcab1d618987de64ff99f58afc9cae
|
|
| BLAKE2b-256 |
a6d64d5befb3022087c11dd3d6ec7d71b46ccf781cc0caedf803a820dbfa9f29
|
File details
Details for the file parallenv-0.1.0-py3-none-any.whl.
File metadata
- Download URL: parallenv-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e20c5c09a4f1c7e1d9f418d6ef60cfdf02559bb4ade269efc979e99609a550ee
|
|
| MD5 |
1c152dcd493c7d3cf211e8dbe8ad2782
|
|
| BLAKE2b-256 |
60edfb7b7547a9cd3020180cb8b412688cc78da8e9dc76b331a112d7080d7d8c
|