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.0.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.0.tar.gz.
File metadata
- Download URL: async_gym_agents-0.3.0.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 |
3b4f3f2cdc82932717627979151a0b45b753f608cee7776367e1b7f7a0724961
|
|
| MD5 |
e1c6dd718f5aeb7e3ef809cdddd9d27f
|
|
| BLAKE2b-256 |
6f2a012a663255701c0fff4dbb737c0f42e40f63aeed735ea8bf9311de1e18b6
|
File details
Details for the file async_gym_agents-0.3.0-py3-none-any.whl.
File metadata
- Download URL: async_gym_agents-0.3.0-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 |
98793d0f5fc5b8516bb578b0a57ce1f6f3f3b0436ab4e6807e80c870be56388e
|
|
| MD5 |
0f3e2a9fb4670032453cd75197cbe079
|
|
| BLAKE2b-256 |
18e2915f55a4b0bca277d69094e6502e9b6330d47c47b3e9d0eccdc94218fa5b
|