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 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
env = IndexableMultiEnv([lambda: gym.make("Pendulum-v1") for i in range(8)])

# Create the model, injected with async capabilities
model = get_injected_agent(TD3)("MlpPolicy", env)

# 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.1.0.tar.gz (37.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.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: async_gym_agents-0.1.0.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.6 Windows/10

File hashes

Hashes for async_gym_agents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c2ef06681cf8e812791954219583a6bee0e43004de924089b196e34a65e48823
MD5 aa8f5e11ebc6241768d6449a87b11a3e
BLAKE2b-256 2001c4aa849803077c782ad2e32842b1435dd68c8eb3f148a0ed2b456f1a4f61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: async_gym_agents-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.6 Windows/10

File hashes

Hashes for async_gym_agents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 674e360422f91efbbdc9290dd84af68fbe0c73f34051efc7a4587b4ae51df05f
MD5 2ec7d0137a9c0097c633d98806812840
BLAKE2b-256 74009dc80eac3326fe2962b20d42505876075ff33c40702b5d16217e10ec91a8

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