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.4.tar.gz (12.5 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.4-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: async_gym_agents-0.2.4.tar.gz
  • Upload date:
  • Size: 12.5 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.4.tar.gz
Algorithm Hash digest
SHA256 044381a5ce7b12e4dd87de6879f6159210a47236c2908f55cc3955aa9a2f49e4
MD5 3ec91ee8b6b251e6993d4a5d7a4631ec
BLAKE2b-256 93a4c8aea17edf7d63e67f67b4e07adb53c3f3b0262a0af344ad80ec929f5f73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: async_gym_agents-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 18.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 696e038a89e5500ef5bef4907652a1a2c145b4ee88d2852a15df40cc6ed58cfb
MD5 e0fbb67fdc63db23f682f9ba2a6870fc
BLAKE2b-256 9a007d1f799e5a3f4608377cf208e5d76accf64d9c3a349573d4ed359ef6ced2

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