Skip to main content

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

# 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)

# Shut down workers
model.shutdown()

Project details


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.2.5.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

async_gym_agents-0.2.5-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file async_gym_agents-0.2.5.tar.gz.

File metadata

  • Download URL: async_gym_agents-0.2.5.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.8 Windows/10

File hashes

Hashes for async_gym_agents-0.2.5.tar.gz
Algorithm Hash digest
SHA256 679c45c9e8add0fd9d285382d118a65733273509f24e8f23897f11388a2e51f9
MD5 604e3c76584f18e0f1e4697673f7137f
BLAKE2b-256 2737a073057ff496056cf60aa73234078d13244a52571396f4bc589d98f848de

See more details on using hashes here.

File details

Details for the file async_gym_agents-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: async_gym_agents-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.8 Windows/10

File hashes

Hashes for async_gym_agents-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2b3f54e073241ce0ba2209e4c285187aa63189d31763661a1bf30bec2cb4d85e
MD5 57b1356f89ed4716c625c8eec88c001d
BLAKE2b-256 d2d5ad623877e196b9c7a1e217b17c9600fa87eee8b76179b5011003b33dc98f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page