Async agents for Stable Baselines 3
Project description
Async Gym Agents
Wrapper environments and agent injectors to allow for drop-in async training.
import gymnasium as gym
from functools import partial
from stable_baselines3 import TD3
from async_gym_agents.agents.async_agent import get_injected_agent
from async_gym_agents.envs.multi_env import IndexableMultiEnv
from async_gym_agents.profiler import render_profiler_report
# Create env with 8 parallel envs (Also supports VecEnvs)
env = IndexableMultiEnv([partial(gym.make, "Pendulum-v1") for i in range(8)])
# Create the model, injected with async capabilities
model = get_injected_agent(TD3)("MlpPolicy", env, use_mp=False)
# Train the model
model.learn(total_timesteps=10)
# Inspect main-thread and worker timing
report = model.get_profiler_report()
print(render_profiler_report(report))
# Shut down workers
model.shutdown()
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
async_gym_agents-0.3.2.tar.gz
(16.6 kB
view details)
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 async_gym_agents-0.3.2.tar.gz.
File metadata
- Download URL: async_gym_agents-0.3.2.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31aa2a8a5e5db6cb101824919c90177305bfd2c071d11c8cdffb02851305fac9
|
|
| MD5 |
67d9cb9daf619e77f59ce00814df85ca
|
|
| BLAKE2b-256 |
648a64f9c13ee8cf7eb5192d73b3efb4f2c7389209acdee0a9e8b9821df5beef
|
File details
Details for the file async_gym_agents-0.3.2-py3-none-any.whl.
File metadata
- Download URL: async_gym_agents-0.3.2-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21bef91724d3650401ecba729c0bfe2a8779194cb6a865b6687a39342471e303
|
|
| MD5 |
de1fa6a53d49f8297befb4e707c1ba9b
|
|
| BLAKE2b-256 |
5b4e86f846d0868fbf9975afb0d486ffedd4d97caa1b4c252dc673e915c3cd6b
|